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

Tox cannot install package dependencies for local package added with pdm #3270

Open
Stubatiger opened this issue Apr 23, 2024 · 1 comment
Open

Comments

@Stubatiger
Copy link

Stubatiger commented Apr 23, 2024

Hello,

im currently managing my python project with pdm and use it to add dependencies with pdm add.
I can add a local package ./vendor/local.whl with pdm add ./vendor/local.whl as described at https://pdm-project.org/en/stable/usage/dependency/#local-dependencies.
As i use hatchling as a build backend a dependency entry like sub-package @ {root:uri}/sub-package will be added to the pyproject.toml using its mechanism of https://hatch.pypa.io/1.9/config/context/#paths

But if i try to run my tests with tox it crashes when installing package dependencies because it executes pip with that direct value

py312: install_package_deps> python -I -m pip install 'sub-package @ {root:uri}/sub-package' '
ERROR: Invalid requirement: 'sub-package@ {root:uri}/vendor/sub-package-0.1.0-py3-none-any.whl'
Hint: It looks like a path. File 'sub-package@ {root:uri}/vendor/sub-package-0.1.0-py3-none-any.whl' does not exist.


In the wheel tox builds (the one inside the .pkg env) the METADATA file contains a Requires-Dist line with the correct absolute path of the package like

# In .tox/.pkg/dist/mypackag-0.1.0-py3-none-any.whl/mypackage-0.1.0.dist-info/METADATA
Requires-Dist: sub-package @ file:///home/project/vendor/sub-package

I always thought that tox uses the package dependencies of the built wheel and not taking the dependency list directly from the pyproject.toml file.

In the documentation i can only find that the install_command uses a {packages} variable but where is that variable set?

@jugmac00
Copy link
Member

Thanks for reporting the issue.

Could you come up with a minimal reproducer? Could you then also paste the full output of tox -rvv?

If you want to look yourself, a good starter could be https://github.com/tox-dev/tox/blob/main/src/tox/tox_env/python/pip/pip_install.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants