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

Python3 migration #160

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open

Python3 migration #160

wants to merge 18 commits into from

Conversation

nlehuby
Copy link
Collaborator

@nlehuby nlehuby commented Apr 30, 2020

Here is a new version of osm2gtfs for python3 🎉

The most significant changes are:

  • dict.items() instead of dict.iteritems()
  • a whole fat bag of encoding changes
  • some minor changes on the number of digits of the stop coordinates
  • migration from urllib2 to urllib.request

I've also fixed some python warnings on memory issues about unclosed files and split the tests into several travis jobs so it can be easy to see which one is failing. And they are all green ✔️ ✔️

As the transitfeed lib has not been released yet in python3, I'm using a fork (that needs to be cloned and installed before installing osm2gtfs).

I did not cherry-picked the changes of @xamanu from #153 about the formatting to keep this PR as reviewable as possible (but I do think we should add them as soon as we have a working version of osm2gtfs for python3 on master)

@pantierra pantierra mentioned this pull request May 19, 2020
@pantierra
Copy link
Contributor

pantierra commented May 19, 2020

Wow, @nlehuby, this is awesome 🎉
Many thanks! Please excuse the slow reply, will have a look on this soon.

@jamescr
Copy link
Collaborator

jamescr commented Aug 30, 2020

@nlehuby 👏 👏

I tried the PR and it works great, just requires a little change in two line to add binary mode on read/write operations. Also I made some improvements related with installing the forked transitfeed module from git. I'll made PR with this changes to @Jungle-Bus repo for her consideration.

* Install transitfeed fork from git

* Update install command and requirements

* Add binary mode on I/O operations

* Install on Travis with the setup file and use python3

* Delete depedency_links from setup file

thanks @jamescr
@nlehuby
Copy link
Collaborator Author

nlehuby commented Sep 7, 2020

Thanks for these improvements @jamescr , I've updated the PR 👍

Does anyone want to have a look ?

@prhod
Copy link
Collaborator

prhod commented Sep 7, 2020

I've made a quick review, and I don't have any comment 👍 ( but I don't feel relevant enough to approve )
Great work !

@@ -10,7 +10,7 @@
keywords='openstreetmap gtfs schedule public-transportation python',
author='Various collaborators: https://github.com/grote/osm2gtfs/graphs/contributors',

install_requires=['attrs>=17.1.0', 'overpy>=0.4', 'transitfeed>=1.2.16', 'mock', 'webcolors', 'transporthours'],
install_requires=['attrs>=17.1.0', 'overpy>=0.4', 'transitfeed @ git+https://github.com/pecalleja/transitfeed.git@python3', 'mock', 'webcolors', 'transporthours'],
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As https://github.com/google/transitfeed is no longer actively maintained, it's probably okay to use such a fork. Wondering what are the alternatives on the long run, because the recommended alternative https://github.com/MobilityData/gtfs-validator only does validation, not parsing for Python, right?

@amenk
Copy link

amenk commented Oct 22, 2022

I guess it would be nice if this can be reviewed / merged :-)

@xamanu ?

@pantierra
Copy link
Contributor

Thanks for the input, @amenk. Unfortunately, I am totally out of the context. Feel free to proceed without me.

@amenk
Copy link

amenk commented Jun 28, 2023

Looks good basically :-)

But: No clue if that is related to the Python3 port, but we are using this in a GitHub action which autocommits the GTFS and the fields in the .txt files change their order seemingly randomly on each run. I did not notice this when we were still on Python 2

Example: AddisMap/AddisMapTransit-gtfs@f8666c5

Can have a totally unrelated reason or maybe it is even like this before the upgrade, but we did not notice it before. Just wanted to mention it. Also it's a very niche issue so it still could be merged :-)

@bayar0206
Copy link

Can this be Merged?

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.

6 participants