Skip to content

Commit dfb8088

Browse files
author
boonhapus
committed
Merge branch 'dev'
2 parents e8ab58f + fdd9f73 commit dfb8088

File tree

5 files changed

+51
-57
lines changed

5 files changed

+51
-57
lines changed

cs_tools/cli/commands/self.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import pathlib
77
import shutil
88
import sys
9-
import sysconfig
109
import zipfile
1110

1211
from cs_tools import __version__, _types, updater, utils
@@ -53,10 +52,9 @@ def info(
5352
f"\n System Info: [fg-warn]{meta.local_system.system}[/]"
5453
f"\n Configs Directory: [fg-warn]{cs_tools_venv.base_dir}[/]"
5554
f"\nActivate VirtualEnv: [fg-warn]{source}[/]"
56-
f"\n Platform Tags: [fg-warn]{sysconfig.get_platform()}[/]"
55+
f"\n Platform Tags: [fg-warn]{utils.platform_tag()}[/]"
5756
f"\n"
5857
)
59-
6058
if anonymous:
6159
text = utils.anonymize(text, anonymizer=" [dim]{anonymous}[/] ")
6260

cs_tools/updater/_updater.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,35 @@ class CSToolsVenv(venv.EnvBuilder):
3333
VENV_NAME = ".cs_tools"
3434
"""Default name of the VirtualEnvironment."""
3535

36-
TYPICAL_BUILD_DEPENDENCIES = ("wheel >= 0.45", "setuptools >= 75", "hatch", "maturin")
36+
# fmt: off
37+
#
38+
# DEV NOTE: @boonhapus, 2024/02/27
39+
# AS OF TODAY, THERE ARE NO TOOLS IN THE PYTHON ECOSYSTEM WHICH HELP DISCOVER A
40+
# PACKAGE'S build-system requirements. (see: pyproject.toml#build-system.requires)
41+
#
42+
# UPDATED FOR v1.6.0 ON 2024/02/27 ALA pip-dep-tree STYLE.
43+
TYPICAL_BUILD_DEPENDENCIES = (
44+
# TOP-LEVEL FOR MOST PYTHON-based DEPENDENCIES.
45+
"setuptools >= 75",
46+
"wheel >= 0.45",
47+
# BUILD-REQUIRES
48+
"flit_core >= 3.8, <4",
49+
50+
# TOP-LEVEL FOR RUST-based DEPENDENCIES.
51+
"maturin",
52+
# BUILD-REQUIRES
53+
# setuptools ,
54+
# wheel >= 0.36.2 ,
55+
"tomli >= 1.1.0; python_version < '3.11'",
56+
"setuptools-rust >= 1.4.0",
57+
58+
# TOP-LEVEL FOR DEVELOPMENT-based DEPENDENCIES.
59+
"hatch",
60+
# BUILD-REQUIRES
61+
"hatchling >= 1.24.2",
62+
"hatch-vcs >= 0.3.0",
63+
)
64+
# fmt: on
3765
"""uv and pip do not discover these automatically."""
3866

3967
def __init__(
@@ -55,7 +83,7 @@ def __init__(
5583
self.register_venv_path = register_venv_path
5684

5785
# REDUNDANT, BUT NECESSARY IF WE'RE INSTANTIATING DIRECTLY.
58-
self.ctx = super().ensure_directories(self.base_dir / CSToolsVenv.VENV_NAME)
86+
self.ctx = self.ensure_directories(self.base_dir / CSToolsVenv.VENV_NAME)
5987

6088
def __str__(self) -> str:
6189
return f"<CSToolsVenv @ {self.base_dir} has_internet_access={self.has_internet_access}>"

cs_tools/utils.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import logging
2020
import pathlib
2121
import sys
22+
import sysconfig
2223
import zipfile
2324
import zlib
2425

@@ -30,7 +31,7 @@
3031

3132
from cs_tools import _compat
3233

33-
log = logging.getLogger(__name__)
34+
_LOG = logging.getLogger(__name__)
3435
_T = TypeVar("_T")
3536
_EVENT_LOOP: Optional[asyncio.AbstractEventLoop] = None
3637

@@ -101,6 +102,19 @@ async def with_backpressure(coro: Awaitable) -> Any:
101102
return await asyncio.gather(*(with_backpressure(coro) for coro in aws), return_exceptions=return_exceptions)
102103

103104

105+
def platform_tag() -> str:
106+
"""Return the platform tag for use in pip download."""
107+
try:
108+
from pip._vendor.packaging.tags import platform_tags
109+
110+
platform_tag = next(iter(platform_tags()))
111+
except Exception:
112+
_LOG.debug("Could not fetch platform tags from vendored pip.packaging, falling back to sysconfig.")
113+
platform_tag = sysconfig.get_platform()
114+
115+
return platform_tag
116+
117+
104118
def batched(iterable: Iterable[_T], *, n: int) -> Generator[Iterable[_T], None, None]:
105119
"""Yield successive n-sized chunks from list."""
106120
# batched('ABCDEFG', 3) --> ABC DEF G
@@ -269,7 +283,7 @@ def create_dynamic_model(__tablename__: str, *, sample_row: dict[str, Any]) -> t
269283
py_type = type(value)
270284
sa_type = SQLA_DATA_TYPES[py_type]
271285
except KeyError:
272-
log.warning(f"{__tablename__}.{column_name} found no data type for '{py_type}', faling back to VARCHAR..")
286+
_LOG.warning(f"{__tablename__}.{column_name} found no data type for '{py_type}', faling back to VARCHAR..")
273287
sa_type = sa_types.Text
274288

275289
field_definitions[column_name] = Annotated[py_type, Field(None, sa_column=Column(type_=sa_type))]

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "cs_tools"
77
dynamic = ["version"]
88
description = "Scale your ThoughtSpot adoption with tools created by the ThoughtSpot Solutions Consulting organization."
99
readme = "README.md"
10-
requires-python = ">= 3.9"
10+
requires-python = ">= 3.9.2"
1111
license = {file = "LICENSE"}
1212
authors = [
1313
{name = "boonhapus", email="nicholas.cooper@thoughtspot.com"},
@@ -29,6 +29,7 @@ classifiers = [
2929
"Programming Language :: Python :: 3.10",
3030
"Programming Language :: Python :: 3.11",
3131
"Programming Language :: Python :: 3.12",
32+
"Programming Language :: Python :: 3.13",
3233
]
3334

3435
dependencies = [

uv.lock

Lines changed: 2 additions & 49 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)