osm2gtfs icon indicating copy to clipboard operation
osm2gtfs copied to clipboard

Python3 migration

Open nlehuby opened this issue 4 years ago • 8 comments

Here is a new version of osm2gtfs for python3 :tada:

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 :heavy_check_mark: :heavy_check_mark:

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)

nlehuby avatar Apr 30 '20 12:04 nlehuby

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

pantierra avatar May 19 '20 11:05 pantierra

@nlehuby :clap: :clap:

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.

jamescr avatar Aug 30 '20 03:08 jamescr

Thanks for these improvements @jamescr , I've updated the PR :+1:

Does anyone want to have a look ?

nlehuby avatar Sep 07 '20 07:09 nlehuby

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

prhod avatar Sep 07 '20 09:09 prhod

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

@xamanu ?

amenk avatar Oct 22 '22 09:10 amenk

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

pantierra avatar Oct 24 '22 15:10 pantierra

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: https://github.com/AddisMap/AddisMapTransit-gtfs/commit/f8666c5fbff865158dcf5ad9c66eaaecbe64e6d3

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 :-)

amenk avatar Jun 28 '23 18:06 amenk

Can this be Merged?

bayar0206 avatar Jun 03 '24 09:06 bayar0206