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

Harmonize min-deps script with scanpy #1758

Merged
merged 1 commit into from
Nov 22, 2024
Merged
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
15 changes: 12 additions & 3 deletions ci/scripts/min-deps.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#!/usr/bin/env python3
# /// script
# dependencies = [
# "tomli; python_version < '3.11'",
# "packaging",
# ]
# ///

from __future__ import annotations

import argparse
Expand Down Expand Up @@ -33,12 +40,14 @@ def min_dep(req: Requirement) -> Requirement:
if req.extras:
req_name = f"{req_name}[{','.join(req.extras)}]"

specs = [spec for spec in req.specifier if spec.operator in {">", ">=", "~=", "=="}]
if not specs:
filter_specs = [
spec for spec in req.specifier if spec.operator in {"==", "~=", ">=", ">"}
]
if not filter_specs:
Comment on lines +43 to +46
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess what I was saying was that this condition looks identical but renamed

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah you’re right! Apprently

  1. I already did that in Format sparse_dataset code #1524, then
  2. I didn’t port it to scanpy, then
  3. I fixed it independently in scanpy, finally
  4. I blindly “backported” the changes to here by just copying scanpy’s version over

I renamed the PR to match

return Requirement(req_name)

min_version = Version("0.0.0.a1")
for spec in specs:
for spec in filter_specs:
if spec.operator in {">", ">=", "~="}:
min_version = max(min_version, Version(spec.version))
elif spec.operator == "==":
Expand Down
Loading