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

Expose option to use relative paths when converting -e modules from .in to .txt #1968

Closed
theahura opened this issue Aug 18, 2023 · 3 comments

Comments

@theahura
Copy link

theahura commented Aug 18, 2023

What's the problem this feature will solve?

My requirements.in file has an editable install, -e ../../foo/bar. When this gets converted to requirements.txt with piptools, it turns into -e file:///home/theahura/path/to/foo/bar.

The issue is that if anyone else on my team wants to use this requirements.txt, it will break; and if they recompile, the requirements.txt gets an unnecessary update.

Describe the solution you'd like

Turns out that relative path editable installs work just fine in a requirements.txt. It's possible to just have -e ../../foo/bar in the requirements.txt AND the requirements.in. So one option would be:

pip-compile requirements.in --relative_editable_installs=true

which would output the relative path to requirements.txt instead of the absolute one.

Alternative Solutions

Currently I hardcode any relative editable paths in my requirements.txt, which works fine from a pip-install perspective. Unfortunately, pip-tools will then go and update it back to the absolute path whenever a recompile occurs

@atugushev
Copy link
Member

atugushev commented Aug 18, 2023

Does -e file:../../foo/bar work for you? See also #204.

@theahura
Copy link
Author

fantastic! that works great, thank you for the quick turnaround!

@AndydeCleyre
Copy link
Contributor

FWIW the original form (-e ../../foo/bar) works in my feature/relpaths-post-6.8.0 branch, which can be tested for example with pipx:

$ pipx run --spec 'pip-tools @ git+https://github.com/AndydeCleyre/pip-tools@feature/relpaths-post-6.8.0' pip-compile

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

3 participants