Re: [Distutils] Limit package installation to a specific Python version
Hi all, On Fri, Jan 20, 2017 at 2:56 PM, Nathaniel Smithwrote: > On Fri, Jan 20, 2017 at 1:56 PM, Lele Gaifax 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
Re: [Distutils] Limit package installation to a specific Python version
Great, thank you Nathaniel! -- nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia. l...@metapensiero.it | -- Fortunato Depero, 1929. ___ Distutils-SIG maillist - Distutils-SIG@python.org https://mail.python.org/mailman/listinfo/distutils-sig
Re: [Distutils] Limit package installation to a specific Python version
On Fri, Jan 20, 2017 at 1:56 PM, Lele Gaifaxwrote: > 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? > > An user proposed[1] to change the classifiers of a package to get that result, > so I tried looking at pip and setuptools sources, but didn't find evidence of > that. I see both use python_requires[2] in their setup that seem closer to the > goal, but again, is that actually honored by pip and/or other installers? > > Thanks for any hint, > ciao, lele. > > [1] https://github.com/python-rapidjson/python-rapidjson/pull/47 > [2] https://www.python.org/dev/peps/pep-0345/#requires-python Neither pip nor conda do anything automatically with trove classifiers. Conda uses its own metadata added when the conda package is built; whoever runs your conda-build can probably figure something out. Wheels have always had this metadata and pip has always honored it. 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 -n -- Nathaniel J. Smith -- https://vorpus.org ___ Distutils-SIG maillist - Distutils-SIG@python.org https://mail.python.org/mailman/listinfo/distutils-sig
[Distutils] Limit package installation to a specific Python version
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? An user proposed[1] to change the classifiers of a package to get that result, so I tried looking at pip and setuptools sources, but didn't find evidence of that. I see both use python_requires[2] in their setup that seem closer to the goal, but again, is that actually honored by pip and/or other installers? Thanks for any hint, ciao, lele. [1] https://github.com/python-rapidjson/python-rapidjson/pull/47 [2] https://www.python.org/dev/peps/pep-0345/#requires-python -- nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia. l...@metapensiero.it | -- Fortunato Depero, 1929. ___ Distutils-SIG maillist - Distutils-SIG@python.org https://mail.python.org/mailman/listinfo/distutils-sig
Re: [Distutils] Has anyone looked at bug 29225?
Den 20 jan. 2017 6:32 em skrev "Brett Cannon": > > Oh, over the 26 years of Python's lifetime you would be surprised what people come to rely on (including broken semantics which they have written fixes for themselves which then break when a proper fix is introduced). I can imagine, perhaps I shouldn't have been so confident :) Hopefully if people have put in their own workarounds, they'll be happy to be able to drop them, but who knows, heh. Elvis > > On Thu, 19 Jan 2017 at 10:01 Elvis Stansvik wrote: >> >> 2017-01-19 18:52 GMT+01:00 Brett Cannon : >>> >>> It's probably a combination of people being busy and the fact that it involves distutils which not very many people feel comfortable reviewing patches for and changing its semantics. >> >> >> Alright, that's understandable and sort of what I suspected. >> >> I hope (and believe) my patch preserves the semantics for all cases except the specific one it fixes. The wrong behavior which it fixes is so obviously wrong that I can't imagine someone relying on it somehow :) >> >> Elvis >> >> >>> >>> >>> Regardless of what happens to your patch, though, thanks for taking the time to report the problem you ran into and trying to fix it! >>> >>> On Wed, 18 Jan 2017 at 23:21 Elvis Stansvik < elvis.stans...@orexplore.com> wrote: Hi distutils folks, Just wanted to ask if anyone has had time to look at my http://bugs.python.org/issue29225 ? It's my first bug report _and_ first patch for Python, so it's quite possible I screwed something up. Or people are just busy :) Cheers, Elvis ___ Distutils-SIG maillist - Distutils-SIG@python.org https://mail.python.org/mailman/listinfo/distutils-sig ___ Distutils-SIG maillist - Distutils-SIG@python.org https://mail.python.org/mailman/listinfo/distutils-sig
Re: [Distutils] Has anyone looked at bug 29225?
Oh, over the 26 years of Python's lifetime you would be surprised what people come to rely on (including broken semantics which they have written fixes for themselves which then break when a proper fix is introduced). On Thu, 19 Jan 2017 at 10:01 Elvis Stansvikwrote: > 2017-01-19 18:52 GMT+01:00 Brett Cannon : > > It's probably a combination of people being busy and the fact that it > involves distutils which not very many people feel comfortable reviewing > patches for and changing its semantics. > > > Alright, that's understandable and sort of what I suspected. > > I hope (and believe) my patch preserves the semantics for all cases except > the specific one it fixes. The wrong behavior which it fixes is so > obviously wrong that I can't imagine someone relying on it somehow :) > > Elvis > > > > > Regardless of what happens to your patch, though, thanks for taking the > time to report the problem you ran into and trying to fix it! > > On Wed, 18 Jan 2017 at 23:21 Elvis Stansvik > wrote: > > Hi distutils folks, > > Just wanted to ask if anyone has had time to look at my > > http://bugs.python.org/issue29225 > > ? It's my first bug report _and_ first patch for Python, so it's quite > possible I screwed something up. Or people are just busy :) > > Cheers, > Elvis > ___ > Distutils-SIG maillist - Distutils-SIG@python.org > https://mail.python.org/mailman/listinfo/distutils-sig > > ___ Distutils-SIG maillist - Distutils-SIG@python.org https://mail.python.org/mailman/listinfo/distutils-sig