Skip to content
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

feat: Official support for Python 3.13 and drop support for Python 3.8 #643

Merged
merged 1 commit into from
Oct 17, 2024

Conversation

bellini666
Copy link
Member

@bellini666 bellini666 commented Oct 17, 2024

Summary by Sourcery

Add official support for Python 3.13 and remove support for Python 3.8. Refactor type annotations to use the new list and type syntax introduced in Python 3.9. Update CI configuration to reflect these changes.

New Features:

  • Add official support for Python 3.13.

Enhancements:

  • Refactor type annotations to use the new list and type syntax introduced in Python 3.9.

CI:

  • Update CI configuration to include testing for Python 3.13 and remove testing for Python 3.8.

@bellini666 bellini666 self-assigned this Oct 17, 2024
Copy link
Contributor

sourcery-ai bot commented Oct 17, 2024

Reviewer's Guide by Sourcery

This pull request updates the codebase to officially support Python 3.13 and drops support for Python 3.8. The main changes involve updating type annotations, particularly replacing List with list, Dict with dict, and Type with type. These changes align with Python's type hinting syntax improvements in more recent versions.

Updated class diagram for type annotations

classDiagram
    class OneToManyInput {
        +Optional~list[strawberry.ID]~ add
        +Optional~list[strawberry.ID]~ remove
        +Optional~list[strawberry.ID]~ set
    }

    class ManyToOneInput {
        +Optional~list[strawberry.ID]~ add
        +Optional~list[strawberry.ID]~ remove
        +Optional~list[strawberry.ID]~ set
    }

    class ManyToManyInput {
        +Optional~list[strawberry.ID]~ add
        +Optional~list[strawberry.ID]~ remove
        +Optional~list[strawberry.ID]~ set
    }

    class ListInput {
        +Optional~list[K]~ set
        +Optional~list[K]~ add
        +Optional~list[K]~ remove
    }

    class OperationInfo {
        +list[OperationMessage] messages
    }

    class field_type_map {
        +dict[Union[type[fields.Field], type[related.RelatedField], type[reverse_related.ForeignObjectRel]], type] field_type_map
    }

    class input_field_type_map {
        +dict[Union[type[fields.Field], type[related.RelatedField], type[reverse_related.ForeignObjectRel]], type] input_field_type_map
    }

    class relay_field_type_map {
        +dict[Union[type[fields.Field], type[related.RelatedField], type[reverse_related.ForeignObjectRel]], type] relay_field_type_map
    }

    class relay_input_field_type_map {
        +dict[Union[type[fields.Field], type[related.RelatedField], type[reverse_related.ForeignObjectRel]], type] relay_input_field_type_map
    }

    class DjangoPermissionExtension {
        +list[Location] SCHEMA_DIRECTIVE_LOCATIONS
    }

    class HasPerm {
        +Union[list[str], str] perms
        +tuple[PermDefinition, ...] perms
    }

    class AutoDirective {
        +list[PermDefinition] permissions
    }

    class DjangoRegisterMutation {
        +type["AbstractBaseUser"] model
    }

    class DictTree {
        +dict[str, "DictTree"] DictTree
    }

    class _BaseFactory {
        +list[_T] create_batch
    }

    class Query {
        +list[Fruit] fruits
        +list[Color] colors
    }

    class Mutation {
        +list[Fruit] create_fruits
        +list[Fruit] update_fruits
        +list[Fruit] delete_fruits
        +list[Color] create_colors
        +list[Color] update_colors
        +list[Color] delete_colors
    }
Loading

File-Level Changes

Change Details Files
Update type annotations from List to list
  • Replace List[T] with list[T] throughout the codebase
  • Update function signatures and variable annotations
  • Modify import statements to remove List import from typing module
strawberry_django/fields/types.py
strawberry_django/relay.py
strawberry_django/type.py
strawberry_django/mutations/mutations.py
tests/filters/test_filters.py
tests/projects/schema.py
tests/utils.py
tests/filters/test_filters_v2.py
tests/conftest.py
tests/test_optimizer.py
tests/test_queries.py
tests/test_pagination.py
tests/queries/test_fields.py
tests/queries/test_m2m_through.py
tests/relay/schema.py
tests/fields/test_relations.py
examples/django/app/types.py
Update type annotations from Dict to dict
  • Replace Dict[K, V] with dict[K, V] throughout the codebase
  • Update function signatures and variable annotations
  • Modify import statements to remove Dict import from typing module
strawberry_django/test/client.py
tests/utils.py
strawberry_django/utils/pyutils.py
tests/fields/test_types.py
Update type annotations from Type to type
  • Replace Type[T] with type[T] throughout the codebase
  • Update function signatures and variable annotations
  • Modify import statements to remove Type import from typing module
strawberry_django/relay.py
strawberry_django/type.py
tests/projects/schema.py
strawberry_django/optimizer.py
tests/conftest.py
strawberry_django/utils/query.py
tests/projects/faker.py
strawberry_django/auth/mutations.py
Update CI configuration to support Python 3.13 and drop 3.8
  • Add Python 3.13 to the test matrix
  • Remove Python 3.8 from the test matrix
  • Update exclusion rules for Django compatibility
.github/workflows/tests.yml
Update imports and type hints for collections
  • Import Sequence, Collection, and other types from collections.abc instead of typing
  • Update type hints to use these imported types
strawberry_django/ordering.py
strawberry_django/fields/filter_order.py
strawberry_django/integrations/guardian.py
strawberry_django/mutations/fields.py
strawberry_django/utils/inspect.py

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.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a 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. You can also use
    this command to specify where the summary should be inserted.

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

@codecov-commenter
Copy link

codecov-commenter commented Oct 17, 2024

Codecov Report

Attention: Patch coverage is 97.67442% with 2 lines in your changes missing coverage. Please review.

Project coverage is 88.71%. Comparing base (f18a7c8) to head (8def771).

Files with missing lines Patch % Lines
strawberry_django/mutations/resolvers.py 50.00% 1 Missing ⚠️
strawberry_django/test/client.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #643      +/-   ##
==========================================
- Coverage   88.93%   88.71%   -0.22%     
==========================================
  Files          41       41              
  Lines        3596     3606      +10     
==========================================
+ Hits         3198     3199       +1     
- Misses        398      407       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@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 @bellini666 - 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: 5 issues found
  • 🟢 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.

tests/filters/test_filters.py Show resolved Hide resolved
tests/filters/test_filters.py Show resolved Hide resolved
tests/filters/test_filters.py Show resolved Hide resolved
tests/projects/schema.py Show resolved Hide resolved
tests/projects/schema.py Show resolved Hide resolved
@bellini666 bellini666 merged commit f9afbda into main Oct 17, 2024
24 checks passed
@bellini666 bellini666 deleted the py313 branch October 17, 2024 14:25
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