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

Drop python 3.8 #111

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open

Drop python 3.8 #111

wants to merge 17 commits into from

Conversation

ChristianGeng
Copy link
Member

@ChristianGeng ChristianGeng commented Nov 19, 2024

Closes #110

This is what has been done to avoid having to use typing:

  • Using built-in type instead of typing.Type
  • Using | for unions
  • Using direct imports from collections.abc
  • Using object instead of Any
  • Using Mapping and Sequence from collections.abc

Summary by Sourcery

Drop support for Python 3.8 and update type annotations to use modern Python syntax.

Enhancements:

  • Replace usage of 'typing' module with built-in types and direct imports from 'collections.abc'.

CI:

  • Remove Python 3.8 from the CI testing matrix.

Chores:

  • Update 'pyproject.toml' to remove Python 3.8 support and set the minimum required Python version to 3.9.

Copy link

sourcery-ai bot commented Nov 19, 2024

Reviewer's Guide by Sourcery

This PR removes Python 3.8 support and updates type hints to use modern Python syntax. The changes primarily involve replacing typing module usage with built-in type annotations and direct imports from collections.abc.

Updated class diagram for audobject.core.resolver

classDiagram
    class Base {
        +str | None root
        +object decode(DefaultValueType value)
        +DefaultValueType encode(object value)
    }
    class DefaultValueType {
        +bool
        +datetime
        +dict
        +float
        +int
        +list
        +None
        +str
    }
    class LambdaResolver {
        +Callable decode(str value)
        +str | object encode(Callable value)
        +str get_source(Callable func)
        +str _get_short_lambda_source(Callable lambda_func)
    }
    Base <|-- LambdaResolver
Loading

Updated class diagram for audobject.core.object

classDiagram
    class Object {
        +Mapping~str, object~ arguments
        +Mapping~str, str~ borrowed_arguments
        +Sequence~str~ hidden_arguments
        +Mapping~str, resolver.Base~ resolvers
        +Mapping~str, resolver.DefaultValueType~ to_dict()
        +Object from_dict(Mapping~str, object~ d, str | None root)
        +Object from_yaml(str | io.IOBase path_or_stream)
        +void to_yaml(str | io.IOBase path_or_stream)
        +void _encode_variable(str name, object value, bool include_version, str | None root)
        +object _encode_value(object value, bool include_version)
        +Mapping~str, resolver.DefaultValueType~ _flatten(Mapping~str, resolver.DefaultValueType~ d)
        +resolver.DefaultValueType _resolve_value(str name, object value, str | None root)
    }
Loading

Updated class diagram for audobject.core.parameter

classDiagram
    class Parameter {
        +type value_type
        +str description
        +object value
        +object default_value
        +Sequence~object~ choices
        +str | None version
        +bool __contains__(str | None version)
        +void set_value(object value)
        +void _check_value(object value)
        +void to_path(str delimiter, Sequence~str~ | None include, Sequence~str~ | None exclude, bool sort)
        +object __getattribute__(str name)
        +void __setattr__(str name, object value)
    }
Loading

Updated class diagram for audobject.core.dictionary

classDiagram
    class Dictionary {
        +KeysView~str~ keys()
        +ItemsView~str, object~ items()
        +ValuesView~object~ values()
        +bool __contains__(str key)
        +object __getitem__(str name)
        +void __setitem__(str key, object value)
    }
Loading

File-Level Changes

Change Details Files
Modernize type hint syntax across the codebase
  • Replace typing.Union with
operator for union types
  • Replace typing.Optional with
  • Remove Python 3.8 from supported versions
    • Remove Python 3.8 from test matrix in GitHub Actions workflow
    • Remove Python 3.8 from package classifiers
    • Add requires-python >= 3.9 to pyproject.toml
    .github/workflows/test.yml
    pyproject.toml

    Assessment against linked issues

    Issue Objective Addressed Explanation
    #110 Remove Python 3.8 support from the codebase

    Possibly linked issues


    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

    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 @ChristianGeng - 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

    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/test_object.py Outdated Show resolved Hide resolved
    audobject/core/object.py Show resolved Hide resolved
    Copy link

    codecov bot commented Nov 20, 2024

    Codecov Report

    All modified and coverable lines are covered by tests ✅

    Project coverage is 100.0%. Comparing base (2e9e40f) to head (efbbb4e).

    Additional details and impacted files
    Files with missing lines Coverage Δ
    audobject/core/api.py 100.0% <100.0%> (ø)
    audobject/core/decorator.py 100.0% <100.0%> (ø)
    audobject/core/dictionary.py 100.0% <100.0%> (ø)
    audobject/core/object.py 100.0% <100.0%> (ø)
    audobject/core/parameter.py 100.0% <100.0%> (ø)
    audobject/core/resolver.py 100.0% <100.0%> (ø)
    audobject/core/utils.py 100.0% <100.0%> (ø)
    ---- 🚨 Try these New Features:

    @ChristianGeng ChristianGeng requested a review from hagenw November 20, 2024 10:28
    audobject/core/api.py Outdated Show resolved Hide resolved
    audobject/core/api.py Outdated Show resolved Hide resolved
    audobject/core/object.py Show resolved Hide resolved
    tests/test_object.py Outdated Show resolved Hide resolved
    audobject/core/api.py Outdated Show resolved Hide resolved
    audobject/core/api.py Outdated Show resolved Hide resolved
    audobject/core/parameter.py Outdated Show resolved Hide resolved
    audobject/core/resolver.py Outdated Show resolved Hide resolved
    tests/test_object.py Outdated Show resolved Hide resolved
    tests/test_resolver.py Outdated Show resolved Hide resolved
    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.

    Remove support for python 3.8
    2 participants