Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #111836
| From | Vasiliy Faronov <vfaronov@gmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Depending on enum34 from a library |
| Date | 2016-07-24 23:10 +0300 |
| Message-ID | <mailman.98.1469391048.22221.python-list@python.org> (permalink) |
| References | <CALHHdhyBHnzaHo8T+QGCFpkgCWN=+yZcfDKnHSx5pcGYACWvYw@mail.gmail.com> |
Hi all, I'm building a Python library where I want to use Python 3.4-style enums. Because I need to support Python 2.7, I'm considering using enum34 [1]. But I'm not sure how to do this: If I simply depend on enum34, it will install a module named `enum` even in Python 3.4+ environments, and that could shadow the stdlib module. Personally I would be very surprised if installing a library caused an unrelated stdlib module to be replaced with a third-party one, even if it's "just" a backport. However, in my environments, `sys.path` is such that stdlib comes before site-packages -- perhaps this is normal enough that I can rely on it? Or I could change my setup.py to include enum34 in `install_requires` only if running on Python 2.7. But that will make my distribution's metadata dynamic, which doesn't sound like a good idea [2]. At the very least, I think it will prevent me from building a universal wheel. So, what's the best current practice here? [1] https://pypi.python.org/pypi/enum34 [2] https://mail.python.org/pipermail/distutils-sig/2009-July/012826.html -- Vasiliy
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Depending on enum34 from a library Vasiliy Faronov <vfaronov@gmail.com> - 2016-07-24 23:10 +0300
csiph-web