Closed FliesLikeABrick closed 5 years ago
I went through a lot of problems upgrading to the latest release. Probably because it relies on the latest versions of some packages, and previous versions of others... This is the full list of commands that work (I spent several hours trying different versions):
virtualenv venv --no-site-package
. venv/bin/activate
pip install --upgrade pip
pip install --upgrade setuptools
pip install peeringdb
peeringdb configure
pip install django==1.8.17 # It does not work with versions 1.9.12 and 1.10.5
pip install django-peeringdb
peeringdb sync
and hopefully you are done
I'm down to help here if needed.
@jaredthecoder patches are always welcome :)
+1 for code update to Python3.0
@grizz Unfortunately twentyc hasn't been updated for Python 3.
I was able to get peeringdb-py API to work with Python 3.6.1 by making a few changes to twentyc's code, and one small import change to init.py on peeringdb-py, however, this does break the cli functionality as I have not had time to go back and fix cli.py/anything else to work with Python 3.
For those that want to get the API functionality to work with Python 3, and do not mind breaking the cli functionality:
Go to: /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/twentyc/rpc
Open init.py and change the following:
On line 6, change from client import (
to from rpc.client import (
Open client.py and change the following:
On line 3, change import urlparse
to from urllib.parse import urlparse, urlunparse
On line 26, change where it says urlparse.urlparse
to urlparse
On line 38, change where it says urlparse.urlunparse
to urlunparse
On line 100, change where it says print msg
to print(msg)
Go to: /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/peeringdb-py
from client import PeeringDB
to from peeringdb.client import PeeringDB
I'll try submitting a pull request to twentyc, and if that package updates, perhaps peeringdb-py could start a branch for Python 3 and I can submit a pull request with some of the Python 3 changes for client.py & cli.py and anything else that needs updating.
@ironick09 a PR would be great, thanks.
Looks like twentyc has been updated to version 0.4.0.1 to support python3 right? Am I correct that we need:
Alongside some fixes to the code in this repo (e.g the aforementioned imports), these are the requirements that would need to be updated for py3 support
facsimile/requirements.txt twentyc.rpc >= 0.4.0 munge >= 0.4.0
peeringdb/deps/requirements-mysql.txt django-peeringdb>=0.7.0
Also tox and travis configs would need to be updated to test py3 environments
EDIT: added munge
I submitted a PR (#23) to add python3 compatibility, but it's failing tox. If I can get some assistance with that then hopefully this can get pulled into master.
Looks like this is working on the latest master commit, however: django-peeringdb is missing from requirements.txt somewhere in the dependency chain, and peeringdb's init.py attempts to load it
File "/usr/lib/python3.6/site-packages/peeringdb/init.py", line 82, in initialize_backend
supportmod = import_module(modname)
File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "
@grizz is this just a matter of adding django-peeringdb to facsimile/requirements.txt, or is there logic somewhere that should not fail while trying to load this?
This may be the last item to resolve before closing this as python3 support being done (pending a release being cut)
There was substantial refactor for django-peeringdb as well as peeringdb-py that includes python3 support - django-peeringdb changes were released a bit ago, and i assume peeringdb-py will get a pypi release soon as well.
@FliesLikeABrick the new peeringdb-py client does not have a hard dependency on django-peeringdb anymore since there is hope that other backends will be implemented through the new abstraction interface, so you'd manually install it along side peeringdb as your chosen backend.
However it does look for django-peeringdb as the default backend, which is why youre a seeing that error message. I wonder if a better error message is needed or if it's just a question of better documentation.
@vegu thanks for the explanation! The logic in init.py seemed something like that but I didn't spend enough time to really comprehend it. Agreed it would be good to have a message improvement that indicated that django is the default backend but it needs to be installed or peeringdb-py reconfigured for another backend.
I can spend a bit more time looking at this and propose such a change this week
The peeringdb module fails import under python3 on all platforms tested so far (Cygwin, Ubuntu, MacOS)
I imagine the issues run deeper than this particular import issue, so this is a general request for Python3 support in peeringdb