-
Notifications
You must be signed in to change notification settings - Fork 7
Remove support for Python 3.9 #635
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
Conversation
WalkthroughThis pull request removes Python 3.9 support and modernizes the codebase to leverage Python 3.10+ features. Changes include updating Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying infrahub-sdk-python with
|
| Latest commit: |
46092e3
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://4d549245.infrahub-sdk-python.pages.dev |
| Branch Preview URL: | https://pog-remove-python-3-9.infrahub-sdk-python.pages.dev |
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## infrahub-develop #635 +/- ##
====================================================
- Coverage 75.56% 75.56% -0.01%
====================================================
Files 113 113
Lines 9512 9514 +2
Branches 1448 1448
====================================================
+ Hits 7188 7189 +1
- Misses 1837 1838 +1
Partials 487 487
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (17)
changelog/+f97cdf92.removed.md(1 hunks)infrahub_sdk/async_typer.py(1 hunks)infrahub_sdk/batch.py(1 hunks)infrahub_sdk/client.py(1 hunks)infrahub_sdk/ctl/cli_commands.py(1 hunks)infrahub_sdk/ctl/utils.py(1 hunks)infrahub_sdk/node/attribute.py(1 hunks)infrahub_sdk/node/constants.py(1 hunks)infrahub_sdk/schema/__init__.py(3 hunks)infrahub_sdk/schema/main.py(1 hunks)infrahub_sdk/schema/repository.py(2 hunks)infrahub_sdk/spec/range_expansion.py(1 hunks)infrahub_sdk/template/__init__.py(1 hunks)infrahub_sdk/transfer/importer/json.py(1 hunks)infrahub_sdk/types.py(2 hunks)pyproject.toml(1 hunks)tests/unit/sdk/test_batch.py(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
infrahub_sdk/schema/repository.py (1)
infrahub_sdk/node/node.py (2)
InfrahubNode(458-1086)InfrahubNodeSync(1089-1712)
infrahub_sdk/schema/main.py (1)
infrahub_sdk/node/node.py (2)
InfrahubNode(458-1086)InfrahubNodeSync(1089-1712)
infrahub_sdk/schema/__init__.py (2)
infrahub_sdk/node/node.py (2)
InfrahubNode(458-1086)InfrahubNodeSync(1089-1712)infrahub_sdk/schema/main.py (6)
NodeSchema(307-309)GenericSchema(283-285)NodeSchemaAPI(312-314)GenericSchemaAPI(288-292)ProfileSchemaAPI(317-318)TemplateSchemaAPI(321-322)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Cloudflare Pages
🔇 Additional comments (16)
changelog/+f97cdf92.removed.md (1)
1-1: LGTM! Clear documentation of Python 3.9 removal.The changelog entry accurately documents the removal of Python 3.9 support.
tests/unit/sdk/test_batch.py (1)
70-70: LGTM! Proper use ofanext()for Python 3.10+.The migration from
result_iter.__anext__()toawait anext(result_iter)is the idiomatic way to iterate async iterators in Python 3.10+.Also applies to: 75-75
infrahub_sdk/template/__init__.py (1)
4-6: LGTM! Proper import modernization for Python 3.10+.Moving
Callablefromtypingtocollections.abcaligns with Python 3.10+ best practices. The type annotations remain functionally identical.infrahub_sdk/batch.py (1)
4-7: LGTM! Comprehensive import modernization for Python 3.10+.Moving
Callable,AsyncGenerator,Awaitable, andGeneratorfromtypingtocollections.abcis the correct approach for Python 3.10+. All type annotations remain functionally identical.infrahub_sdk/node/attribute.py (1)
4-5: LGTM! Proper import modernization for Python 3.10+.Moving
Callablefromtypingtocollections.abcaligns with Python 3.10+ best practices. The type annotations remain functionally identical.infrahub_sdk/spec/range_expansion.py (1)
70-72: LGTM! Explicitstrict=Falseimproves clarity.Adding
strict=Falseto thezip()call makes the behavior explicit. While this is the default in Python 3.10+, explicitly stating it improves code clarity.infrahub_sdk/client.py (1)
8-19: LGTM! Comprehensive import modernization for Python 3.10+.Moving
Callable,Coroutine,Mapping, andMutableMappingfromtypingtocollections.abcis the correct approach for Python 3.10+. All type annotations remain functionally identical.infrahub_sdk/async_typer.py (1)
5-7: LGTM! Proper import modernization for Python 3.10+.Moving
Callablefromtypingtocollections.abcaligns with Python 3.10+ best practices. The type annotations remain functionally identical.pyproject.toml (1)
10-10: LGTM! Python version requirement updated correctly.The change to require Python 3.10+ aligns with the PR objective to drop Python 3.9 support and enables the use of modern typing syntax throughout the codebase.
infrahub_sdk/types.py (1)
5-5: LGTM! Type alias modernized to Python 3.10+ syntax.The migration from
Union[InfrahubLogger, Logger]toInfrahubLogger | Loggerusing PEP 604 union syntax is correct and consistent with the Python 3.10+ requirement.Also applies to: 68-68
infrahub_sdk/node/constants.py (1)
8-8: LGTM! Type alias updated to modern union syntax.The change from
Union[...]to the|operator forIP_TYPESis consistent with Python 3.10+ requirements and maintains the same type semantics.infrahub_sdk/ctl/utils.py (1)
6-6: LGTM! Callable import moved to recommended location.Migrating
Callablefromtypingtocollections.abcaligns with Python 3.9+ best practices, wheretyping.Callableis deprecated in favor ofcollections.abc.Callable.Also applies to: 9-9
infrahub_sdk/schema/repository.py (1)
4-4: LGTM! Type alias modernized within TYPE_CHECKING block.The update to use PEP 604 union syntax (
InfrahubNode | InfrahubNodeSync) instead ofUnionis correct and consistent with the Python 3.10+ migration.Also applies to: 21-21
infrahub_sdk/ctl/cli_commands.py (1)
9-9: LGTM! Callable import standardized.The migration of
Callablefromtypingtocollections.abcfollows Python best practices and is consistent with similar changes throughout the codebase.Also applies to: 11-11
infrahub_sdk/schema/__init__.py (1)
10-10: LGTM! Type aliases modernized with explicit TypeAlias annotation.The introduction of explicit
TypeAliasannotations combined with PEP 604 union syntax makes the type aliases clearer and follows Python 3.10+ best practices. The changes are consistent across all type alias definitions in the file.Also applies to: 48-48, 86-90
infrahub_sdk/schema/main.py (1)
6-6: LGTM! Type annotation updated to modern union syntax.The migration from
Union[InfrahubNode, InfrahubNodeSync]toInfrahubNode | InfrahubNodeSyncwithin the TYPE_CHECKING block is consistent with the Python 3.10+ modernization across the codebase.Also applies to: 14-14
| with self.wrapped_task_output("Analyzing import"): | ||
| import_nodes_by_kind = defaultdict(list) | ||
| for graphql_data, kind in zip(table.column("graphql_json"), table.column("kind")): | ||
| for graphql_data, kind in zip(table.column("graphql_json"), table.column("kind"), strict=False): |
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.
Consider using strict=True for data integrity.
Since both columns come from the same table, they should always have identical lengths. Using strict=False would silently skip rows if the columns have mismatched lengths due to data corruption or a bug, potentially causing incomplete imports.
Apply this diff to fail fast on data integrity issues:
- for graphql_data, kind in zip(table.column("graphql_json"), table.column("kind"), strict=False):
+ for graphql_data, kind in zip(table.column("graphql_json"), table.column("kind"), strict=True):📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| for graphql_data, kind in zip(table.column("graphql_json"), table.column("kind"), strict=False): | |
| for graphql_data, kind in zip(table.column("graphql_json"), table.column("kind"), strict=True): |
🤖 Prompt for AI Agents
In infrahub_sdk/transfer/importer/json.py around line 65, the zip over
table.column("graphql_json") and table.column("kind") uses strict=False which
can silently drop mismatched rows; change it to strict=True to raise an error on
length mismatches so the importer fails fast on data integrity issues, and
handle or propagate the resulting exception where appropriate (e.g., let it
bubble up or catch and log a clear error message).
Removes support for Python 3.9, and backported package specifically for 3.9. Due to this there were a number of linting changes that needed to be done as the new target version became 3.10.
Summary by CodeRabbit
Breaking Changes
Chores