Skip to content

Commit 660adb5

Browse files
PreistlyPythonpre-commit-ci[bot]
andauthored
Fix incorrect type annotations in PythonPathPackageWithDeps (fixes #3607) (#3616)
* fix: correct type annotations in PythonPathPackageWithDeps (fixes #3607) Changed deps parameter from Sequence[Any] to Sequence[Requirement] and self.deps attribute from Sequence[Package] to Sequence[Requirement] to match actual runtime usage throughout the codebase. Added changelog entry documenting the fix. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 393de39 commit 660adb5

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

docs/changelog/3607.bugfix.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix incorrect type annotation in ``PythonPathPackageWithDeps.__init__()``
2+
where ``deps`` was annotated as ``Sequence[Package]`` but should be
3+
``Sequence[Requirement]`` to match actual runtime usage - by :user:`PreistlyPython`

src/tox/tox_env/python/package.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import annotations
44

55
from abc import ABC, abstractmethod
6-
from typing import TYPE_CHECKING, Any, Generator, Iterator, List, Sequence, cast
6+
from typing import TYPE_CHECKING, Generator, Iterator, List, Sequence, cast
77

88
from packaging.requirements import Requirement
99

@@ -28,9 +28,9 @@ class PythonPackage(Package):
2828

2929

3030
class PythonPathPackageWithDeps(PathPackage):
31-
def __init__(self, path: Path, deps: Sequence[Any]) -> None:
31+
def __init__(self, path: Path, deps: Sequence[Requirement]) -> None:
3232
super().__init__(path=path)
33-
self.deps: Sequence[Package] = deps
33+
self.deps: Sequence[Requirement] = deps
3434

3535

3636
class WheelPackage(PythonPathPackageWithDeps):

0 commit comments

Comments
 (0)