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

Relative paths support #15

Merged
merged 22 commits into from
Nov 21, 2017
Merged

Relative paths support #15

merged 22 commits into from
Nov 21, 2017

Conversation

suutari-ai
Copy link
Collaborator

@suutari-ai suutari-ai commented Oct 2, 2017

Implement support for relative paths in the source requirements. Any
relative paths will be compiled as relative paths to the output file
too. They can be editable or non-editable.

There is also other related fixes and improvements, which are required
for this feature.

Implements #2

Tom Forbes and others added 8 commits May 12, 2017 14:07
* '204-relative-path' of https://github.com/orf/pip-tools:
  Flake8 fixes
  Add a changelog entry
  Add tests and refactor some fixtures
  Add a is_subdirectory and make format_requirement use it when appropriate
* pip-tools-integration:
  Flake8 fixes
  Add a changelog entry
  Add tests and refactor some fixtures
  Add a is_subdirectory and make format_requirement use it when appropriate
Introduce a new function key_from_dist and always use key_from_ireq for
InstallRequirements, key_from_req for Requirements and key_from_dist for
Distributions.

This also makes sync work better with editables.
It seems that "pip install" doesn't work with relative paths for
editables.
@suutari-ai suutari-ai force-pushed the relative-paths branch 2 times, most recently from 39ca4e7 to 28a3a1e Compare October 8, 2017 14:09
@codecov-io
Copy link

codecov-io commented Oct 8, 2017

Codecov Report

Merging #15 into master will decrease coverage by 0.75%.
The diff coverage is 81.87%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #15      +/-   ##
==========================================
- Coverage   89.81%   89.06%   -0.76%     
==========================================
  Files          26       26              
  Lines        1453     1545      +92     
  Branches      303      323      +20     
==========================================
+ Hits         1305     1376      +71     
- Misses        100      113      +13     
- Partials       48       56       +8
Impacted Files Coverage Δ
prequ/sync.py 78.49% <100%> (+0.23%) ⬆️
prequ/scripts/compile_in.py 87.03% <100%> (ø) ⬆️
prequ/writer.py 92.66% <100%> (+0.13%) ⬆️
prequ/repositories/local.py 80.48% <50%> (-16.29%) ⬇️
prequ/repositories/pypi.py 85.98% <61.53%> (-4.22%) ⬇️
prequ/utils.py 87.82% <83.82%> (-2.57%) ⬇️
prequ/cache.py 93.1% <86.66%> (-1.35%) ⬇️
prequ/repositories/base.py 94.44% <87.5%> (-5.56%) ⬇️
prequ/resolver.py 96.79% <93.33%> (+1.89%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e9a0bf7...c033701. Read the comment docs.

This makes the "via pkg" comments to be generated even if pkg is
editable.
It makes sense to cache the dependencies of unpinneds too, since the
dependencies won't change on a single run, but those dependencies
shouldn't be stored to disk, since on the next run the unpinned
distributions (editables or local directories) could have changed.
Pass the path to the directory containing the output "requirements.txt"
from OutputWriter to the format_requirement function so that it can
format the relative path relative to the output file.
Reraise the errors to make debugging easier.
If the previously generated output file already contained hashes for a
package, use them as-is rather than recalculating them.
This should make dependency resolving work more reliably.  Sometimes
dependencies were calculated incorrectly when some required package was
already installed.
Since the install requirement object might change, it is safer to use
the URL as the key when caching the dependencies.
If a requirement is a link to an artifact (i.e. a wheel, zip, tarball,
etc.), then the artifact should be hashed, not anything which is built
from it.
Even unpinned non-editable VCS urls are now supported.
Sort the path requirements to top and don't use path formatting for
packages found from the find-links directory.
Make the relative paths feature work on Windows too.

Contains also some related refactorings and clean-ups.
This branch implements support for using relative paths as requirement
entries (in setup.cfg or in requirements.in).

The base feature comes from a pip-tools PR (jazzband#507) by
Tom Forbes.  Thanks Tom!

Prequ supports also non-editable URLs and therefore the feature needed
some polishing.  The changes in this branch should make the feature work
nicely as a whole.
@suutari-ai suutari-ai merged commit e645162 into master Nov 21, 2017
@suutari-ai suutari-ai deleted the relative-paths branch November 21, 2017 13:21
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

Successfully merging this pull request may close these issues.

3 participants