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

Don't filter in toposort #560

Merged
merged 3 commits into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion conda_lock/conda_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ def make_lock_files( # noqa: C901
deep=True,
update={"package": packages_not_to_lock},
)
new_lock_content = lock_content_to_persist | fresh_lock_content
new_lock_content = lock_content_to_persist.merge(fresh_lock_content)

if "lock" in kinds:
write_conda_lock_file(
Expand Down Expand Up @@ -609,6 +609,7 @@ def render_lockfile_for_platform( # noqa: C901

# ensure consistent ordering of generated file
lockfile.toposort_inplace()
lockfile.filter_virtual_packages_inplace()

for p in lockfile.package:
if p.platform == platform and p.category in categories:
Expand Down
13 changes: 2 additions & 11 deletions conda_lock/lockfile/v2prelim/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ class Lockfile(StrictModel):
package: List[LockedDependency]
metadata: LockMeta

def __or__(self, other: "Lockfile") -> "Lockfile":
return other.__ror__(self)

def __ror__(self, other: "Optional[Lockfile]") -> "Lockfile":
def merge(self, other: "Optional[Lockfile]") -> "Lockfile":
"""
merge self into other
"""
Expand Down Expand Up @@ -84,9 +81,7 @@ def filter_virtual_packages_inplace(self) -> None:
]

@staticmethod
def _toposort(
package: List[LockedDependency], update: bool = False
) -> List[LockedDependency]:
def _toposort(package: List[LockedDependency]) -> List[LockedDependency]:
platforms = {d.platform for d in package}

# Resort the conda packages topologically
Expand Down Expand Up @@ -120,10 +115,6 @@ def _toposort(
continue
if dep.manager != manager:
continue
# skip virtual packages
if dep.manager == "conda" and dep.name.startswith("__"):
continue

final_package.append(dep)

return final_package
Expand Down