python package management confusion

Oscar Benjamin oscar.j.benjamin at gmail.com
Sun Jan 20 15:38:02 EST 2019


On Sun, 20 Jan 2019 at 16:22, dcs3spp via Python-list
<python-list at python.org> wrote:
>
> On Saturday, 19 January 2019 11:17:19 UTC, dcs3spp  wrote:
> >
> > My question is, can setuptools be configured to pull in child from a separate git repository when running python setup.py develop from parent folder? I have since found and tried this approach at https://stackoverflow.com/a/53706140/8325270
> > It appears that later versions of setuptools can install via a PEP508 url. I currently trying to investigate this approach…..
>
> After trying PEP508 url approach my conclusions are as follows.
>
> A PEP508 url for a git repository can be used in *install_requires* of *setup.py*. An example is listed below.
> ```
> requires = [
>     'parent',
>     'kinto-http at git+https://github.com/Kinto/kinto-http.py',
> ]
> ...
> install_requires=requires
> ```
> The package can then be installed with pip, using ```pip install -e . or pip install .```
>
> However, installation with setuptools is then broken, i.e. ```python setup.py develop``` and ```python setup.py install``` fails. setuptools looks for packages in pypi indexes. To install using setuptools a devpi index would have to be installed and configured or packages would have to installed from a paid for pypi repository in the cloud. Alternatively, developers could manually install each private package dependency individually, prior to running ```python setup.py develop``` for the source package. Unless, there are other alternative(s) such as zc.buildout with mr developer plugin etc.....
>
> If I want to have a Python private project, referencing other private project(s), available under source control and CI via gitlab.com, it seems that I can use the pip approach with PEP508 or use a requirements.txt file containing the git projects referenced as PEP508 urls, i.e. ```pip install -r requirements.txt```.
>
> Confusion, stems from the fact that pip and setuptools dependencies are then not synchronised, i.e. setuptools will break if PEP508 urls are listed for install_requires. Presumably the approach is to use either pip or setuptools but not both?

I'm not sure what you mean by pip and setuptools not being
synchronised. Pip depends on setuptools and cannot be used without it.
Both setuptools and pip are maintained under the PyPA. They are
intended to work together. in fact if your setup.py uses distutils
instead of setuptools then pip will "inject" setuptools into it to
ensure that meets pip's needs.

You will need to be more specific about which commands you are using
and what it is that becomes unsynchronised.

--
Oscar



More information about the Python-list mailing list