Skip to content

Add requires-python = ">=3.10" to pyproject.toml #4131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

dbort
Copy link
Contributor

@dbort dbort commented Jul 2, 2024

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.

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

Copy link

pytorch-bot bot commented Jul 2, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/4131

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

✅ You can merge normally! (2 Unrelated Failures)

As of commit c910ea0 with merge base 998fc08 (image):

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

UNSTABLE - The following job failed but was likely due to flakiness present on trunk and has been marked as unstable:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 2, 2024
@facebook-github-bot
Copy link
Contributor

@dbort has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@dbort dbort added the ciflow/binaries/all Release PRs with this label will build wheels for all python versions label Jul 2, 2024
@dbort dbort force-pushed the python-version branch from 916bad2 to a82ce43 Compare July 2, 2024 22:01
@dbort dbort changed the title Add requires-python = ">=3.10,<3.12" to pyproject.toml Add requires-python = ">=3.10,<3.13" to pyproject.toml Jul 2, 2024
@facebook-github-bot
Copy link
Contributor

@dbort has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@dbort dbort force-pushed the python-version branch from a82ce43 to f196673 Compare July 3, 2024 16:39
@dbort dbort changed the title Add requires-python = ">=3.10,<3.13" to pyproject.toml Add requires-python = ">=3.10" to pyproject.toml Jul 3, 2024
@dbort dbort force-pushed the python-version branch from f196673 to f49ebbe Compare July 3, 2024 16:40
@facebook-github-bot
Copy link
Contributor

@dbort has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

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`.

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
```
@dbort dbort force-pushed the python-version branch from f49ebbe to c910ea0 Compare July 3, 2024 21:42
@facebook-github-bot
Copy link
Contributor

@dbort has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@dbort
Copy link
Contributor Author

dbort commented Jul 3, 2024

Fixes #3570

@facebook-github-bot
Copy link
Contributor

@dbort merged this pull request in f32d707.

kirklandsign pushed a commit to kirklandsign/executorch that referenced this pull request Jul 5, 2024
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: pytorch#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/binaries/all Release PRs with this label will build wheels for all python versions CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants