Skip to content

1183 respect requires python bounds in get supported major python versions for none backend#1273

Merged
nathanjmcdougall merged 10 commits intomainfrom
1183-respect-requires-python-bounds-in-get_supported_major_python_versions-for-none-backend
Jan 6, 2026
Merged

1183 respect requires python bounds in get supported major python versions for none backend#1273
nathanjmcdougall merged 10 commits intomainfrom
1183-respect-requires-python-bounds-in-get_supported_major_python_versions-for-none-backend

Conversation

@nathanjmcdougall
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-python from pyproject.toml to 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-python is unavailable

Key Changes

  • Added new function get_required_minor_python_versions() to parse and enumerate Python versions matching requires-python constraints
  • Updated get_supported_minor_python_versions() to use requires-python bounds for the none backend instead of always using the current interpreter
  • Removed the pytest.mark.skip decorator 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
Copy link
Copy Markdown

codecov bot commented Jan 6, 2026

Codecov Report

❌ Patch coverage is 94.93671% with 4 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/usethis/_integrations/environ/python.py 81.25% 3 Missing ⚠️
...ntegrations/file/pyproject_toml/requires_python.py 98.38% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Jan 6, 2026

CodSpeed Performance Report

Merging #1273 will not alter performance

Comparing 1183-respect-requires-python-bounds-in-get_supported_major_python_versions-for-none-backend (63ca147) with main (09e0bff)

Summary

✅ 2 untouched

@nathanjmcdougall nathanjmcdougall marked this pull request as ready for review January 6, 2026 09:00
@nathanjmcdougall nathanjmcdougall merged commit 8130abd into main Jan 6, 2026
19 checks passed
@nathanjmcdougall nathanjmcdougall deleted the 1183-respect-requires-python-bounds-in-get_supported_major_python_versions-for-none-backend branch January 6, 2026 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Respect requires-python bounds in get_supported_major_python_versions for none-backend

2 participants