-
-
Notifications
You must be signed in to change notification settings - Fork 611
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
Direct references show extra requirements in .txt files #1582
Direct references show extra requirements in .txt files #1582
Conversation
6635a0f
to
65d4904
Compare
Thanks! Yes, the extras should be included. A similar fix is sitting in #1329, not yet reviewed by @atugushev: extras = f"[{','.join(xtr for xtr in sorted(ireq.extras))}]" if ireq.extras else ""
return (
f"{canonicalize_name(ireq.name)}{extras} @ "
f"{ireq.link.url_without_fragment}"
f"{fragment_string(ireq, omit_egg=True)}"
) but there I did not normalize the extra names, where you do convert to lower case. I'd like to know:
|
I forgot when I wrote that last comment that extra names are not at all package names, so we do NOT want to use canonicalize names on it. I guess I'd just like to see that any normalization is needed at this place. FWIW I just tested with #1329 an input file that specified an extra as |
Hello @AndydeCleyre ! I remember your PR in #1329 but I was thinking, since mine is a small fix, that it could be merged quickly. Regarding the normalized names in the extras, I double-checked and |
Makes sense, and thanks again, as your feedback was central to getting that "right." I won't close this, but also hope the big one gets merged soon. I will fix it up with your suggested change very soon I think. |
Sounds good. Also if you have any good starter task to give, let me know and I'll happily contribute to the project. |
@FlorentJeannot According to this discussion #1453 (comment) I thought that we agreed to not include extras once requirements have been complied? |
@atugushev Sorry, it was not clear to me that my thinking was agreed or if it would be fixed later by @AndydeCleyre's PR (#1329). I guess we have two solutions:
Another question: Since @AndydeCleyre's PR contains the fix too, should we remove it there (so we don't bring more confusion by restoring the extras and then removing them)? Or should we make a PR now which removes them, so that @AndydeCleyre can merge this change and tweak his PR? |
I'm not convinced we should strip extras from the output, FWIW. The fact that pip freeze doesn't include the extras notation isn't necessarily a positive example, as the whole point of pip tools is that freeze is insufficient and too lossy with information for our needs. |
@AndydeCleyre While I agree
When I do Also what if package Let's say package |
I honestly don't understand the example but want to point out in this discussion that some packages use extras to describe dependencies that are then detected during installation, affecting the installation procedure. If the relevant deps are just present in EDIT: See #992 for some relevant discussion |
It would be great to have this, or #1329, or any other solution for extras soon. I currently am having issues using pip-compile in a project requiring Celery with the "sqs" extra, because "Celery[sqs]" requires "kombu[sqs]" but pip-compile keeps only "kombu" for the sub-dependency :( |
@atugushev What is your opinion on this one? The way extras work (or not) makes me want to discourage their use, especially in result of pip-compile. Does everyone know that you can feed any typo to as an extra and pip will not complain? This proved to be a permanent source of problems as projects add/remove/rename extras over time. I also have to confess that I am only using pre-commit to build constraints files, so I never want to see extras in them as the spec forbids them. That means that I should let others decide. |
FWIW, for my use case (properly installing "Celery[sqs]"), it would be fine if the output of pip-compile would include all of the required sub-dependencies without the extras. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've polished the PR slightly. Thanks @FlorentJeannot for your contribution!
I am adding the missing extra requirements for direct references. I think it's better to keep consistency with how the rest of pip-tools works.
Refs #1613.
Contributor checklist
Maintainer checklist
backwards incompatible
,feature
,enhancement
,deprecation
,bug
,dependency
,docs
orskip-changelog
as they determine changelog listing.