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

show via for direct deps #881

Closed
graingert opened this issue Aug 27, 2019 · 11 comments · Fixed by #1058
Closed

show via for direct deps #881

graingert opened this issue Aug 27, 2019 · 11 comments · Fixed by #1058
Labels
annotations Related to packages annotations enhancement Improvements to functionality needs discussion Need some more discussion

Comments

@graingert
Copy link
Member

Currently when compiling, direct deps do not include a 'via' declaration. eg:

git grep "# via"
...
requirements.txt:    # via entrypoints, flake8, importlib-metadata, pylint
...

however it is missing from direct dependencies.

I propose:

# via ./requirements.in, etc, etc

for direct deps

@graingert
Copy link
Member Author

Or:

# directly and via etc, etc

to avoid squatting any possible future package name namespace

@atugushev
Copy link
Member

Hello @graingert! What do you mean by "direct deps"?

@atugushev atugushev added the feature Request for a new feature label Aug 28, 2019
@graingert
Copy link
Member Author

Deps discovered in the .in file

@atugushev
Copy link
Member

atugushev commented Aug 28, 2019

I see. Could you please provide a real example of the current behavior and what is you proposing? I want to be sure that i understand the issue.

@graingert
Copy link
Member Author

The current behaviour is that some dependencies in the generated requirements.txt do not include a # via comment. I'd prefer it if all dependencies included a # via comment

@atugushev
Copy link
Member

The current behaviour is that some dependencies in the generated requirements.txt do not include a # via comment.

Could you show an example?

@graingert
Copy link
Member Author

No it's not possible because the comment is missing

@atugushev
Copy link
Member

atugushev commented Aug 28, 2019

Okay, let's suppose:

$ cat requiremets.in
django

$ pip-compile
#
# This file is autogenerated by pip-compile
# To update, run:
#
#    pip-compile
#
django==2.2.4
pytz==2019.2              # via django
sqlparse==0.3.0           # via django

The django is a "direct dependency" (or primary package). So, do you want to see "# via requirements.in" close to the "django" in requirements.txt? For example:

$ cat requirements.txt
#
# This file is autogenerated by pip-compile
# To update, run:
#
#    pip-compile
#
django==2.2.4             # via requirements.in
pytz==2019.2              # via django
sqlparse==0.3.0           # via django

@graingert
Copy link
Member Author

graingert commented Aug 28, 2019

graingert@onomastic:~$ cat requirements.in 
django
django-debug-toolbar
graingert@onomastic:~$ pip-compile --generate-hashes requirements.in 
#
# This file is autogenerated by pip-compile
# To update, run:
#
#    pip-compile --generate-hashes requirements.in
#
django-debug-toolbar==2.0 \
    --hash=sha256:17c53cd6bf4e7d69902aedf9a1d26c5d3b7369b54c5718744704f27b5a72f35d \
    --hash=sha256:9a23ada2e43cd989195db3c18710b5d7451134a0d48127ab64c1d2ad81700342
django==2.2.4 \
    --hash=sha256:16a5d54411599780ac9dfe3b9b38f90f785c51259a584e0b24b6f14a7f69aae8 \
    --hash=sha256:9a2f98211ab474c710fcdad29c82f30fc14ce9917c7a70c3682162a624de4035
pytz==2019.2 \
    --hash=sha256:26c0b32e437e54a18161324a2fca3c4b9846b74a8dccddd843113109e1116b32 \
    --hash=sha256:c894d57500a4cd2d5c71114aaab77dbab5eabd9022308ce5ac9bb93a60a6f0c7 \
    # via django
sqlparse==0.3.0 \
    --hash=sha256:40afe6b8d4b1117e7dff5504d7a8ce07d9a1b15aeeade8a2d10f130a834f8177 \
    --hash=sha256:7c3dca29c022744e95b547e867cee89f4fce4373f3549ccd8797d8eb52cdb873 \
    # via django, django-debug-toolbar

Instead I'd like to see

#
# This file is autogenerated by pip-compile
# To update, run:
#
#    pip-compile --generate-hashes requirements.in
#
django-debug-toolbar==2.0 \
    --hash=sha256:17c53cd6bf4e7d69902aedf9a1d26c5d3b7369b54c5718744704f27b5a72f35d \
    --hash=sha256:9a23ada2e43cd989195db3c18710b5d7451134a0d48127ab64c1d2ad81700342
django==2.2.4 \
    --hash=sha256:16a5d54411599780ac9dfe3b9b38f90f785c51259a584e0b24b6f14a7f69aae8 \
    --hash=sha256:9a2f98211ab474c710fcdad29c82f30fc14ce9917c7a70c3682162a624de4035
    # directly and via django-debug-toolbar
pytz==2019.2 \
    --hash=sha256:26c0b32e437e54a18161324a2fca3c4b9846b74a8dccddd843113109e1116b32 \
    --hash=sha256:c894d57500a4cd2d5c71114aaab77dbab5eabd9022308ce5ac9bb93a60a6f0c7 \
    # via django
sqlparse==0.3.0 \
    --hash=sha256:40afe6b8d4b1117e7dff5504d7a8ce07d9a1b15aeeade8a2d10f130a834f8177 \
    --hash=sha256:7c3dca29c022744e95b547e867cee89f4fce4373f3549ccd8797d8eb52cdb873 \
    # via django, django-debug-toolbar
graingert@onomastic:~$ 

@atugushev atugushev added needs discussion Need some more discussion enhancement Improvements to functionality and removed feature Request for a new feature labels Sep 19, 2019
@prebeta
Copy link

prebeta commented Oct 21, 2019

I would like to see a feature like this. It'd be nice to know the dependencies between my explicitly declared packages.

@AndydeCleyre
Copy link
Contributor

I welcome feedback on the state of #1058. At the time of this comment:

$ cat requirements.in
django
django-debug-toolbar
$ pip-compile --no-header requirements.in
asgiref==3.2.3            # via django
django-debug-toolbar==2.2  # via -r requirements.in (line 2)
django==3.0.3             # via -r requirements.in (line 1), django-debug-toolbar
pytz==2019.3              # via django
sqlparse==0.3.0           # via django, django-debug-toolbar

AndydeCleyre added a commit to AndydeCleyre/pip-tools that referenced this issue Feb 19, 2020
…y and VCS reqs; fixes jazzband#881 and jazzband#293

Change Notes
------------

- Annotations now include reqsin/setup.py/stdin info when relevant
- Always send reverse_dependencies to writer._format_requirement as a dict, even if empty
- Invert checks for primary requirements not getting annotations, as they now do
- Bypass annotation noise in tests which don't target annotations anyway, by passing --no-annotate
- ireqs returned by get_best_match now have the parameter ireq's _source_ireqs, if any
- reverse_dependencies are no longer passed around independently outside the
  resolver/cache, but rather determined from an ireq's comes_from and _source_ireqs
- primary_packages are no longer passed around independently, but rather determined by
  an ireq's constraint
- In tests, reverse dependencies for fake ireqs are now specified by setting the ireq's
  comes_from
- These changes do _not_ improve handling of relative paths to reqsin files in annotations (see jazzband#1067)

Co-authored-by: Albert Tugushev <albert@tugushev.ru>
@atugushev atugushev added the annotations Related to packages annotations label Apr 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
annotations Related to packages annotations enhancement Improvements to functionality needs discussion Need some more discussion
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants