-
Notifications
You must be signed in to change notification settings - Fork 790
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 define custom commands like tool.rye.scripts
#6302
Comments
I think this is done in the See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#creating-executable-scripts |
It is not exactly the same. To achieve this, I'm still using poethepoet inherited from poetry, and it just works. But yes, this would be great to have inside |
|
Yeah we don't support this yet, but we plan to in some way. |
this sounds really useful. my solution for this right now is leaving scripts in a bin directory which does the trick because i don't have to remember commands or reverse-i-search forever. would love to have something like this: # ...
[tool.uv.scripts]
clean = "rm -rf build dist *_cache"
format = "ruff format"
check = "ruff check"
test = "pytest"
dev = "uvicorn app.main:app --reload"
[tool.uv.scripts.combos]
ok = ["clean", "format", "check", "test"]
# ... |
@anthonycorletti the combo stuff is interesting, mise does it like this:
but I wonder if this is scope creep :D |
This would be nice to have so I don't need to have separate make/just files |
Duplicate of #5903 |
Hi. I created a small, dependency-free tool to manage scripts directly from pyproject.toml: It works with all dependencies management tools. Tested with uv, pip and poetry. Configuration example[tool.tomlscript]
# Start dev server ==> this line is the documentation of the command
dev = "uv run uvicorn --port {port:5001} myapp:app --reload"
# Linter and test
test = """
uv run ruff check
uv run pytest --inline-snapshot=review
"""
# Generate pyi stubs (python function) ==> Execute python function
gen_pyi = "mypackage.typing:generate_pyi"
setup_dev = """
uv sync
uv run mypy --install-types--non-interactive
aws s3 cp s3://my-bucket/model ./models
""" Usage
|
Hi ππ»
I'm really happy for UV. I always wanted better python ecosystem thanks all of you for your efforts.
I want to migrate from rye to UV as I'm starting new project and wanted to add custom command like
uv run dev
that executesuv run fastapi dev src/backend/main.py
for me.In Rye, I used to define it under scripts section:
However, It looks like UV don't have this feature or isn't documented yet.
The text was updated successfully, but these errors were encountered: