Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions scripts/populate_tox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@ sure we support everything we claim to.
This `populate_tox.py` script is responsible for picking reasonable versions to
test automatically and generating parts of `tox.ini` to capture this.

## Running the script

You require a free-threaded interpreter with pip installed to run the script. With
a recent version of `uv` you can directly run the script with the following
command:

```
uv run --python 3.14t \
--with pip \
--with-requirements scripts/populate_tox/requirements.txt \
--with-editable . \
python scripts/populate_tox/populate_tox.py
```

## How it works

There is a template in this directory called `tox.jinja` which contains a
Expand Down
27 changes: 26 additions & 1 deletion scripts/populate_tox/populate_tox.py
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,31 @@ def _normalize_package_dependencies(package_dependencies: list[dict]) -> list[di

def _exit_if_not_free_threaded_interpreter():
if "free-threading build" not in sys.version:
raise Exception("Running with a free-threaded interpreter is required.")
exc = Exception("Running with a free-threaded interpreter is required.")
exc.add_note(
"A dry run of pip is used to determine free-threading support of packages."
)
raise exc


def _exit_if_pip_unavailable():
pip_help_return_code = subprocess.run(
[
sys.executable,
"-m",
"pip",
"--help",
],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
).returncode

if pip_help_return_code != 0:
exc = Exception("pip must be available.")
exc.add_note(
"A dry run of pip is used to determine free-threading support of packages."
)
raise exc


def main() -> dict[str, list]:
Expand All @@ -900,6 +924,7 @@ def main() -> dict[str, list]:
global MIN_PYTHON_VERSION, MAX_PYTHON_VERSION

_exit_if_not_free_threaded_interpreter()
_exit_if_pip_unavailable()

meta = _fetch_sdk_metadata()
sdk_python_versions = _parse_python_versions_from_classifiers(
Expand Down
Loading