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

Updates round 3 #2334

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

Conversation

matthewhughes934
Copy link
Contributor

@matthewhughes934 matthewhughes934 commented Jan 14, 2025

Final round of updates from my fork. After this I think all dependencies
should be close to their latest release, in my fork I added dependabot
after these changes to keep things up to date.

Context, other PRs were from 26cf27d,
78c30dc and comment
#2320 (comment)

  • Update remaining dependencies

    A bunch of updates that required no additional changes:

    • Update setuptools
    • Update bandit
    • Update httpx
    • Update pytest-mock
    • Update pep8-naming
    • Update pip_api
    • Update pip
    • Update safety
    • Update types-toml
    • Update vulture
    • Update coverage
    • Update types-colorama
  • Update mypy to v1+

    This includes removing some now unused ignores, and fixing some new
    errors:

      isort/sorting.py:120: error: Unused "type: ignore" comment  [unused-ignore]
      isort/settings.py:869: error: Unused "type: ignore" comment  [unused-ignore]
      isort/literal.py:89: error: Unused "type: ignore" comment  [unused-ignore]
      isort/deprecated/finders.py:32: error: Incompatible types in assignment (expression has type "None", variable has type "Callable[[PathLike[Any], Optional[Any], bool, bool], Dict[str, Union[Requirement, UnparsedRequirement]]]")  [assignment]
      isort/api.py:196: error: No overload variant of "compile" matches argument types "str", "str", "str", "int", "int"  [call-overload]
      isort/api.py:196: note: Possible overload variants:
      isort/api.py:196: note:     def compile(source: Union[str, Buffer, Module, Expression, Interactive], filename: Union[str, Buffer, _PathLike[Any]], mode: str, flags: Literal[0], dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> CodeType
      isort/api.py:196: note:     def compile(source: Union[str, Buffer, Module, Expression, Interactive], filename: Union[str, Buffer, _PathLike[Any]], mode: str, *, dont_inherit: bool = ..., optimize: int = ..., _feature_version: int = ...) -> CodeType
      isort/api.py:196: note:     def compile(source: Union[str, Buffer, Module, Expression, Interactive], filename: Union[str, Buffer, _PathLike[Any]], mode: str, flags: Literal[1024], dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> AST
      isort/api.py:196: note:     def compile(source: Union[str, Buffer, Module, Expression, Interactive], filename: Union[str, Buffer, _PathLike[Any]], mode: str, flags: int, dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> Any
      isort/api.py:223: error: No overload variant of "compile" matches argument types "str", "str", "str", "int", "int"  [call-overload]
      isort/api.py:223: note: Possible overload variants:
      isort/api.py:223: note:     def compile(source: Union[str, Buffer, Module, Expression, Interactive], filename: Union[str, Buffer, _PathLike[Any]], mode: str, flags: Literal[0], dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> CodeType
      isort/api.py:223: note:     def compile(source: Union[str, Buffer, Module, Expression, Interactive], filename: Union[str, Buffer, _PathLike[Any]], mode: str, *, dont_inherit: bool = ..., optimize: int = ..., _feature_version: int = ...) -> CodeType
      isort/api.py:223: note:     def compile(source: Union[str, Buffer, Module, Expression, Interactive], filename: Union[str, Buffer, _PathLike[Any]], mode: str, flags: Literal[1024], dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> AST
      isort/api.py:223: note:     def compile(source: Union[str, Buffer, Module, Expression, Interactive], filename: Union[str, Buffer, _PathLike[Any]], mode: str, flags: int, dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> Any
      tests/integration/test_setting_combinations.py:64: error: Unused "type: ignore" comment  [unused-ignore]
      tests/unit/test_isort.py:5550: error: Signature of "seek" incompatible with supertype "TextIOWrapper"  [override]
      tests/unit/test_isort.py:5550: note:      Superclass:
      tests/unit/test_isort.py:5550: note:          def seek(self, int, int = ..., /) -> int
      tests/unit/test_isort.py:5550: note:      Subclass:
      tests/unit/test_isort.py:5550: note:          def seek(self, position: Any) -> Any
      tests/unit/test_isort.py:5550: error: Signature of "seek" incompatible with supertype "IOBase"  [override]
      tests/unit/test_isort.py:5550: note:      Superclass:
      tests/unit/test_isort.py:5550: note:          def seek(self, int, int = ..., /) -> int
      tests/unit/test_isort.py:5550: note:      Subclass:
      tests/unit/test_isort.py:5550: note:          def seek(self, position: Any) -> Any
      tests/unit/test_isort.py:5550: error: Signature of "seek" incompatible with supertype "IO"  [override]
      tests/unit/test_isort.py:5550: note:      Superclass:
      tests/unit/test_isort.py:5550: note:          def seek(self, int, int = ..., /) -> int
      tests/unit/test_isort.py:5550: note:      Subclass:
      tests/unit/test_isort.py:5550: note:          def seek(self, position: Any) -> Any
      tests/integration/test_hypothesmith.py:69: error: Unused "type: ignore" comment  [unused-ignore]
      Found 11 errors in 8 files (checked 88 source files)
    
  • Update bugbear

    And fix some issues from new bugbear:

      tests/unit/test_setuptools_command.py:15:5: B036 Don't except `BaseException` unless you plan to re-raise it.
      tests/unit/test_setuptools_command.py:30:5: B036 Don't except `BaseException` unless you plan to re-raise it.
    

@matthewhughes934
Copy link
Contributor Author

@staticdev since I saw you merge my previous PR, I raised this just in case you wanted some more dependency updates since it was just a matter of cherry-picking from my fork

Copy link

codecov bot commented Jan 14, 2025

Codecov Report

Attention: Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 99.16%. Comparing base (90e2c73) to head (4f38a97).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2334      +/-   ##
==========================================
+ Coverage   99.12%   99.16%   +0.03%     
==========================================
  Files          40       40              
  Lines        3098     3098              
  Branches      788      788              
==========================================
+ Hits         3071     3072       +1     
  Misses         15       15              
+ Partials       12       11       -1     

@@ -29,7 +29,7 @@
from pip_api import parse_requirements # type: ignore

except ImportError:
parse_requirements = None
parse_requirements = None # type: ignore[assignment]
Copy link
Member

Choose a reason for hiding this comment

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

This can be fixed by initialising parse_requirements on line 27 as parse_requirements: types.ModelType | None right? Or does mypy no longer support that pattern?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This can be fixed by initialising parse_requirements on line 27 as parse_requirements: types.ModelType | None right? Or does mypy no longer support that pattern?

Sorry, what is types.ModelType?

I think the typing would have to be something like (from a glance at /~https://github.com/di/pip-api/blob/21eea42e37b29e18c004a922f8989108a006a203/pip_api/_parse_requirements.py#L484):

parse_requirements: (
    Callable[
        [os.PathLike[str], Optional[Any], bool, bool],
        Dict[str, Union[pip_api.Requirement, pip_api.UnparsedRequirement]],
    ]
    | None
)

but that's a bit tricky, because at this point pip_api isn't imported, so pip_api.UnparsedRequirement is unknown

Copy link
Member

Choose a reason for hiding this comment

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

Ah my bad, didn't read this correctly.

Indeed seems like fixing this is more trouble than it is worth

pyproject.toml Outdated
httpx = ">=0.13.3"
hypothesmith = ">=0.1.3"
hypothesis = ">=6.10.1"
mypy = ">=0.902,<1.0.0"
mypy = ">=0.902,<2.0.0"
Copy link
Member

Choose a reason for hiding this comment

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

Why limit this to below 2?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why limit this to below 2?

The original commit was from dependabot (matthewhughes934/isort-fork@390f27e) and that's how it handled it, happy to drop the restriction

Copy link
Member

Choose a reason for hiding this comment

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

I would probably remove it, but @staticdev might have a different opinion

pyproject.toml Outdated
httpx = ">=0.13.3"
hypothesmith = ">=0.1.3"
hypothesis = ">=6.10.1"
mypy = ">=0.902,<1.0.0"
mypy = ">=0.902,<2.0.0"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would suggest to change to:

Suggested change
mypy = ">=0.902,<2.0.0"
mypy = ">=1.14.1"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would suggest to change to:

updated while rebasing on main: 01afb2e

pyproject.toml Outdated
@@ -56,11 +56,11 @@ cruft = ">=2.12.0"
example-isort-sorting-plugin = ">=0.1.0"
example-shared-isort-profile = ">=0.1.0"
flake8 = ">=3.8.4"
flake8-bugbear = ">=22.12.6,<23.0.0"
flake8-bugbear = ">=22.12.6,<25.0.0"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here I would do:

Suggested change
flake8-bugbear = ">=22.12.6,<25.0.0"
flake8-bugbear = ">=24.12.12"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here I would do:

squashed in with my rebase: a8dbecf

@matthewhughes934
Copy link
Contributor Author

actions look unhappy, but this is also true for main: checks are failing on 1c8d963. I think #2339 is addressing this

Copy link
Member

@DanielNoord DanielNoord left a comment

Choose a reason for hiding this comment

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

LGTM!

@staticdev I think we can merge this already, it doesn't break main more than it already is

@staticdev staticdev added the enhancement New feature or request label Jan 20, 2025
Copy link
Collaborator

@staticdev staticdev left a comment

Choose a reason for hiding this comment

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

@matthewhughes934 still we have to figure out what is the issue now with Python 3.13, since tests still are not passing.

@matthewhughes934
Copy link
Contributor Author

matthewhughes934 commented Jan 20, 2025

@matthewhughes934 still we have to figure out what is the issue now with Python 3.13, since tests still are not passing.

👍 I will have a deeper look later today

A bunch of updates that required no additional changes:

* Update `setuptools`
* Update `bandit`
* Update `httpx`
* Update `pytest-mock`
* Update `pep8-naming`
* Update `pip_api`
* Update `pip`
* Update `safety`
* Update `types-toml`
* Update `vulture`
* Update `coverage`
* Update `types-colorama`

A manual adjustment was made to the version of `safety-schemas` to avoid
a version of `pydantic` that is incompatibility with Python 3.13[1]

Link: pyupio/safety#620 [1]
This includes removing some now unused ignores, and fixing some new
errors:

    isort/sorting.py:120: error: Unused "type: ignore" comment  [unused-ignore]
    isort/settings.py:869: error: Unused "type: ignore" comment  [unused-ignore]
    isort/literal.py:89: error: Unused "type: ignore" comment  [unused-ignore]
    isort/deprecated/finders.py:32: error: Incompatible types in assignment (expression has type "None", variable has type "Callable[[PathLike[Any], Optional[Any], bool, bool], Dict[str, Union[Requirement, UnparsedRequirement]]]")  [assignment]
    isort/api.py:196: error: No overload variant of "compile" matches argument types "str", "str", "str", "int", "int"  [call-overload]
    isort/api.py:196: note: Possible overload variants:
    isort/api.py:196: note:     def compile(source: Union[str, Buffer, Module, Expression, Interactive], filename: Union[str, Buffer, _PathLike[Any]], mode: str, flags: Literal[0], dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> CodeType
    isort/api.py:196: note:     def compile(source: Union[str, Buffer, Module, Expression, Interactive], filename: Union[str, Buffer, _PathLike[Any]], mode: str, *, dont_inherit: bool = ..., optimize: int = ..., _feature_version: int = ...) -> CodeType
    isort/api.py:196: note:     def compile(source: Union[str, Buffer, Module, Expression, Interactive], filename: Union[str, Buffer, _PathLike[Any]], mode: str, flags: Literal[1024], dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> AST
    isort/api.py:196: note:     def compile(source: Union[str, Buffer, Module, Expression, Interactive], filename: Union[str, Buffer, _PathLike[Any]], mode: str, flags: int, dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> Any
    isort/api.py:223: error: No overload variant of "compile" matches argument types "str", "str", "str", "int", "int"  [call-overload]
    isort/api.py:223: note: Possible overload variants:
    isort/api.py:223: note:     def compile(source: Union[str, Buffer, Module, Expression, Interactive], filename: Union[str, Buffer, _PathLike[Any]], mode: str, flags: Literal[0], dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> CodeType
    isort/api.py:223: note:     def compile(source: Union[str, Buffer, Module, Expression, Interactive], filename: Union[str, Buffer, _PathLike[Any]], mode: str, *, dont_inherit: bool = ..., optimize: int = ..., _feature_version: int = ...) -> CodeType
    isort/api.py:223: note:     def compile(source: Union[str, Buffer, Module, Expression, Interactive], filename: Union[str, Buffer, _PathLike[Any]], mode: str, flags: Literal[1024], dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> AST
    isort/api.py:223: note:     def compile(source: Union[str, Buffer, Module, Expression, Interactive], filename: Union[str, Buffer, _PathLike[Any]], mode: str, flags: int, dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> Any
    tests/integration/test_setting_combinations.py:64: error: Unused "type: ignore" comment  [unused-ignore]
    tests/unit/test_isort.py:5550: error: Signature of "seek" incompatible with supertype "TextIOWrapper"  [override]
    tests/unit/test_isort.py:5550: note:      Superclass:
    tests/unit/test_isort.py:5550: note:          def seek(self, int, int = ..., /) -> int
    tests/unit/test_isort.py:5550: note:      Subclass:
    tests/unit/test_isort.py:5550: note:          def seek(self, position: Any) -> Any
    tests/unit/test_isort.py:5550: error: Signature of "seek" incompatible with supertype "IOBase"  [override]
    tests/unit/test_isort.py:5550: note:      Superclass:
    tests/unit/test_isort.py:5550: note:          def seek(self, int, int = ..., /) -> int
    tests/unit/test_isort.py:5550: note:      Subclass:
    tests/unit/test_isort.py:5550: note:          def seek(self, position: Any) -> Any
    tests/unit/test_isort.py:5550: error: Signature of "seek" incompatible with supertype "IO"  [override]
    tests/unit/test_isort.py:5550: note:      Superclass:
    tests/unit/test_isort.py:5550: note:          def seek(self, int, int = ..., /) -> int
    tests/unit/test_isort.py:5550: note:      Subclass:
    tests/unit/test_isort.py:5550: note:          def seek(self, position: Any) -> Any
    tests/integration/test_hypothesmith.py:69: error: Unused "type: ignore" comment  [unused-ignore]
    Found 11 errors in 8 files (checked 88 source files)
And fix some issues from new `bugbear`:

    tests/unit/test_setuptools_command.py:15:5: B036 Don't except `BaseException` unless you plan to re-raise it.
    tests/unit/test_setuptools_command.py:30:5: B036 Don't except `BaseException` unless you plan to re-raise it.
@matthewhughes934
Copy link
Contributor Author

@matthewhughes934 still we have to figure out what is the issue now with Python 3.13, since tests still are not passing.

the failure was a built time, I've fixed it up and rebased, see commit faf22ce for details (the last bit of the body)

@staticdev
Copy link
Collaborator

Sorry @matthewhughes934 due to a merge of new Poetry this lock got obsolete. Could you please rebase and lock again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants