Skip to content

Fix/isort python39 compatibility#142

Open
BrandtKruger wants to merge 8 commits intokinde-oss:mainfrom
BrandtKruger:fix/isort-python39-compatibility
Open

Fix/isort python39 compatibility#142
BrandtKruger wants to merge 8 commits intokinde-oss:mainfrom
BrandtKruger:fix/isort-python39-compatibility

Conversation

@BrandtKruger
Copy link
Contributor

@BrandtKruger BrandtKruger commented Nov 26, 2025

fix: make isort conditional to maintain Python 3.9 compatibility

  • Add conditional isort installation in [project.optional-dependencies]
    • Python 3.10+: isort >=7.0.0
    • Python 3.9: isort >=5.12.0, <7.0
  • Remove hardcoded isort from [tool.poetry.dev-dependencies]
  • Update requirements.txt with documentation comment
  • Maintains backwards compatibility with Python 3.9 while allowing
    Python 3.10+ users to use isort v7

Fixes Python 3.9 CI/CD compatibility issue with isort v7 upgrade.
This PR builds on top of PR #126 (isort v7 upgrade).

Checklist

🛟 If you need help, consider asking for advice over in the Kinde community.

renovate bot and others added 2 commits October 11, 2025 13:35
- Add conditional isort installation in [project.optional-dependencies]
  - Python 3.10+: isort >=7.0.0
  - Python 3.9: isort >=5.12.0, <7.0
- Remove hardcoded isort from [tool.poetry.dev-dependencies]
- Update requirements.txt with documentation comment
- Maintains backwards compatibility with Python 3.9 while allowing
  Python 3.10+ users to use isort v7

Fixes Python 3.9 CI/CD compatibility issue with isort v7 upgrade.
This PR builds on top of PR kinde-oss#126 (isort v7 upgrade) and adds
Python 3.9 compatibility.
@BrandtKruger BrandtKruger requested a review from a team as a code owner November 26, 2025 17:23
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 26, 2025

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Replaced the single isort>=5.12.0 entry in requirements.txt with Python-version-conditional specs and added explanatory comments. Added runtime guards to two test files to skip tests when FastAPI, Flask, or flask_session are not installed (tests now import and call pytest.importorskip). (Lines changed: +8 / -1)

Changes

Cohort / File(s) Summary
Requirements & comments
requirements.txt
Removed the single isort>=5.12.0 line; added conditional specs isort>=7.0.0; python_version >= "3.10" and isort>=5.12.0,<7.0; python_version < "3.10". Inserted three comment lines documenting conditional versioning and a dev-install hint.
FastAPI test guard
testv2/testv2_framework/test_fastapi_framework.py
Added runtime guard: imports pytest and calls pytest.importorskip("fastapi", reason="fastapi not installed") to skip tests when FastAPI is missing.
Flask test guard
testv2/testv2_framework/test_flask_framework.py
Added runtime guards: imports pytest and calls pytest.importorskip for Flask and flask_session to skip tests when those packages are missing.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title directly addresses the main change: making isort conditional for Python 3.9 compatibility, which aligns with the core objective of the changeset.
Description check ✅ Passed The description comprehensively explains the changes to isort versioning, conditional dependencies, and the Python 3.9 compatibility fix that the changeset implements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Nov 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link

@dtoxvanilla1991 dtoxvanilla1991 left a comment

Choose a reason for hiding this comment

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

Line 34 currently pins isort>=5.12.0 unconditionally in requirements.txt, so any workflow that still relies on pip install -r requirements.txt (many CI jobs do) will keep pulling the 5.x series even on Python 3.10+. That contradicts the PR’s stated goal of allowing 3.10+ to use isort 7.

If you really expect everyone—including automation—to switch to pip install -e ".[dev]", then yes, that isort line should be removed so there isn’t a conflicting requirement. But before dropping it, confirm that no CI/CD paths still consume requirements.txt; otherwise you’ll lose isort entirely there. A safer alternative is to keep entries in requirements.txt but mirror the conditional markers already used in pyproject.toml,

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@requirements.txt`:
- Around line 31-35: The pyproject.toml dev-dependencies currently pins isort =
"^7.0.0" under [tool.poetry.dev-dependencies], which conflicts with the
conditional isort constraints in requirements.txt and
[project.optional-dependencies]. Update pyproject.toml to either remove the
unconditional isort entry or replace it with a Python-version-conditional entry
that mirrors requirements.txt (e.g., provide an isort fallback for
python_version < "3.10"), and add an explanatory comment similar to the existing
pylint pattern so Poetry users on 3.9 resolve the compatible isort version
instead of 7.x.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e018d300-8655-4ace-afe4-7e52439b1487

📥 Commits

Reviewing files that changed from the base of the PR and between 15bd80e and 359fbf3.

⛔ Files ignored due to path filters (1)
  • pyproject.toml is excluded by !**/*.toml
📒 Files selected for processing (1)
  • requirements.txt

@KomanRudden KomanRudden requested a review from a team as a code owner March 12, 2026 04:26
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
testv2/testv2_framework/test_flask_framework.py (1)

7-7: Prefer standard import pytest over __import__("pytest").

The __import__() function is typically used for dynamic imports where the module name isn't known at write time. Here, a standard import pytest statement is clearer and more idiomatic.

♻️ Suggested simplification
-pytest = __import__("pytest")
+import pytest
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@testv2/testv2_framework/test_flask_framework.py` at line 7, Replace the
dynamic import expression that assigns pytest via __import__("pytest") with a
standard top-level import statement; locate the usage of the pytest symbol in
test_flask_framework.py and change the line "pytest = __import__(\"pytest\")" to
the idiomatic "import pytest" so the module is imported normally and the pytest
name is available throughout the file.
testv2/testv2_framework/test_fastapi_framework.py (1)

4-4: Prefer standard import pytest over __import__("pytest").

Same as in the Flask test file—a standard import pytest is clearer and more idiomatic than using __import__().

♻️ Suggested simplification
-pytest = __import__("pytest")
+import pytest
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@testv2/testv2_framework/test_fastapi_framework.py` at line 4, Replace the
dynamic import usage pytest = __import__("pytest") with the standard import
statement by changing the module import to a normal top-level import (use import
pytest) so tests use the idiomatic pytest symbol; update any references relying
on the current assignment if needed to use the imported pytest module.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@testv2/testv2_framework/test_fastapi_framework.py`:
- Line 4: Replace the dynamic import usage pytest = __import__("pytest") with
the standard import statement by changing the module import to a normal
top-level import (use import pytest) so tests use the idiomatic pytest symbol;
update any references relying on the current assignment if needed to use the
imported pytest module.

In `@testv2/testv2_framework/test_flask_framework.py`:
- Line 7: Replace the dynamic import expression that assigns pytest via
__import__("pytest") with a standard top-level import statement; locate the
usage of the pytest symbol in test_flask_framework.py and change the line
"pytest = __import__(\"pytest\")" to the idiomatic "import pytest" so the module
is imported normally and the pytest name is available throughout the file.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 80e80aff-70d7-4e9b-9c4e-3b36e10093bc

📥 Commits

Reviewing files that changed from the base of the PR and between 359fbf3 and 4b7b374.

⛔ Files ignored due to path filters (1)
  • pyproject.toml is excluded by !**/*.toml
📒 Files selected for processing (2)
  • testv2/testv2_framework/test_fastapi_framework.py
  • testv2/testv2_framework/test_flask_framework.py

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.

3 participants