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

Add CLI flag for rendering non-VCS files as relative paths. #702

Closed
wants to merge 1 commit into from

Conversation

ssanderson
Copy link

@ssanderson ssanderson commented Dec 18, 2018

This is another stab at solving #204.

Adds a new --files-relative-to flag that can be used to tell pip-compile to
render paths relative to the given directory. In the interest of backwards
compatibility, the current behavior (rendering absolute paths using file:///)
remains unchanged by default.

The main idea here is the same as @orf's changes in #507. Given the current architecture of pip-tools' interactions with pip, it's difficult to maintain context of the original path that was provided in a requirements.in. What we can do relatively easily, however,
is change the logic for rendering file://-dependencies to write them relative to a given directory.

Current Behavior (Unchanged by Default)
(pip-tools) [~/quantopian/pip-tools]@(relative-file-paths:014ef1825b)$ pip-compile dev-requirements.txt -o tmp.txt
#
# This file is autogenerated by pip-compile
# To update, run:
#
#    pip-compile --output-file tmp.txt dev-requirements.txt
#
-e file:///home/ssanderson/quantopian/pip-tools   # <--- This is the thing I'm trying to change.
atomicwrites==1.2.1       # via pytest
attrs==18.2.0             # via pytest
click==7.0
mock==2.0.0
more-itertools==4.3.0     # via pytest
pbr==5.1.1                # via mock
pluggy==0.8.0             # via pytest
py==1.7.0                 # via pytest
pytest==4.0.2
six==1.12.0               # via mock, more-itertools, pytest
wheel==0.32.3
Behavior with New Flag
(pip-tools) [~/quantopian/pip-tools]@(relative-file-paths:014ef1825b)$ pip-compile dev-requirements.txt -o tmp.txt --files-relative-to=.
#
# This file is autogenerated by pip-compile
# To update, run:
#
#    pip-compile --output-file tmp.txt dev-requirements.txt
#
-e .
atomicwrites==1.2.1       # via pytest
attrs==18.2.0             # via pytest
click==7.0
mock==2.0.0
more-itertools==4.3.0     # via pytest
pbr==5.1.1                # via mock
pluggy==0.8.0             # via pytest
py==1.7.0                 # via pytest
pytest==4.0.2
six==1.12.0               # via mock, more-itertools, pytest
wheel==0.32.3

Differences relative to #507:

Changelog-friendly one-liner: Added support for writing non-VCS directories using relative paths.

Contributor checklist
  • Provided the tests for the changes. (I haven't done this yet. Happy to do so if there's interest in this feature.)
  • Requested (or received) a review from another contributor
  • Gave a clear one-line description in the PR (that the maintainers can add to CHANGELOG.md afterwards).

Adds a new --files-relative-to flag that can be used to tell pip-compile to
render paths relative to the given directory. In the interest of backwards
compatibility, the current behavior (rendering absolute paths using `file:///`)
remains unchanged by default.
Copy link
Contributor

@auvipy auvipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please rebase?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvements to functionality needs rebase Need to rebase or merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants