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
python 2 support #12
Comments
from readme:
there is not only a chance but there is work being put into porting to Python 2 I wonder if 3to2 could help |
@Pixiez ??? https://pythonclock.org/ Where is the place you are wasting time in porting libraries to Python 2 instead of finishing porting of whole project to Python 3? |
Shameless plug: https://pypi.org/project/lib3to6/ |
I started a proof of concept for python2.7 compatibility using I had to move the library into a src/ directory, and inline the helpers.py module, other than that the changes are mainly related to actual python2 compatibility issues, eg. Running
|
Thank you @mbarkhau, I encourage you to keep trying. Unfortunately the some features of Pampy won't be working in Python2 (dataclasses support, and default ordered dictionaries). To make it work you need to replace any pattern dictionary, into an Phython2 OrderedDict, otherwise precedence won't work. The fact you can use simple dictionaries {...} in pampy is because >=Python3.6 makes any dict an OrderedDict. So every |
Indeed. Swapping out the dictionaries in all failing tests to use
|
Sooo, do you think this is a viable path to go forward with?
Considering this, would you prefer to go forward with that effort rather than use this transpiler? One thing I can think of that might be an issue is the CI setup with travis. For my projects I use the gitlab CI, with a docker image that has both python3.6 and 2.7 installed. There I generate a wheel with the transpiled code using the 3.6 interpreter and test the wheel using the 2.7 interpreter. I'm not sure how to do that with travis. |
Mm I'm not actually working on it, I will remove that line. You have done a great job. But maybe you should just have two different projects, what do you think ? maybe people can pip install your fork if they need to use python2. I could link to it in the Readme. |
Sounds ok. Any name suggestions for the package? Maybe |
Looking over the documentation here https://pypi.org/project/backports/, it appears the recommendation would actually to have the import also be |
Well, here you go: https://pypi.org/project/backports.pampy/ $ pip install backports.pampy
...
Installing collected packages: backports.pampy
Successfully installed backports.pampy-0.1.10
$ ipython
Python 2.7.15 | packaged by conda-forge | (default, Oct 12 2018, 14:10:50)
...
In [1]: import backports.pampy as pampy
In [2]: pampy.__version__
Out[2]: u'0.1.10'
In [3]: from backports.pampy import match, HEAD, TAIL, _
In [4]: x = [1, 2, 3]
In [5]: match(x, [1, TAIL], lambda t: t)
Out[5]: [2, 3]
In [6]: match(x, [HEAD, TAIL], lambda h, t: (h, t))
Out[6]: (1, [2, 3]) |
Thanks @mbarkhau. |
hi there, thanks for writing pampy and it looks very interesting. at the moment, only python2 is possible in my work environment, may I ask if there is chance we can have this backport to python2? thanks
The text was updated successfully, but these errors were encountered: