1183 respect requires python bounds in get supported major python versions for none backend#1273
Merged
nathanjmcdougall merged 10 commits intomainfrom Jan 6, 2026
Conversation
…upported_major_python_versions-for-none-backend
…jor_python_versions-for-none-backend' of https://github.com/nathanjmcdougall/usethis-python into 1183-respect-requires-python-bounds-in-get_supported_major_python_versions-for-none-backend
…upported_major_python_versions-for-none-backend
Contributor
There was a problem hiding this comment.
Pull request overview
This PR implements proper respect for requires-python bounds when getting supported Python versions for projects without a build backend (the none backend case). The change addresses issue #1183 by:
- Parsing
requires-pythonfrompyproject.tomlto determine valid Python version ranges - Warning users when their current interpreter is outside the specified bounds
- Falling back to the current interpreter version only when
requires-pythonis unavailable
Key Changes
- Added new function
get_required_minor_python_versions()to parse and enumerate Python versions matchingrequires-pythonconstraints - Updated
get_supported_minor_python_versions()to userequires-pythonbounds for thenonebackend instead of always using the current interpreter - Removed the
pytest.mark.skipdecorator from a test that was waiting for this fix
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/usethis/_tool/impl/test_pytest.py | Unskipped test and updated expected output to include the warning message |
| tests/usethis/_integrations/file/pyproject_toml/test_requires_python.py | Added comprehensive test suite for the new get_required_minor_python_versions() function |
| tests/usethis/_integrations/environ/test_python.py | New test file covering the updated behavior of get_supported_minor_python_versions() for the none backend |
| src/usethis/_tool/impl/pre_commit.py | Added type import and optional versions parameter to get_bitbucket_steps() |
| src/usethis/_tool/base.py | Refactored to avoid redundant calls to get_bitbucket_steps() and added clarifying comment |
| src/usethis/_integrations/file/pyproject_toml/requires_python.py | Implemented core logic for parsing requires-python and enumerating matching Python versions |
| src/usethis/_integrations/environ/python.py | Updated to use requires-python bounds for the none backend with appropriate warnings |
| pyproject.toml | Adjusted import linting layer configuration to resolve dependency ordering |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
CodSpeed Performance ReportMerging #1273 will not alter performanceComparing Summary
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.