Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Vasiliy Faronov Newsgroups: comp.lang.python Subject: Depending on enum34 from a library Date: Sun, 24 Jul 2016 23:10:15 +0300 Lines: 28 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de Q8m/tkBo3yfoHCBGDyUXOQyIauGwqIRCXABj+lVlajFw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'url:pypi': 0.03; 'url:pipermail': 0.05; 'setup.py': 0.07; 'here?': 0.09; 'subject:library': 0.09; 'python': 0.10; '"just"': 0.16; '[1].': 0.16; '[2].': 0.16; 'dynamic,': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'skip:` 10': 0.18; 'all,': 0.20; 'library': 0.20; 'prevent': 0.20; 'third-party': 0.23; 'this:': 0.23; 'module': 0.25; 'install': 0.25; "doesn't": 0.26; 'message- id:@mail.gmail.com': 0.27; '[2]': 0.27; 'module.': 0.27; 'idea': 0.28; "i'm": 0.30; '[1]': 0.32; 'url:python': 0.33; 'surprised': 0.33; 'universal': 0.33; 'running': 0.34; 'received:google.com': 0.35; 'so,': 0.35; 'could': 0.35; 'installing': 0.35; 'replaced': 0.35; 'but': 0.36; 'url:org': 0.36; 'to:addr:python-list': 0.36; 'one,': 0.37; 'building': 0.38; 'sure': 0.39; 'subject:from': 0.39; 'enough': 0.39; 'url:mail': 0.40; 'to:addr:python.org': 0.40; 'where': 0.40; 'caused': 0.61; 'personally': 0.61; 'sound': 0.72; '2.7.': 0.84; 'url:distutils-sig': 0.84; 'shadow': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=TDra1EJKWLzEhCMovG8EsvgA4l4TIT3obrfDuvDAUEs=; b=UGv/G1hW272UlbAicOMMtsd9ERXxzHYpkjYi5bpzPEKXq2OUIj14Rz9b4xcMl8f7yE jhWuWb8VUbHrfkFH88Ks6c/MBsonJwcHIjT8jwwxIZ/BogN7bTYr0eWwHifxgsCoifQ0 YYEncRsKbELebOGvAI95BLGOQTEu93Ytk7V2vghwMT4kuA151gnZwL2jx7dUdPtNGyBS bBUkHEG0K+ajx6sFtnt6kNKMJ+MktWeobJ/bwrnZ+7G4z/Xu9ctyEp9ZFeEV3TbHtAOV DGttR+rNq15YGGCVI9EBL7bTvMWi9Sgb7S7/S+Ga5QUCcEciGmlN3FD6GhmBBTyHnK/M wf8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=TDra1EJKWLzEhCMovG8EsvgA4l4TIT3obrfDuvDAUEs=; b=Sk54ZV232Ng9MoRqgR0MslxOzgrHvdpXRwq06pqtDIZEXSsnJeGFsiZzo27oFktURZ 8Fqieztx8pqG8jJh2vrTPASHmZGu/mGscEir7kFyzX42hY/y8U6uSQgug4lJ/bcGWwaX x5iog5gb+nk5q0dW9sDeATdKmrwkij4SpyOPTyK1FXcf0Hay7Pa2Tcmz/YNNBU+oK4wo gakDQQClY4uSFj2IevbLOPrPm6eKgtvpISSwvInFgF4X5ehqoQ+uG7A7lckv9E9RZ+QI A0OAgh+bO9QR4Dri5v9m7t4y8bWpDtDadw/PhV/KJnHBnH85PhVHhsc2eqsipPz19IN9 IchQ== X-Gm-Message-State: AEkoouvqwY3ElSUaQRoYprG6rG7ITTgefwhRR5glPK/XlCdGhTlU4E9oG6u4YHe7gve5mCaYBYtjll/IqZv1Gg== X-Received: by 10.28.36.10 with SMTP id k10mr15954942wmk.33.1469391015732; Sun, 24 Jul 2016 13:10:15 -0700 (PDT) X-Mailman-Approved-At: Sun, 24 Jul 2016 16:10:46 -0400 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: Xref: csiph.com comp.lang.python:111836 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