[Distutils] setup_requires for dev environments
Chris McDonough
chrism at plope.com
Wed Mar 18 16:13:53 CET 2015
On 03/16/2015 02:53 PM, Daniel Holth wrote:
> No one should be asked to learn how to extend distutils, and in
> practice no one knows how.
>
> People have been begging for years for working setup_requires, far
> longer than I've been interested in it, and all they want to do is
>
> import fetch_version
> setup(version=fetch_version(), ...)
>
> Then they will eventually notice setup_requires has never worked the
> way most people expect. As a result there are too few setup.py
> abstractions.
FWIW, this particular use case (retrieving the version by importing it
or a function that returns it after it reads a file or whatever), is
dodgy. It's way better that code that needs version info inside the
package consult pkg_resources or some similar system:
import pkg_resources
version = pkg_resources.get_distribution('mydistro').version
I realize there are other use cases that setup_requires solves, and that
using pkg_resources can be a performance issue. I also realize that
people badly want to be able to "from mypkg import version" or "from
mypkg import get_version". But I'd try to come up with a different
sample use case for driving decision-making because IMO we should
dissuade them from doing that. Python packaging should be able to
provide them this information, they should not need to provide it
themselves.
- C
More information about the Distutils-SIG
mailing list