[Distutils] Upcoming changes to PEP 426/440

Vinay Sajip vinay_sajip at yahoo.co.uk
Thu Jul 4 21:38:25 CEST 2013


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

> The main benefit is that all the dependencies for an extra will typically
> be in one place.
> However, I briefly forgot the "machine readable" part again, and for that
> TOOWTDI is to have one entry per dependency.

One record per dependency is indeed the case at the RDBMS level, but there's
no reason why that scheme needs to be slavishly copied over to the JSON. Let
me try to illustrate this.

I couldn't find any modelling code in Donald's public repo - I checked both
branches and couldn't find it (Donald, please point me to it if it's on
GitHub rather than just your local clone). So I knocked up a simple model
(using SQLAlchemy, but the model is so simple that just about any ORM should
do). The entities are Project, Release and Dependency. I've created a simple
script, depmodel.py, along with two JSON files which have the relevant
subset of the PEP 426 metadata for setuptools 0.7.7 and Pyramid 1.4.2. These
are available at

https://gist.github.com/vsajip/5929707

This code/data uses the older schema (run_requires / run_may_require, etc.
and using 'dependencies' rather than 'install' as a key). This is the JSON
which is supposed to be problematic, so I wanted to see what the problems
might be. I couldn't find any, so I'm linking to the code here so that
Donald/Nick can point out any misunderstanding on my part.

The script allows importing the dependencies from JSON to RDBMS (34 lines
for the import function) and also exporting from RDBMS to JSON (43 lines for
the export function). I've used SQLite for the database.

python depmodel.py -i setuptools-0.7.7.json

will read the dependencies into SQLite, and

python depmodel.py -e setuptools/0.7.7

will print the SQLite records as JSON.

I understand that people might have particular preferences, but I can't see
any technical reason why we couldn't have lists in the JSON. The import and
export code looks pretty simple to me. What have I missed?

Regards,

Vinay Sajip



More information about the Distutils-SIG mailing list