admin管理员组

文章数量:1398804

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+.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?

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/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?

Share Improve this question asked Mar 27 at 13:19 Daniel ChinDaniel Chin 3361 gold badge5 silver badges15 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

When developing a framework or any library/pypi package, you, of course, want to have a separate project to test it on.

Let say your library project is in ~dev/mylibrary

And your project using it is in ~dev/myapp

From ~dev/myapp you can simply:

uv pip install -e ../mylibrary

Then you will be able to import mylibrary into myapp without the need to always build it and push to git or pypi, and pulling it every time you update the code.

You also will be able to work on your code in the VS Code or other IDE in 2 projects simultaneously, and quickly changing the code in the library, will immediately work in the app project, so you do not need to run uv again.

However, sometimes, you might face the cache issues. In that case, delete .venv folder, delete all the pycache folders and run uv sync and uv pip install -e ../folder again.

Highly recommend the Project Manager extension for the VS Code. Here are extensions, I am using while developing my own framework and testing it locally.

https://arkalos/docs/installation/#install-extensions

本文标签: