repositories: deprecate default
option and introduce possibility to disable PyPI explicitly
#7430
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related-to: #6713
Motivation
While reviewing #6879, I figured out that there is a huge inconsistence between the implementation and the documentation of the
default
source (originally posted in #6879 (review)):default
, PyPI is only thedefault
if there is noprimary
, otherwise it'ssecondary
.default
is the highest priority. In other words, implicit PyPI always comes afterprimary
but is not always thedefault
.secondary
sources. It does not clearly say but implies that if there is no explicitdefault
, PyPI always is thedefault
. If you combine everything, it seemsprimary
sources should take precedence over thedefault
source (even if it's not PyPI).In my opinion, the documentation makes more sense, but changing the implementation to match the documentation is a breaking change because it puts the explicit
default
source from highest priority to lower than all primary sources.Thinking a bit about the problem, I came to the conclusion that we do not really need to explicitly specify a
default
source if we had another option to disable PyPI. Currently, specifying adefault
source has two effects:The second effect is not really required because you can achieve the same result by making the source the first one in pyroject.toml.
The first effect is kind of implicit and from an UI perspective probably shouldn't be coupled to a specific repository. That's why I think we should deprecate configuring sources as
default
and introduce an option to disable PyPI.Implementation details
default=true
for sourcespoetry source default
:--enable-pypi
,--disable-pypi
pyproject.toml: