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

Packages with git-based sources are not installed correctly #126

Closed
tpanum opened this issue Nov 14, 2024 · 5 comments
Closed

Packages with git-based sources are not installed correctly #126

tpanum opened this issue Nov 14, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@tpanum
Copy link

tpanum commented Nov 14, 2024

Issue

When I add a package with uv add git+https://github.com/owner/pkgname.git, it is installed just as pkgname (without a specifier) and ignores its location.

Environment

Provide at least:

  • OS: MacOS

Minimal example

uv add git+https://github.com/scikit-learn-contrib/skglm.git
uvx --with tox-uv tox -r run

Causes the following uv pip install:

uv pip install skglm

I would be expecting:

uv pip install git+https://github.com/scikit-learn-contrib/skglm.git
@tpanum tpanum added the bug Something isn't working label Nov 14, 2024
@gtauzin
Copy link

gtauzin commented Nov 14, 2024

I am having a related issue as I am using uv workspaces.

In general, it seems that uv pip will ignore anything in [tool.uv.sources] (see astral-sh/uv#8846). As a result, tox-uv which relies on uv pip install in its install command will fail. Any recommendation for a workaround?

@gtauzin
Copy link

gtauzin commented Nov 14, 2024

@tpanum I may have a workaround that would work in your case. Try go to your pyproject.toml and include your git-based dependency that way:

[project]
...
dependencies = [
  ...
  "pkgname@git+https://github.com/owner/pkgname.git"
 ]
 ...

This should be installable using uv pip install, so tox run should work.

@tpanum
Copy link
Author

tpanum commented Nov 26, 2024

Just an update. This issue also apply to file-based sources, e.g. uv add ../my-pkg will fail as it tries to install using uv pip install my-pkg.

@gtauzin
Copy link

gtauzin commented Nov 26, 2024

I feel the install command should not rely on uv pip but on uv sync. However, I have not been able to make it work.

Any help is appreciated!

@tpanum
Copy link
Author

tpanum commented Nov 26, 2024

Thanks for pointing me in the direction of tox-uv using uv pip by default. I honestly didn't pay too much at that at first.

Knowing that, and following the README.md, it is very apparant that using the uv-venv-lock-runner is the way forward for my issues.

I ended up with the following tox.ini which hopefully can help people with similar problems.

[tox]
envlist = py311

[testenv]
runner = uv-venv-lock-runner
uv_sync_flags=--python={env_python}, --no-editable
with_dev =
    true
commands =
    python -m pytest -s {posargs}

Just a small note, the --python={env_python} is just a measure to fix some issues described in #110.

@tpanum tpanum closed this as completed Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants