From b7d6968a37bacbba216d6b5e96fcf49e744e89b1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 25 Nov 2024 16:34:39 +0000 Subject: [PATCH 1/4] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.7.0 → v0.8.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.7.0...v0.8.0) - [github.com/pre-commit/mirrors-mypy: v1.12.1 → v1.13.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.12.1...v1.13.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7eb61f327..4ba2182c0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,14 +16,14 @@ repos: exclude: ^conda_lock/_vendor/conda/_vendor/appdirs\.py$ - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.7.0 + rev: v0.8.0 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.12.1 + rev: v1.13.0 hooks: - id: mypy additional_dependencies: From 62898e433fd214bc1d3f128cf3ddefd710dc3674 Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Mon, 25 Nov 2024 18:14:14 +0100 Subject: [PATCH 2/4] Sort __all__ --- conda_lock/interfaces/vendored_conda.py | 2 +- conda_lock/interfaces/vendored_poetry.py | 2 +- conda_lock/lockfile/v2prelim/models.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conda_lock/interfaces/vendored_conda.py b/conda_lock/interfaces/vendored_conda.py index e3ce8e37a..c09259d9f 100644 --- a/conda_lock/interfaces/vendored_conda.py +++ b/conda_lock/interfaces/vendored_conda.py @@ -6,4 +6,4 @@ from conda_lock._vendor.conda.models.match_spec import MatchSpec -__all__ = ["toposort", "MatchSpec", "mask_anaconda_token", "split_anaconda_token"] +__all__ = ["MatchSpec", "mask_anaconda_token", "split_anaconda_token", "toposort"] diff --git a/conda_lock/interfaces/vendored_poetry.py b/conda_lock/interfaces/vendored_poetry.py index fef066d68..139ecd2d3 100644 --- a/conda_lock/interfaces/vendored_poetry.py +++ b/conda_lock/interfaces/vendored_poetry.py @@ -42,9 +42,9 @@ "Link", "Operation", "PoetryDependency", - "PoetryPackage", "PoetryDirectoryDependency", "PoetryFileDependency", + "PoetryPackage", "PoetryProjectPackage", "PoetrySolver", "PoetryURLDependency", diff --git a/conda_lock/lockfile/v2prelim/models.py b/conda_lock/lockfile/v2prelim/models.py index b1207262b..867298bbd 100644 --- a/conda_lock/lockfile/v2prelim/models.py +++ b/conda_lock/lockfile/v2prelim/models.py @@ -228,9 +228,9 @@ def __init__( "GitMeta", "HashModel", "InputMeta", + "LockMeta", "LockedDependency", "Lockfile", - "LockMeta", "MetadataOption", "TimeMeta", "UpdateSpecification", From 0ce37287bd04d7a2798cc0b13ff254356d9e7bbf Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Mon, 25 Nov 2024 18:15:51 +0100 Subject: [PATCH 3/4] Switch tests to use Pydantic model_copy --- tests/test_conda_lock.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_conda_lock.py b/tests/test_conda_lock.py index c81036cd6..5b2c1996d 100644 --- a/tests/test_conda_lock.py +++ b/tests/test_conda_lock.py @@ -1989,17 +1989,17 @@ def test_aggregate_lock_specs_invalid_pip_repos(): sources=[], ) - spec_a_b = base_spec.copy(update={"pip_repositories": [repo_a, repo_b]}) + spec_a_b = base_spec.model_copy(update={"pip_repositories": [repo_a, repo_b]}) agg_spec = aggregate_lock_specs([base_spec, spec_a_b, spec_a_b], platforms=[]) assert agg_spec.pip_repositories == spec_a_b.pip_repositories # swap the order of the two repositories, which is an error - spec_b_a = base_spec.copy(update={"pip_repositories": [repo_b, repo_a]}) + spec_b_a = base_spec.model_copy(update={"pip_repositories": [repo_b, repo_a]}) with pytest.raises(ChannelAggregationError): agg_spec = aggregate_lock_specs([base_spec, spec_a_b, spec_b_a], platforms=[]) # We can combine ["a"] with ["b", "a"], but not with ["a", "b"]. - spec_a = base_spec.copy(update={"pip_repositories": [repo_a]}) + spec_a = base_spec.model_copy(update={"pip_repositories": [repo_a]}) aggregate_lock_specs([base_spec, spec_a, spec_b_a], platforms=[]) with pytest.raises(ChannelAggregationError): aggregate_lock_specs([base_spec, spec_a, spec_a_b], platforms=[]) From 4f9e53b674b92e5f8d4347208ed854df40d9d179 Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Mon, 25 Nov 2024 19:00:09 +0100 Subject: [PATCH 4/4] Add unused-ignore to fix flaky mypy behavior --- conda_lock/virtual_package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conda_lock/virtual_package.py b/conda_lock/virtual_package.py index b169a0c8e..1c47832e6 100644 --- a/conda_lock/virtual_package.py +++ b/conda_lock/virtual_package.py @@ -49,7 +49,7 @@ def to_repodata_entry(self) -> Tuple[str, Dict[str, Any]]: class FakeRepoData(BaseModel): base_path: pathlib.Path packages_by_subdir: DefaultDict[FakePackage, Set[str]] = Field( - default_factory=lambda: defaultdict(set) # type: ignore[arg-type] + default_factory=lambda: defaultdict(set) # type: ignore[arg-type,unused-ignore] ) all_subdirs: Set[str] = { "noarch",