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

Python 3 support #199

Closed
asmaps opened this issue Feb 22, 2016 · 7 comments
Closed

Python 3 support #199

asmaps opened this issue Feb 22, 2016 · 7 comments

Comments

@asmaps
Copy link

asmaps commented Feb 22, 2016

Hi,

I just tried to install napalm with python 3, but it stopped, because it looks like at least ncclient is currently not py3 ready.

(...)

Collecting ncclient (from napalm==0.51.0->-r requirements.txt (line 10))
  Downloading ncclient-0.4.7.tar.gz (60kB)
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "/tmp/pip-build-dwk2x98e/ncclient/setup.py", line 24
        print "Sorry, Python 3 is not supported (yet)"
                                                     ^
    SyntaxError: invalid syntax

They say, that from the next version on it will be py3 compatible (compare https://github.com/ncclient/ncclient#important---python3-support ). Are there other known blockers for py3?

@asmaps
Copy link
Author

asmaps commented Feb 22, 2016

I now installed ncclient in the py3 compatible version (pip install -e git+https://github.com/ncclient/ncclient.git#egg=ncclient). Also I needed a py3 compatible version of gtextfsm which can be installed like this: pip install -e git+https://github.com/jonathanslenders/textfsm.git#egg=gtextfsm

So pip install now runs without errors, but when I try to import get_network_driver I get ImportError: No module named 'eos'. Will update if I find out more.

@fooelisa
Copy link
Member

I don't recall anyone ever trying out napalm with py3. The backend vendor libs might be problematic, afaik Pyez doesn't support 3 yet, which is probably the case for others as well. Keep us posted!

@vnitinv
Copy link

vnitinv commented Feb 23, 2016

As far as PyEZ is concerned. Python 3 supported version can be installed
from
https://github.com/vnitinv/py-junos-eznc/tree/3x

Nitin Kr

On Mon, Feb 22, 2016 at 8:30 PM, Elisa Jasinska notifications@github.com
wrote:

I don't recall anyone ever trying out napalm with py3. The backend vendor
libs might be problematic, afaik Pyez doesn't support 3 yet, which is
probably the case for others as well. Keep us posted!


Reply to this email directly or view it on GitHub
#199 (comment)
.

@ktbyers
Copy link
Contributor

ktbyers commented Sep 17, 2016

cc: @dbarrosop @mirceaulinic

These are some notes for Python3 support from my investigation as part of the NAPALM hackathon.

The general process is:

  1. Get napalm-base to support python3.
  2. Cleanup napalm-base from a pylama perspective. This will make it easier to see issues introduced because of python3 conversion.
  3. Thoroughly regression test existing drivers (both getters and config operations) to make sure conversion didn't break anything.
  4. At that point, any individual NAPALM packaged could be upgraded to support python3.

Dependencies for napalm-base conversion.

  1. pyangbind is not python3 compatible. This is by far the biggest issue that needs resolved (can we decouple openconfig support from napalm_base and/or not use pyangbind).
  2. Convert over to using jtextfsm for textfsm support. Need to regression test that this works for both python2 and python3.
  3. Other standard python2 / python3 converstion items:
    a. future print_function and unicode_literals
    b. Minor item with exception
    c. Minor item with iteritems
    d. Imports within package need to be Python3 compliant.
    e. Cleanup expected test data types (unicode/str) so supports both Python2 and Python3.
    f. Eliminate any explicit unicode type conversions.

See:
https://github.com/ktbyers/napalm-base/tree/python3

@dbarrosop
Copy link
Member

Ok, this was way more than I expected to be achieved during two days. Awesome job.

I am going to work on the pylama issue. I am going to evaluate a) getting rid of it b) making it python3 compatible and getting rid of some heavy dependencies... stay tuned

@netops2devops
Copy link

I was able to install on Python3. I'm using Python 3.5.1. Thanks for porting the API to Py3.

@ktbyers
Copy link
Contributor

ktbyers commented Aug 18, 2017

I don't think we need this any more so closing...

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

7 participants