Skip to content

Commit

Permalink
Consolidate vendored imports into a single module
Browse files Browse the repository at this point in the history
I want it to be clear what we are and aren't using. Ideally we will
eventually get rid of vendored dependencies.
  • Loading branch information
maresb committed Jul 15, 2023
1 parent 9b6ddf5 commit 9eebe29
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 18 deletions.
2 changes: 1 addition & 1 deletion conda_lock/conda_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from typing_extensions import TypedDict

from conda_lock._vendor.conda.models.match_spec import MatchSpec
from conda_lock.interfaces.vendored_conda import MatchSpec
from conda_lock.invoke_conda import (
PathLike,
_get_conda_flags,
Expand Down
5 changes: 5 additions & 0 deletions conda_lock/interfaces/vendored_conda.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from conda_lock._vendor.conda.common.toposort import toposort
from conda_lock._vendor.conda.models.match_spec import MatchSpec


__all__ = ["toposort", "MatchSpec"]
32 changes: 32 additions & 0 deletions conda_lock/interfaces/vendored_poetry.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from conda_lock._vendor.poetry.core.packages import Dependency as PoetryDependency
from conda_lock._vendor.poetry.core.packages import Package as PoetryPackage
from conda_lock._vendor.poetry.core.packages import (
ProjectPackage as PoetryProjectPackage,
)
from conda_lock._vendor.poetry.core.packages import URLDependency as PoetryURLDependency
from conda_lock._vendor.poetry.core.packages import VCSDependency as PoetryVCSDependency
from conda_lock._vendor.poetry.factory import Factory
from conda_lock._vendor.poetry.installation.chooser import Chooser
from conda_lock._vendor.poetry.installation.operations.uninstall import Uninstall
from conda_lock._vendor.poetry.puzzle import Solver as PoetrySolver
from conda_lock._vendor.poetry.repositories.pool import Pool
from conda_lock._vendor.poetry.repositories.pypi_repository import PyPiRepository
from conda_lock._vendor.poetry.repositories.repository import Repository
from conda_lock._vendor.poetry.utils.env import Env


__all__ = [
"Chooser",
"Env",
"Factory",
"PoetryDependency",
"PoetryPackage",
"PoetryProjectPackage",
"PoetrySolver",
"PoetryURLDependency",
"PoetryVCSDependency",
"Pool",
"PyPiRepository",
"Repository",
"Uninstall",
]
2 changes: 1 addition & 1 deletion conda_lock/lockfile/v2prelim/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def _toposort(
# Resort the conda packages topologically
final_package: List[LockedDependency] = []
for platform in sorted(platforms):
from conda_lock._vendor.conda.common.toposort import toposort
from conda_lock.interfaces.vendored_conda import toposort

# Add the remaining non-conda packages in the order in which they appeared.
# Order the pip packages topologically ordered (might be not 100% perfect if they depend on
Expand Down
28 changes: 14 additions & 14 deletions conda_lock/pypi_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
from clikit.io import ConsoleIO, NullIO
from packaging.tags import compatible_tags, cpython_tags, mac_platforms

from conda_lock._vendor.poetry.core.packages import Dependency as PoetryDependency
from conda_lock._vendor.poetry.core.packages import Package as PoetryPackage
from conda_lock._vendor.poetry.core.packages import (
ProjectPackage as PoetryProjectPackage,
from conda_lock.interfaces.vendored_poetry import (
Chooser,
Env,
Factory,
PoetryDependency,
PoetryPackage,
PoetryProjectPackage,
PoetrySolver,
PoetryURLDependency,
PoetryVCSDependency,
Pool,
PyPiRepository,
Repository,
Uninstall,
)
from conda_lock._vendor.poetry.core.packages import URLDependency as PoetryURLDependency
from conda_lock._vendor.poetry.core.packages import VCSDependency as PoetryVCSDependency
from conda_lock._vendor.poetry.factory import Factory
from conda_lock._vendor.poetry.installation.chooser import Chooser
from conda_lock._vendor.poetry.installation.operations.uninstall import Uninstall
from conda_lock._vendor.poetry.puzzle import Solver as PoetrySolver
from conda_lock._vendor.poetry.repositories.pool import Pool
from conda_lock._vendor.poetry.repositories.pypi_repository import PyPiRepository
from conda_lock._vendor.poetry.repositories.repository import Repository
from conda_lock._vendor.poetry.utils.env import Env
from conda_lock.lockfile import apply_categories
from conda_lock.lockfile.v2prelim.models import (
DependencySource,
Expand Down
2 changes: 1 addition & 1 deletion conda_lock/virtual_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from pydantic import BaseModel, Field, validator

from conda_lock._vendor.conda.models.match_spec import MatchSpec
from conda_lock.interfaces.vendored_conda import MatchSpec
from conda_lock.models.channel import Channel


Expand Down
2 changes: 1 addition & 1 deletion tests/test_conda_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
from freezegun import freeze_time

from conda_lock import __version__, pypi_solver
from conda_lock._vendor.conda.models.match_spec import MatchSpec
from conda_lock.conda_lock import (
DEFAULT_FILES,
DEFAULT_LOCKFILE_NAME,
Expand All @@ -51,6 +50,7 @@
MissingEnvVarError,
PlatformValidationError,
)
from conda_lock.interfaces.vendored_conda import MatchSpec
from conda_lock.invoke_conda import is_micromamba, reset_conda_pkgs_dir
from conda_lock.lockfile import parse_conda_lock_file
from conda_lock.lockfile.v2prelim.models import (
Expand Down

0 comments on commit 9eebe29

Please sign in to comment.