Add `requires-python = ">=3.10"` to pyproject.toml (#4131)
Summary: We only support python 3.10/3.11/3.12 right now, so make that explicit. The last time I tried to do this, the linter tried to force us to use new-in-3.10 syntax. I was able to avoid that this time by telling the `black` formatter to use a larger range of python versions. Also modify setup.py to be 3.8 and 3.13 compatible so that it can run and complain about the version mismatch instead of just failing to run. Then, to save users some time, check the version in install_requirements.sh before doing any real work. And `cd` to the script's directory before starting so that users can invoke it like `/path/to/executorch/install_requirements.sh`. Pull Request resolved: https://github.com/pytorch/executorch/pull/4131 Test Plan: Built wheels in CI by adding the `ciflow/binaries/all` label. Linted all python files: ``` find . -type f -name "*.py" | grep -vE 'third-party|cmake-out|pip-out' > /tmp/f lintrunner --paths-cmd='cat /tmp/f' ``` Also created a conda environment with python 3.8 and ran `install_requirements.sh` (without the fail-fast check). It used to fail on syntax errors, but now it fails because the version can't be satisfied. To test the fail-fast logic, ran install_requirements.sh in 3.8 and 3.10 conda environments, and saw that it failed/passed as expected. To test the failure cases, made some local modifications and saw that it continued to build the wheel after printing a warning: - Remove/rename pyproject.toml - Remove the `requires-python` line from pyproject.toml - Modify the `requires-python` line to contain an invalid range - Import a missing module in the `python_is_compatible()` code To test the new `cd` logic: ``` cd build ../install_requirements.sh # This worked ``` Reviewed By: mergennachin Differential Revision: D59291599 Pulled By: dbort fbshipit-source-id: 5bfc97346180b65ad8719753c4126af025a41ae0
D
Dave Bort committed
f32d707fd89ce64ffbaff6d9c216ac7d15c829e6
Parent: 38d67db
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
on 7/3/2024, 11:07:57 PM