File tree Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,20 @@ sure we support everything we claim to.
77This ` populate_tox.py ` script is responsible for picking reasonable versions to
88test automatically and generating parts of ` tox.ini ` to capture this.
99
10+ ## Running the script
11+
12+ You require a free-threaded interpreter with pip installed to run the script. With
13+ a recent version of ` uv ` you can directly run the script with the following
14+ command:
15+
16+ ```
17+ uv run --python 3.14t \
18+ --with pip \
19+ --with-requirements scripts/populate_tox/requirements.txt \
20+ --with-editable . \
21+ python scripts/populate_tox/populate_tox.py
22+ ```
23+
1024## How it works
1125
1226There is a template in this directory called ` tox.jinja ` which contains a
Original file line number Diff line number Diff line change @@ -891,7 +891,31 @@ def _normalize_package_dependencies(package_dependencies: list[dict]) -> list[di
891891
892892def _exit_if_not_free_threaded_interpreter ():
893893 if "free-threading build" not in sys .version :
894- raise Exception ("Running with a free-threaded interpreter is required." )
894+ exc = Exception ("Running with a free-threaded interpreter is required." )
895+ exc .add_note (
896+ "A dry run of pip is used to determine free-threading support of packages."
897+ )
898+ raise exc
899+
900+
901+ def _exit_if_pip_unavailable ():
902+ pip_help_return_code = subprocess .run (
903+ [
904+ sys .executable ,
905+ "-m" ,
906+ "pip" ,
907+ "--help" ,
908+ ],
909+ stdout = subprocess .DEVNULL ,
910+ stderr = subprocess .DEVNULL ,
911+ ).returncode
912+
913+ if pip_help_return_code != 0 :
914+ exc = Exception ("pip must be available." )
915+ exc .add_note (
916+ "A dry run of pip is used to determine free-threading support of packages."
917+ )
918+ raise exc
895919
896920
897921def main () -> dict [str , list ]:
@@ -901,6 +925,7 @@ def main() -> dict[str, list]:
901925 global MIN_PYTHON_VERSION , MAX_PYTHON_VERSION
902926
903927 _exit_if_not_free_threaded_interpreter ()
928+ _exit_if_pip_unavailable ()
904929
905930 meta = _fetch_sdk_metadata ()
906931 sdk_python_versions = _parse_python_versions_from_classifiers (
You can’t perform that action at this time.
0 commit comments