This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Make packaging.install API less confusing and more extensible
Type: enhancement Stage: resolved
Components: Distutils2 Versions: Python 3.3, 3rd party
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: alexis Nosy List: alexis, eric.araujo, tarek
Priority: normal Keywords:

Created on 2012-05-29 10:47 by alexis, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
install.py alexis, 2012-06-05 14:14 The new install.py file.
Messages (4)
msg161868 - (view) Author: Alexis Metaireau (alexis) * (Python triager) Date: 2012-05-29 10:47
The "packaging.install" module doesn't have a clear API defined and it's doing a lot of indirections between all the functions to get metadata, fetch the dependencies and install what's need to be installed.

We might be able to come with a better solution for the API we expose there, and to allow easier maintenance. I'll go ahead this week and propose a change to this module which hopefully will make things clearer.
msg162042 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-06-01 02:51
To summarize the high-level API needed: install from an index (argument is a version requirement as string), install archive file, install from directory (containing setup.cfg or setup.py).

When #8668 is implemented, an “editable” option will be nice too.  (Need to check pip doc and use cases to see if only the install from directory should get it.)

For the implementation, as discussed on IRC we want to go with classes to represent the various kinds of installable things (requirement, path to a file, path to a dir) and one or more high-level functions to wrap them for common cases (see Nick’s good article http://www.boredomandlaziness.org/2012/05/djangos-cbvs-are-not-mistake-but.html ).  I would prefer having two functions, one that takes a version req and another one that takes a path; it’s easy to distinguish between file (archive) and directory but I don’t like guessing between name and path (see the not-cool code in pysetup actions).
msg162043 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-06-01 02:52
BTW I suggest you work off a d2 checkout; I have not ported all changes from Montreal sprints to cpython/p7g at the moment.
msg162346 - (view) Author: Alexis Metaireau (alexis) * (Python triager) Date: 2012-06-05 14:14
Attaching a work in progress file which intend to replace the current install.py file. The implementation isn't finished yet but the overall design is here.

It comes with four classes:

- Installer which manages the overall installation procedure. It shares a distribution cache with the dependency handler so distributions are not downloaded / extracted multiple times. The installer is able to install / remove single distributions OR distributions with their dependency tree.
- DependencyHandler which takes care about getting the dependencies from either the metadata stored in the indexes or inside the distirbutions.
- The DistributionCache class is just a store containing the location of the distributions that had been extracted/downloaded. It provides methods to ease the work with them (so any external user don't need to care about the state of the distribution when requesting it).
- DirectoryMover provides a way to deal with moving/deleting operations with a commit/rollback API. The goal is to simplify a lot the current API and to provide a reusable tool for other installers. why not putting this in shutil at some point.

This file is provided here mostly for feedback, but the work is not finished yet.
History
Date User Action Args
2022-04-11 14:57:30adminsetgithub: 59155
2014-03-13 04:40:58eric.araujosetstatus: open -> closed
resolution: out of date
stage: resolved
2012-06-05 14:14:14alexissetfiles: + install.py

messages: + msg162346
2012-06-01 02:52:48eric.araujosetmessages: + msg162043
title: packaging.install does not have a clear API. -> Make packaging.install API less confusing and more extensible
2012-06-01 02:51:27eric.araujosetnosy: + eric.araujo

messages: + msg162042
versions: + 3rd party
2012-05-29 10:47:26alexiscreate