Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PEP-0345 support #282

Closed
sirex opened this issue Dec 30, 2015 · 4 comments
Closed

PEP-0345 support #282

sirex opened this issue Dec 30, 2015 · 4 comments

Comments

@sirex
Copy link

sirex commented Dec 30, 2015

Hopefully PEP-0345 is the future of python packaging, moving away from setup.py to setup.cfg.

Some people already use PEP-0345 specification via d2to1.

My suggestion would be to support requires-dist as a replacement of requirements.in. Here is a sample from setup.cfg:

[metadata]
requires-dist =
    pytz
    Django
    django-environ
    django-allauth
    django-autocomplete-light
    django-bootstrap-form
    django-compressor
    django-libsass
    django-webtest
    pytest-django

It would be nice, if pip-compile could look if setup.cfg file exists and has [metadata] section in it. Then pip-compile could read list of packages from it and use instead of requirements.in.

Otherwise it could fall back to requirements.in.

@vphilippon
Copy link
Member

Given how things evolved, I will close this.

@exarkun
Copy link

exarkun commented Jul 9, 2019

How did things evolve? People are using setup.cfg. I am using setup.cfg. Why isn't it a good idea for pip-tools to be able to read setup.cfg? Or is it only not a good idea for pip-tools to be able to read [metadata]requires-dist from setup.cfg and other areas (eg [options]install_requires) might be a good idea?

@merwok
Copy link

merwok commented Jul 9, 2019

PEP 345 defines Metadata, not putting it in setup.cfg: that’s PEP 390 which is rejected.

tl;dr: pip-tools should/may read the same things that pip reads, there is no standard source for requirements.

More:

Instead of getting distutils2 as a replacement of distutils + setuptools + pkginfo + others, with settings read from setup.cfg and features to build, package, upload, download and install distributions, the current landscape is building on other PEPs to allow many tools to coexist, operating on shared specifications and interfaces.

There are many tools to go from source dir to built wheel; some may use setup.cfg, other pyproject.toml, other a Python script, etc. Inside the wheel, the metadata file follows PEP 345, and uses a machine-readable format that’s not specifically designed to be read or edited by humans. (The wheel filename also encodes some standardized bits of info regarding compatibility.)

But this doesn’t mean that build/install instructions become different and manual for each project: PEP 517 and PEP 518 allow you to use a «frontend» tool (pip is one, but hatch or dephell or conda can also implement the interface) that knows how to install and invoke the right build tool for each project.

Different tools (twine, flit) can take the wheel and upload it to various repositories (PyPI, TestPyPI, devpi private index).

Installers such as pip know how to download distributions from repositories, read the metadata and install it as defined in PEP 376, so that run-time tools can inspect installed dependencies.

Many tools used to be able to read their config from setup.cfg, as it was a file present in many Python projects and not too hard to edit. Then many tools added support for tox.ini, for the same reasons. Now pyproject.toml is becoming a new shared config file for development tools!

At the moment, every build tool defines its own way of reading dependencies; setup.cfg[metadata] is not standard, and the pyproject.toml spec only defines build-time dependencies, not run-time. So pip-tools should read the same thing that pip reads.

@exarkun
Copy link

exarkun commented Jul 9, 2019

Thanks for the explanation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants