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 compatibility #40

Merged
merged 19 commits into from
Mar 23, 2017
Merged

Python 3 compatibility #40

merged 19 commits into from
Mar 23, 2017

Conversation

pksohn
Copy link
Contributor

@pksohn pksohn commented Mar 22, 2017

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.

@pksohn pksohn merged commit 3b16d57 into dev Mar 23, 2017
@pksohn pksohn mentioned this pull request Mar 28, 2017
@pksohn pksohn deleted the python3 branch March 29, 2017 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants