[Distutils] PEP 440 and direct references

Vinay Sajip vinay_sajip at yahoo.co.uk
Wed Jun 26 00:46:54 CEST 2013


Nick Coghlan <ncoghlan <at> gmail.com> writes:

> While the intended use case is to pin a specific version, you could also
> use a more general "latest" link and use other clauses to trigger an
> error when the version changes beyond what you expect.
> 
> It's mostly because I don't think it's worth the hassle of banning such
> combinations, though.

My question arose from thinking about how you would implement matching in
cases where multiple such clauses arise. The only thing that seems to make
sense is that URLs in "is" clauses must conform to the source URL format
specified in PEP 426, or refer to wheels - either one allows a version
number to be unambiguously derived from the URL itself. That qualification
on allowable formats for URLs is not made in the "Direct Reference" section,
but perhaps it should be. However, your comment above about generic "latest"
links has confused me. If you can't figure out the version from the URL itself,
surely making matching decisions would require downloading the URL resource
and inspecting its contents?

> I'm guided by the fact that pip and similar tools all allow direct references
> in requirement files. This is aimed directly at providing a standard, command
> line friendly notation for such references, rather than requiring the
> information be conveyed out of band.

Okay, but in those cases, aren't we dealing with a single clause for a
particular distribution (i.e. a single "is clause" with no others), usually
referring to a local "editable" project or a VCS checkout? If we have a
specification "is URLA, is URLB", then unless URLA and URLB are equivalent in
terms of the version they represent, both can't match, or is there some way
that I've missed where they can?

> Most of PEP 426/440 are about the shiny, happy packaging utopia we're trying
> to create. This feature is aimed squarely at the messy world of the system
> integrator.

I get that, but I'm assuming that there should be support in distlib for this
matching logic, and thinking about how to implement it is where I'm coming
from.

> It is already - none of the other clauses allow the trailing wildcard as
> legal syntax.

Okay, I wanted to make sure that was the intention.

> Prefix matching is intended for cases where the prefix is shorter than
> constraints in other clauses. For example, "~= 1.3" means ">= 1.3, == 1.*",
> which is not the same thing as "== 1.3.*".

OK, I see. Thanks for the answers.

Regards,

Vinay Sajip



More information about the Distutils-SIG mailing list