[Python] After `uv init`, adding script to `[project.scripts]` does not work

Discussão em 'Python' iniciado por Stack, Fevereiro 6, 2025.

  1. Stack

    Stack Membro Participativo

    I created a new project with uv 0.5.7:

    uv init myproject
    cd myproject
    uv sync


    and my project looks like this:

    ├── hello.py
    ├── pyproject.toml
    ├── README.md
    └── uv.lock


    At this point, the following work:

    uv run python hello.py
    uv run python -m hello


    I would like to make a script name um by adding the following to pyproject.toml:

    [project.scripts]
    um = "hello:main"


    However, that script is not found when I run it:

    $ uv run um [umbala:main:]
    error: Failed to spawn: `um`
    Caused by: No such file or directory (os error 2)


    I need help to create this script, um. What did I miss? I appreciate your time. Thank you.

    Continue reading...

Compartilhe esta Página