Hi all, On Fri, Jan 20, 2017 at 2:56 PM, Nathaniel Smith <n...@pobox.com> wrote: > On Fri, Jan 20, 2017 at 1:56 PM, Lele Gaifax <l...@metapensiero.it> wrote: >> Hi all, >> >> do installers like pip and conda consult trove classifiers, or more generally >> is there a way to "mark" a package published on PyPI as installable only in a >> Python 3 environment? >>
> For sdists, historically there was no way to do this, but as of a > few months ago this was fixed and pip now *does* honor > python_requires, and PyPI has been updated to expose this information > so pip can see it before downloading the sdists: > > https://github.com/pypa/pip/pull/3846 > https://github.com/python/peps/pull/56 > https://github.com/pypa/pip/pull/3877 > > Since this is a pretty recent change, you probably want to put a > runtime check inside your setup.py for old Python versions, so if > someone uses an old version of pip then they will at least get a nice > explanation. > > IPython's an example of a python-3-only project that uses this > belt-and-suspenders approach: > > https://github.com/ipython/ipython/blob/f060158665189fd456e54a5a864080efe28b4fdf/setup.py#L29 > https://github.com/ipython/ipython/blob/f060158665189fd456e54a5a864080efe28b4fdf/setup.py#L248 > I'm also in the (slow) process of writing the various step you can take when python_requires is not honored by older systems and how to mitigate that: https://github.com/python3statement/python3statement.github.io/pull/55 Feedback (and help) would be welcome. In particular only system where pip 9.0+ is installed will understand the metadata now exposed by PyPI, so when/if you fail in your setup.py, a useful tip is to ask user to upgrade pip. There should be some snipets of code you copy and past in your setup.py in this PR as well. Thanks. -- M _______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org https://mail.python.org/mailman/listinfo/distutils-sig