This PR includes several code changes to be compatible with Python 3, and changes the Travis build to work with Python 3.5 and 3.6. Addresses #29. This is necessarily in parallel with changes to urbansim_parcels, pandana, osmnet, and urbansim; running a simulation using Python 3 using this new codebase also requires Python 3 compatibility with several of the above. The Travis build currently grabs the py3-compatible branches of the above, so that will have to be updated over time.
Code compatibility changes
Print statements changed to print functions, along with from __future__ import print_function
Implicit relative imports changed to explicit absolute imports.
developer.py module renamed to develop.py to avoid namespace conflict related to absolute imports.
A couple changes to dict: iteritems() method replaced with items() (same behavior), dict.keys().sort() changed to list(dict.keys()).sort().
Change to file io (relevant in writing yaml files in test modules)
True division rather than floor division, with from __future__ import division in python 2. I manually checked all of the division operations against test data and they return the same arrays either way.
Travis build changes
Now builds on 3 versions of Python: 2.7, 3.5, 3.6
Conditional installation of pandana from pip (2.7) or github on python3-support branch (along with similar installation of osmnet).
Installation of urbansim_parcels from python3 branch
Installation of urbansim from pksohn/python3 fork/branch
Again, we'll just have to keep track of where the Travis builds are pulling code from. It should get much simpler as we merge changes into master branches.
This PR includes several code changes to be compatible with Python 3, and changes the Travis build to work with Python 3.5 and 3.6. Addresses #29. This is necessarily in parallel with changes to
urbansim_parcels
,pandana
,osmnet
, andurbansim
; running a simulation using Python 3 using this new codebase also requires Python 3 compatibility with several of the above. The Travis build currently grabs the py3-compatible branches of the above, so that will have to be updated over time.Code compatibility changes
from __future__ import print_function
developer.py
module renamed todevelop.py
to avoid namespace conflict related to absolute imports.dict
:iteritems()
method replaced withitems()
(same behavior),dict.keys().sort()
changed tolist(dict.keys()).sort()
.from __future__ import division
in python 2. I manually checked all of the division operations against test data and they return the same arrays either way.Travis build changes
python3-support
branch (along with similar installation ofosmnet
).python3
branchpksohn/python3
fork/branchAgain, we'll just have to keep track of where the Travis builds are pulling code from. It should get much simpler as we merge changes into master branches.