8000 Use dev dependency-group by Avasam · Pull Request #14085 · python/typeshed · GitHub
[go: up one dir, main page]

Skip to content

Use dev dependency-group #14085

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Avasam
Copy link
Collaborator
@Avasam Avasam commented May 16, 2025

Would close #13974, but as previously mentioned, there's some blockers from uv:

AFAIK there's currently no way to have a dependency group with local files be both pip and uv compatible:

[dependency-groups]
dev = [
    # ... snipped out all other requirements that don't matter for this example

    # Utilities for typeshed infrastructure scripts.
    "ts_utils @ file:lib", # Works with pip but not uv
]

[tool.uv.sources]
ts_utils = { path = "lib", editable = true } # Works with uv but obviously not pip
PS> uv pip install --group=dev
error: Failed to parse entry in group `dev`: `ts_utils @ file:lib`
  Caused by: relative path without a working directory: lib
ts_utils @ file:lib

Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

- name: Run mypy_primer
shell: bash
run: |
cd typeshed_to_test
MYPY_VERSION=$(grep mypy== requirements-tests.txt | cut -d = -f 3)
MYPY_VERSION=$(python3 -m dependency_groups dev | grep mypy== | cut -d = -f3)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

An alternative that is less "correct" but doesn't depend on dependency_groups and is still pretty solid to random spaces

Suggested change
MYPY_VERSION=$(python3 -m dependency_groups dev | grep mypy== | cut -d = -f3)
MYPY_VERSION=$(grep -E 'mypy\s+?==' pyproject.toml | awk -F '[ ="]+' '{print $3}')

@Avasam Avasam added status: deferred Issue or PR deferred until some precondition is fixed project: infrastructure typeshed build, test, documentation, or distribution related labels May 16, 2025
@Akuli
Copy link
Collaborator
Akuli commented May 16, 2025

I don't like how this makes using uv mandatory. Currently you can still do pip install -r requirements-tests.txt if you don't want to use uv.

Edit: I guess pip install -e . will work, but this still feels like a downgrade to me: -r is super simple to understand or explain.

@Avasam
Copy link
Collaborator Author
Avasam commented May 17, 2025

pip install --group=dev isn't a uv command. You need pip 25.1 though.

The reason this is draft is because at the moment it would only work with uv OR pip. Because uv doesn't support (yet?) relative file paths in dependencies. So there's no way to configure dependency groups to satisfy both tools.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
project: infrastructure typeshed build, test, documentation, or distribution related status: deferred Issue or PR deferred until some precondition is fixed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Merge requirements-tests.txt into pyproject.toml?
2 participants
0