-
Notifications
You must be signed in to change notification settings - Fork 0
Draft review for default extras PEP #1
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
Conversation
f6b4061 to
f202ac8
Compare
|
@pfmoore - thank you for taking a look at this already! I'll have a think about the two comments you left, and I was curious if you had any thoughts on the second alternative I just added in my last commit? Essentially I am wondering if we should leave it up to tools such as pip to provide a way to ignore default extras (when they also add support for supporting the default extras), as this would avoid the complexity of adding a new syntax in the package specification. |
|
Strong -1 on making it something tools have to do. There's already too many options, both in pip and in |
|
To be honest, I think that in its current form, this PEP fails to cover the discussions that happened on the Discourse thread. You'll need to cover all the possibilities raised there before this is ready for submission - at a minimum, putting the various proposals that were made into the "Rejected Alternatives" section, and explaining what is wrong with them and why (in your opinion) your proposal satisfies the relevant use cases better. |
|
@pfmoore - sounds good, now that I have a skeleton I think I'll go through the discussion more systematically. Thanks for this initial review and feedback, it is very helpful! |
627233d to
e499678
Compare
|
@pfmoore - I have spent a few hours combing through the long discuss.python.org thread as well as several of the GitHub threads referred to, and have now tried to boil it down to the rejected alternatives in the latest version of this PEP. If you have time at some point I would be grateful if you could let me know if this is on the right track in your opinion. |
|
I'm also going to ping @RonnyPfannschmidt, @pradyunsg and @DEKHTIARJonathan as people who were specifically interested in writing/contributing to a PEP - please let me know if you'd like to join as authors, or either way if you have any feedback on this initial draft so far! |
peps/pep-tbd.rst
Outdated
| Disabling all default extras | ||
| ---------------------------- | ||
|
|
||
| One idea was to allow a special syntax to disable all default dependencies, |
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.
in my proposal i pososed a special form of package[-, explicit ,list, of, extras] as canonical form
the singular - denoting that default extras ought not to be considered for that particular requirement specifier
|
a key hinge on moving my proposal forward was how to get backward compatibility with non-default-extra aware installers multiple libraries i was working on would be "in hells kitchen" if they where just migrated to default dependencies without a way to ensure legacy installers supporting it |
|
It would be interesting to add in the rejected ideas section, why making the |
|
@abravalheri good idea, could you say in a few words why it would not be viable in your opinion? |
|
Hi @astrofrog , I don't know why not. That is why I was asking 😅. That approach does not allow you to have a negative extra syntax, but allow you to have an extra that when specified exclude dependencies. For example: dependencies = ["dep; extra != 'minimal']pip install mypkg[minimal]which has a very similar overall effect and could be used in similar usecases. |
|
@abravalheri - this would be nice but does it actually work for you? I just tried it in a real package and even when specifying Or are you suggesting that getting that to work somehow would be the alternative solution? |
|
Exactly, that does not work now. But it would be an alternative change (many people do try that approach intuitively and are disappointed by the results), so it would be interesting to understand why one alternative is prefered to other in the rejected ideas section. |
|
@astrofrog thanks for starting this, I'll be happy to co-author this with you if you need help and help you find a PEP sponsor if needed. I think you're taking the requirement of this PEP a bit too far and it can be "greatly reduced" and consequently improved in its likelihood to be merged. I would summarize the proposal as follows:
In my opinion, keep it to the "core of the proposal" => providing a set of "optional dependencies" by default, unless some other set is required. CC: @ethanhs-nv |
|
@DEKHTIARJonathan - thanks for the feedback! Note that currently the meat of the proposal here is actually quite concise and many of the sections (including the empty string extras_require) are in rejected alternatives (note that None is also not an option as in the package metadata there is no difference between Python None and string None, and someone somewhere may have used None already as a valid extras name). The approach here (basically defining Default-Extras and defining a - syntax in extras lists) seemed to be the broad consensus of the discuss thread? |
|
@astrofrog I think your example can be improved I think we have a few much better use-cases: backends. These are prime examples of this "scenario" and probably the most interested parties. A default "lightweight - simple" backend unless you ask for a backend larger/more specific. |
@RonnyPfannschmidt - is it correct that legacy installers would be fine with If it is correct that legacy installers would be fine and ignore |
Ok sounds good, I'll try and write something up about this once I've had a chance to think about whether/why we can't do it |
|
@RonnyPfannschmidt - I also wanted to say that if you have an advanced draft that you think would be a better starting point than the one here, I'd be happy to switch over, so just let me know! (EDIT: just found RonnyPfannschmidt#1, sorry I missed this somehow!) |
No I absolutely don't think it was a consensus. It's what 1 person ( Pradyun ) mentioned. Then we brainstormed a bit about the idea. However this is an entirely new idea, syntax and concept. To me it doesn't have it's place here, it's ortogonal to "having default extra": one can live without the other. This specific point adds a lot of complexity to the entire proposal, is far from being intuitive and introduce MANY corner cases. I'm not in favor in adding it here. I think the proposal should be simple: A. If no B. If any extra is demanded => ignore the default, behave exactly like today C. We could consider adding |
|
@DEKHTIARJonathan - if we introduce a way to have default extras, we probably also need to provide a way to opt out of these, right? Otherwise aren't these just equivalent to moving the dependencies to |
No that's not how it should work. If you buy a car which by default is
When in python you do def say_hello(name="Jack"):
print(f"Hello {name}")You don't "remove the default value" and add the value you want. The default value is only selected if you don't provide one. I don't see why this should be any different. It's a "default extra-require" not a "mandatory-that-you-can-remove" |
|
@warsawnv @DEKHTIARJonathan @vyasr - thanks for the detailed reviews! I have just pushed some changes - the main ones are:
There are some smaller changes motivated by comments in the reviews above. I believe all comments have been addressed or resolved above, but let me know if you feel I missed anything! |
|
I've updated the preview at https://astrofrog.github.io/peps/pep-9999/ |
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 left a number of small changes to improve wording and style, but overall the content looks great to me now. Sorry that it took me so long to get around to a re-review.
| ========== | ||
|
|
||
| Various use cases for default extras and possible solutions in this PEP were discussed | ||
| extensively on `this DPO thread <https://discuss.python.org/t/adding-a-default-extra-require-environment/4898/38>`__. |
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.
Is it worth listing other potential use cases without the same level of elaboration as the two below, or do you think that would simply muddle the proposal without adding any value?
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 think that the two use cases I mentioned actually cover most of the ones I saw in the various discussions - the second discussion on multiple front-ends or backends is broad enough to cover several cases that were mentioned such as having different computational backends, or different GUI frameworks and so on. I have reworded this to say:
Various use cases for default extras and possible solutions in this PEP were discussed extensively on this DPO thread. These fall into two broad cases that that provide the motivation for the present PEP.
to not make it sound like I just cherry picked two use cases and ignored others. The two use cases here are a synthesis of the different cases I saw in the discussion. However if anyone would like to bring up another distinct use case, I'd be happy to add it!
| as well as in numerous issues and pull requests. The solution that will be | ||
| presented below may not be everyone's preferred approach from a philosophical | ||
| point of view, however it appears to be the best compromise as it is the only | ||
| solution to a very real problem that would not break backward-compatibility of | ||
| packaging infrastructure in any significant way. It is an opt-in solution which |
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 haven't been involved in the prior conversations so perhaps I didn't see the discussions that led to this acknowledgment, but naively it doesn't seem like it adds much here. If you're concerned about getting philosophical pushback from particular reviewers though feel free to keep it.
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.
Let's just say there has been some philosophical pushback 😅 - obviously I'd be happy to remove this if people object to including it, but until we get to the point where we have some kind of consensus, it might be safer to keep.
Co-authored-by: Vyas Ramasubramani <[email protected]>
|
@vyasr - thank you for the review! |
|
I have updated the preview for anyone wishing to read over this now: https://astrofrog.github.io/peps/pep-9999/ |
8abb547 to
04c201f
Compare
pradyunsg
left a comment
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.
A few comments. Let's file a PR against python/peps once these are resolved -- let's get to a d.p.o thread soon. :)
| .. code-block:: toml | ||
|
|
||
| [project] | ||
| default-optional-dependencies = [ |
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'm not a huge fan of this name, since this is listing the keys under optional-dependencies rather than PEP 508 strings. OTOH, I think we can pick the bike shed color in the d.p.o. thread. :)
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.
Yes I see what you mean - I have no strong opinion here and happy to update it if someone comes up with a better suggestion.
peps/pep-9999.rst
Outdated
| How to teach this | ||
| ================= | ||
|
|
||
| The simple rule above regarding only installing default extras when no 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.
Suggestion: Follow the guidance in https://justsimply.dev and removing the use of "just" / "simple" and similar words from this entire PEP.
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.
Done, I have checked for these and other similar words
| Adding a special entry in ``extras_require`` | ||
| -------------------------------------------- |
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 think this section should cover why "default" is not a good name for the special entry here.
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 have made a tweak to this section to change:
In addition, no other string can be used as a special
string since all strings that would be a backward-compatible valid extras name
may already be used in existing packages.
to
In addition, no other string (such as 'default') can be used as a special
string since all strings that would be a backward-compatible valid extras name
may already be used in existing packages.
Hopefully this addresses your comment?
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 can't click the resolve button) Yes. :)
|
@pradyunsg - thank you for the review and for officially agreeing to sponsor this! Could you confirm once you are happy that your comments are addressed, and I can go ahead and open a PR to the main PEP repo? One small technicality I don't quite understand - in the PEP submission guidelines it says that I should pick a number for the PEP when submitting the PR which is neither used in the repo or in an existing open PR. However, it also says 'Once approved, they will assign your PEP a number' (about the PEP editors). Is it that I should attempt to pick a valid number and that after their review process they confirm whether the number is ok or whether to use another one? |
|
Another question is whether you think I should open PRs with a reference implementation and adding the links here before opening the PR to the main PEP repo, or whether it is premature to do this? (I have a WIP branch getting this to work with flit and pip) |
Yup, you can pick the next available PEP number (currently 790, I think?) and if two PRs use the same number for different content, the PEP editors will provide guidance to resolve the conflict. :)
Neat! I'd say it'd be best link to your branches from the initial PEP draft, that is submitted to the main PEPs repo. It doesn't need to be a PR to flit/pip right now, and a PoC "look, it works" would be better for initiating the discussion (I'm partly concerned about the discussion spreading across to happen on the PRs rather than just the d.p.o thread).
Yup! Also, please go ahead and add links to the draft implementations in pip/flit, if you're OK with the approach suggested above before filing the PR. |
|
@pradyunsg - thanks! That all sounds good 😄 |
|
@pradyunsg - I've now opened a PR to the PEP repository in python#4198 Thanks everyone for all your comments and helping make it to this stage! |
|
If anyone is interested, I've now populated the reference implementation section with links to flit/pip forks which seem to work. |
|
@astrofrog can we make the reference implementation installation : |
|
Well the implementation needs forks of pip and flit so I'm not sure if we can make it easily installable like this? |
|
@astrofrog it's possible I'm working on it. Gimme a few days |
|
I am going to close this as the PEP is now published (and undergoing some updates in a separate PR). Thanks everyone for the discussion on here! |
This is a PR internal to this fork for initial collaboration on the PEP - leave comments/suggestions or open PRs to my branch to suggest changes/additions!
Preview: https://astrofrog.github.io/peps/pep-9999/
Motivating discussion: https://discuss.python.org/t/adding-a-default-extra-require-environment/4898/152