-
Notifications
You must be signed in to change notification settings - Fork 256
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
simplify python_version
markers
#826
simplify python_version
markers
#826
Conversation
Examples of new simplifications: `python_version >= "3.8" and python_version < "3.9"` -> `python_version == "3.8"` `python_version == "3.8" or python_version >= "3.9"` -> `python_version >= "3.8"`
Reviewer's Guide by SourceryThis pull request simplifies the logic for handling State diagram for Python version marker transformationstateDiagram-v2
[*] --> Original
Original --> CheckPrecision: Check version precision
CheckPrecision --> AdjustPrecision: Precision < target
CheckPrecision --> CheckOperator: Precision == target
AdjustPrecision --> ConvertMarker: For < or >= operators
CheckOperator --> ConvertMarker: For < or >= operators
ConvertMarker --> SimplifyMarker: Convert python_full_version to python_version
SimplifyMarker --> [*]
Flow diagram for Python version marker simplificationgraph TD
A[Input Marker] --> B{Check Marker Type}
B -->|python_version| C{Check Pattern}
B -->|Other| D[Keep Original]
C -->|Range Pattern| E["'>=3.8 and <3.9'"]
C -->|Union Pattern| F["'==3.8 or >=3.9'"]
E --> G["Simplify to '==3.8'"]
F --> H["Simplify to '>=3.8'"]
G --> I[Output Marker]
H --> I
D --> I
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @radoering - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Examples of new simplifications:
python_version >= "3.8" and python_version < "3.9"
->python_version == "3.8"
python_version == "3.8" or python_version >= "3.9"
->python_version >= "3.8"
The downstream failures are caused by cosmetic changes. The tests are fixed in python-poetry/poetry#10110. We should probably merge this PR with failing downstream tests and switch from the released poetry-core version to the main branch afterwards.
Testing with the
pyproject.toml
from python-poetry/poetry#9956 (comment):Summary by Sourcery
Tests: