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

How to uv add with markers? #7237

Open
dimaqq opened this issue Sep 10, 2024 · 4 comments
Open

How to uv add with markers? #7237

dimaqq opened this issue Sep 10, 2024 · 4 comments
Assignees
Labels
documentation Improvements or additions to documentation question Asking for clarification or support

Comments

@dimaqq
Copy link

dimaqq commented Sep 10, 2024

Let's say I want to achieve tomli = { version = "~2.0", python = "<3.11" }.

How do I uv add it? I just can't figure out the syntax and docs don't help.

If manual edit of pyproject.toml is required, maybe there should be a separate page in the docs.

@zanieb
Copy link
Member

zanieb commented Sep 10, 2024

Like this

❯ uv add --directory example "tomli>=2.0; python_version < '3.11'"

❯ cat example/pyproject.toml
[project]
name = "example"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
    "tomli>=2.0 ; python_full_version < '3.11'",
]

@zanieb zanieb added documentation Improvements or additions to documentation question Asking for clarification or support labels Sep 10, 2024
@zanieb
Copy link
Member

zanieb commented Sep 10, 2024

cc @konstin / @charliermarsh should we support adding markers via a dedicated flag (or flags)?

@phi-friday
Copy link

phi-friday commented Sep 11, 2024

Isn't it enough to point users to links?
like
https://peps.python.org/pep-0508/
https://peps.python.org/pep-0621/
https://packaging.python.org/en/latest/specifications/dependency-specifiers/

Of course, it would be nice to have more configurable options.

@dimaqq
Copy link
Author

dimaqq commented Sep 11, 2024

  • uv add --help mentions PEP 508, which includes:
    • an example under the Examples heading, but it's unclear how to convert that to a single command line argument
    • a set of tests at the end of the PEP, that clarifies syntax, esp. quotation
  • PEP 621 was not useful for me
  • packaging dependency specifiers seems to be a copy of PEP 508

I personally would be very happy if the uv add usage had a short link to uv docs as opposed to naming PEP, and the uv docs contained additional examples.

@zanieb zanieb self-assigned this Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation question Asking for clarification or support
Projects
None yet
Development

No branches or pull requests

3 participants