[Python] How can I use a local Python package during development while keeping a Git...

Discussão em 'Python' iniciado por Stack, Março 27, 2025.

  1. Stack

    Stack Membro Participativo

    I'm developing two Python projects:

    • xxx: A Python library I maintain, hosted on GitHub.
    • yyy: An open-source project that depends on xxx.

    In yyy's pyproject.toml, I declare the dependency as:

    [tool.uv.sources]
    xxx = { git = "git+https://github.com/myuser/xxx.git" }


    This works well for others who clone yyy — they get the correct version of xxx from GitHub. However during development, I want to use a local copy of xxx (e.g., ~/xxx) so I can test changes in yyy without pushing to GitHub each time.

    I'd like a solution that:

    • Lets me use a local path for xxx during development.
    • Doesn’t require me to change pyproject.toml before every commit.
    • Keeps yyy portable and installable via GitHub for others.

    Is there a clean way to override the Git-based dependency locally (perhaps with a .gitignored file or config), while keeping pyproject.toml untouched?

    I'm using uv as my Python package manager.

    Any best practices or workflows for this setup?

    Continue reading...

Compartilhe esta Página