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

Feature request: support for script aliases #7180

Closed
matejpekar opened this issue Sep 7, 2024 · 2 comments
Closed

Feature request: support for script aliases #7180

matejpekar opened this issue Sep 7, 2024 · 2 comments
Labels
duplicate This issue or pull request already exists

Comments

@matejpekar
Copy link

Hi! Our team currently relies heavily on PDM and we'd like to migrate to uv. However, we're missing a crucial feature: the ability to define and run script aliases directly from the pyproject.toml file.

Here’s an example of the scripts we currently use to streamline our workflow:

[tool.pdm.scripts]
train = "python -m project mode=fit"
validate = "python -m project mode=validate"
test = "python -m project mode=test"
l = { composite = ["lint", "format"] }
lint = "ruff check --fix"
format = "ruff format"
post_install = { composite = [
    "pre-commit autoupdate",
    "pre-commit install",
    "pre-commit install --hook-type commit-msg",
] }

This setup allows us to:

  • Easily run various modes (e.g., pdm train <...args>).
  • Automatically install pre-commit hooks when running pdm install.
  • Reference these scripts in our GitLab CI/CD templates.

Key Features:

  • Script Definition in pyproject.toml: Ability to define shell scripts that can be run directly from the pyproject.toml file.
  • Composite Commands: Support for composite scripts, where a single command triggers multiple actions (e.g., l runs both lint and format).
  • Pre/Post Hooks: Hooks like post_sync to automate tasks such as installing pre-commit hooks after uv sync.
  • Script Skipping: A way to skip certain scripts, possibly with a --skip flag.

Additional Suggestion:

It would be great if we could run scripts directly without an intermediary command like run. For example, instead of uv run <script>, we could use uv <script>. In case of a conflict with default commands, uv run <script> could be used as a fallback.


We’d love to see similar functionality in uv, inspired by PDM or npm/yarn.

@gusutabopb
Copy link

Looks like a duplicate of #5903

@zanieb
Copy link
Member

zanieb commented Sep 7, 2024

Yep I think this is covered there already. Thanks for the write-up though!

@zanieb zanieb closed this as not planned Won't fix, can't repro, duplicate, stale Sep 7, 2024
@zanieb zanieb added the duplicate This issue or pull request already exists label Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants