[Distutils] PEP 440 and direct references

Vinay Sajip vinay_sajip at yahoo.co.uk
Wed Jun 26 19:40:12 CEST 2013


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

> Hmm, you're right. So maybe it makes sense to declare that rather than be
> a particular kind of clause, a direct reference is instead an alternative
> to the entire version specifier system. That way it wouldn't allow
> composition with other clauses at all.

Another way to look at this is: the purpose of XXX in a requirement
'dist (XXX)' is to identify a specific version of "dist" to operate on. This
can happen in two ways:

* XXX is a direct reference - it identifies the version via URL, and no
  matching of any kind is required - that's the version required, plain and
  simple. If the resource is obtainable, then it's used, else it leads to an
  exception when an attempt to actually use it is made. In this case, the
  reason for constraining the form of the URL to a specific versioned
  source_url or wheel URL is twofold:
  
  (a) Repeatability (not possible with a generic "latest version" URL).
  (b) The ability to get the version represented by the URL, without doing any
      downloading, e.g. to see if a compatible version is already installed, or
      perhaps to see if it leads to any conflicts.

* XXX is a set of version constraints which is used when querying indexes to
  find the most recent version which matches the constraints.

According to this view, distlib does not need to provide specific support for
direct references (beyond what is already provided for secure downloads, wheels
etc.) - a direct reference is treated exactly the same as a single clause
"(== <version_determined_from_URL>)" for dependency resolution purposes. Of
course, distlib should extend the existing version matching support to cover
the additional cases in PEP 440 (such as explicit prefix matching and
compatible version matching).

Does that seem right?

Regards,

Vinay Sajip



More information about the Distutils-SIG mailing list