Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

should migrate to Enum class #62

Open
mtholder opened this issue Nov 21, 2014 · 3 comments
Open

should migrate to Enum class #62

mtholder opened this issue Nov 21, 2014 · 3 comments

Comments

@mtholder
Copy link
Member

There are some "fake" enum classes in peyotl. I just found out that you can import py3 enums in py2.7 with the enum34 package.
We should migrate to using that for the sake of internal consistency.

@jimallman
Copy link
Member

This migration to enum34 was done some time ago, and it's been problematic. Now in testing devtree, it seems our pinned version 1.1.8 is no longer working (doesn't expose module enum to python2.7):

deploy@ip-172-30-1-156:~/venv_web2py$ bin/python
Python 2.7.18 (default, Mar  8 2021, 13:02:45)
...
>>> import peyotl
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/deploy/repos/peyotl/peyotl/__init__.py", line 30, in <module>
    from peyotl.phylo.entities import OTULabelStyleEnum
  File "/home/deploy/repos/peyotl/peyotl/phylo/entities.py", line 2, in <module>
    from enum import Enum
ImportError: No module named enum
>>>
deploy@ip-172-30-1-156:~/venv_web2py$ bin/pip show enum34
...
Name: enum34
Version: 1.1.8

Upgrading enum34 to 1.1.9 or 1.1.10 allows importing peyotl, but might cause another bug that led to us pinning it to 1.1.8.

According to the original enum34 author, their newer aenum is now recommended instead. @mtholder Shall we try aenum in peyotl and consider modifying its requirements and setup files?

@mtholder
Copy link
Member Author

hmmm. Frustrating. In particular because enum is in the standard library in python 3, so we won't need this for long.

It looks like https://pypi.org/project/enum/#description might be the most lightweight replacement as it bills itself as a way to make code more robust. But I suspect that aenum would be fine too.

@jimallman
Copy link
Member

I've tested a simpler solution that seems to work, installing enum34==1.1.10 for older python and skipping it for newer:

'enum34==1.1.10; python_version < "3.4"'

This change is in both requirements.txt and setup.py:
244e7a2
86fb4ae

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants