Skip to content

Updates supported versions of Python and Django #37

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

Merged
merged 7 commits into from
May 15, 2025
Merged

Conversation

hugobessa
Copy link
Contributor

@hugobessa hugobessa commented May 14, 2025

  • Include py.typed file for type hints
  • Add support to Python 3.12 and 3.13
  • Drop support to Python 3.8 and 3.9
  • Add support to Django 4.2, 5.0, 5.1, and 5.2
  • Drop support to Django 3.2, 4.0, and 4.1

Summary by Sourcery

Update the package to support newer Python (3.12, 3.13) and Django (5.x) releases while dropping older versions, enhance typing support, and refresh CI and project metadata.

Enhancements:

  • Add support for Python 3.12 and 3.13, and drop support for Python 3.8 and 3.9
  • Add support for Django 5.0–5.2, and drop support for Django 3.2, 4.0, and 4.1
  • Include a py.typed marker file for PEP 561 type hinting
  • Add a fallback implementation of get_python_lib for Python versions lacking distutils.sysconfig

CI:

  • Update tox and GitHub Actions matrices to reflect the new Python and Django version support

Documentation:

  • Document the changes in CHANGELOG.md
  • Bump package version to 0.3.0

Copy link

sourcery-ai bot commented May 14, 2025

Reviewer's Guide

This PR updates the project’s supported Python versions (dropping 3.8/3.9 and adding 3.12/3.13) and Django versions (dropping 3.2/4.0/4.1 and adding 5.0/5.1/5.2) across configuration files, adds a fallback for distutils on newer Python releases to maintain compatibility, includes a 'py.typed' marker for PEP 561 compliance, and bumps the package version to 0.3.0 with corresponding CHANGELOG entry.

File-Level Changes

Change Details Files
Revise supported Python and Django versions in project configurations
  • Updated Python classifiers and dependency ranges in pyproject.toml
  • Adjusted example requirements to Django >=4.2,<6.0
  • Modified tox envlist to include py310–py313 and django42–django52
  • Updated GitHub Actions python and DJANGO matrices
  • Refreshed testenv dependencies for new Django versions
pyproject.toml
Add import fallback for get_python_lib to support newer Python releases
  • Wrapped distutils.sysconfig.get_python_lib import in try/except
  • Introduced fallback using sysconfig.get_paths()['purelib']
django_virtual_models/query_capture/capture.py
Include PEP 561 marker file for type hinting support
  • Added py.typed marker file at the package root
py.typed
Bump package version and document changes
  • Incremented version to 0.3.0
  • Added 0.3.0 entry in CHANGELOG.md
django_virtual_models/__init__.py
CHANGELOG.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@hugobessa hugobessa requested a review from fjsj May 14, 2025 01:03
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @hugobessa - I've reviewed your changes - here's some feedback:

  • Make sure you include the py.typed file in your packaged distribution (e.g. via package_data or include in pyproject.toml) so type checkers actually pick up your type hints.
  • Since distutils is deprecated in Python 3.12+, consider standardizing on sysconfig.get_paths()["purelib"] (and removing the distutils fallback) to simplify and future-proof your get_python_lib() implementation.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@hugobessa hugobessa force-pushed the export-type-hints branch from b148796 to 43e3665 Compare May 14, 2025 01:23
@hugobessa hugobessa requested a review from Copilot May 14, 2025 01:24
Copy link

@Copilot 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 updates the package to support newer Python (3.12 and 3.13) and Django (5.0–5.2) versions, drops support for older releases, and improves type hinting and CI configurations.

  • Updated pyproject.toml to include the py.typed marker and modify version classifiers and dependency ranges
  • Modified the fallback implementation for get_python_lib in capture.py to support newer Python versions
  • Updated CI workflows and documentation to reflect the new supported versions

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pyproject.toml Updates in classifiers, dependencies, and tox/GitHub Actions matrices for new Python and Django versions, plus adding the py.typed marker
django_virtual_models/query_capture/capture.py Added a fallback for get_python_lib to accommodate recent Python releases, including handling for both string and list returns
django_virtual_models/init.py Bumped package version from 0.2.0 to 0.3.0
CHANGELOG.md Documented version changes and dependency updates
.github/workflows/tests.yml Updated Python and Django versions, as well as actions versions; note an obsolete coverage conditional
.github/workflows/pre-commit.yml Upgraded actions for checkout, Python setup, and pre-commit execution
Comments suppressed due to low confidence (1)

.github/workflows/tests.yml:45

  • The conditional for generating coverage.xml still references Python 3.8 and Django 3.2, which are no longer part of the test matrix. Update or remove this condition so that the step runs with one of the supported versions.
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8' && matrix.django-version == '3.2' }}

@hugobessa hugobessa requested a review from Copilot May 14, 2025 01:27
Copy link

@Copilot 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 updates the project to support newer Python (3.12, 3.13) and Django (5.0–5.2) releases while deprecating older versions, and it also enhances type hinting support and updates CI configurations.

  • Updated version classifiers, dependencies, and CI matrices in pyproject.toml
  • Added a fallback for get_python_lib in query_capture to support Python versions lacking distutils.sysconfig
  • Upgraded version metadata, CHANGELOG entries, and GitHub Actions workflows

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pyproject.toml Added py-typed marker and updated Python/Django classifiers and dependencies
django_virtual_models/query_capture/capture.py Added fallback implementation for get_python_lib with improved path handling
django_virtual_models/init.py Updated package version
CHANGELOG.md Documented changes for version 0.3.0
.github/workflows/tests.yml Updated matrix and actions versions to reflect new Python and Django support
.github/workflows/pre-commit.yml Upgraded Actions for checkout, setup-python, and pre-commit
Comments suppressed due to low confidence (2)

.github/workflows/tests.yml:40

  • The example test condition only covers Python 3.10 and Django 4.2. To fully validate the newly supported Django 5.x versions, consider adding or updating a test run configuration that explicitly tests these versions.
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' && matrix.django-version == '4.2' }}

pyproject.toml:61

  • The example dependency still allows Django 4.2 even though the PR metadata indicates support for Django 5.0–5.2 and dropping Django 3.2, 4.0, and 4.1. Please confirm if including Django 4.2 here is intentional or if it should be revised.
"django >= 4.2,<6.0",

@hugobessa hugobessa requested a review from Copilot May 14, 2025 01:39
Copy link

@Copilot 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 updates the supported versions for Python and Django, adds a py.typed marker for enhanced type hinting, updates CI configurations, and bumps the package version. Key changes include updating version matrices in tox and GitHub Actions, migrating from index_together to indexes in models, and adding a fallback for get_python_lib.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pyproject.toml Updated classifiers, example dependency version, and tox/CI matrices to reflect new Python and Django support; added py.typed marker.
example/movies/models.py Replaced deprecated index_together with the indexes attribute for model indexing.
example/movies/migrations/0002_rename_persondirector_movie_order_movies_pers_movie_i_957f84_idx.py Introduced a migration to rename the index corresponding to the model index change.
django_virtual_models/query_capture/capture.py Added a fallback for get_python_lib to support newer Python versions lacking distutils.sysconfig.
django_virtual_models/init.py Bumped package version to 0.3.0.
CHANGELOG.md Documented the changes for the new release version.
.github/workflows/tests.yml
.github/workflows/pre-commit.yml
Updated CI workflows to use the latest actions and test the newly supported versions.
Comments suppressed due to low confidence (1)

pyproject.toml:30

  • The project dependencies still allow Django >=3.2 despite the PR description stating that support for Django 3.2 should be dropped. Update the dependency constraint to match the new supported Django versions.
"django >=3.2",

@hugobessa hugobessa requested a review from Copilot May 14, 2025 01:47
Copy link

@Copilot 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 updates the project configuration and CI pipelines to support newer Python (3.12, 3.13) and Django (5.x) releases while dropping older versions, and it enhances type hinting support. Key changes include updating pyproject.toml with the new supported versions and py.typed flag, modifying the index definition in models, and refreshing CI workflows and migrations accordingly.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pyproject.toml Updated supported Python and Django versions and added py.typed
example/movies/models.py Replaced deprecated index_together with indexes in model Meta
example/movies/migrations/0002_rename_persondirector_...py Migration to rename an index using Django 5.2 conventions
django_virtual_models/query_capture/capture.py Added fallback for get_python_lib to support Python versions lacking it
django_virtual_models/init.py Bumped version to 0.3.0
CHANGELOG.md Documented changes and version bump
.github/workflows/tests.yml Updated CI matrix and actions versions
.github/workflows/pre-commit.yml Upgraded pre-commit workflow actions

@hugobessa
Copy link
Contributor Author

@fjsj the coverage decreased a little bit because I had to implement backward compatibility functions. I don't think that's worth covering. Could you please ignore that?

@hugobessa hugobessa merged commit ddb2108 into main May 15, 2025
34 of 36 checks passed
@hugobessa hugobessa deleted the export-type-hints branch May 15, 2025 13:24
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.

2 participants