Skip to content

Make the entire codebase Python3 compatible without using 2to3 #4375

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

Closed
1 task done
cpcloud opened this issue Jul 26, 2013 · 11 comments · Fixed by #4384
Closed
1 task done

Make the entire codebase Python3 compatible without using 2to3 #4375

cpcloud opened this issue Jul 26, 2013 · 11 comments · Fixed by #4384
Labels
Refactor Internal refactoring of code
Milestone

Comments

@cpcloud
Copy link
Member

cpcloud commented Jul 26, 2013

  • deprecate iterkv
@jtratner
Copy link
Contributor

Could try running https://github.com/mitsuhiko/python-modernize on it. Actually, I'm going to do it now and see what happens.

@jtratner
Copy link
Contributor

Check it - bunch of changes...worth thinking through https://github.com/jtratner/pandas/tree/python-modernize-it . Going to see what happens if we remove 2to3 as well...

Main thing are the xrange --> range changes. Maybe use from six.moves import xrange instead?

@jtratner
Copy link
Contributor

aaannnd it has tons of errors to fix...

@jreback
Copy link
Contributor

jreback commented Jul 27, 2013

is there a way to essentially find all d these errors then fix them (by doing code changes) gradually
eg maybe certain types of errors at a time (doing xrange -> range pretty straightforward)

using a tool to find them but shouldn't have a dep for the actual changes

@cpcloud
Copy link
Member Author

cpcloud commented Jul 27, 2013

xrange to range will still need 2to3 since if you write range(3) in 2 then 2to3 will assume you mean [0,1,2] and it will rewrite it as list(range(3))

@cpcloud
Copy link
Member Author

cpcloud commented Jul 27, 2013

six does all of the checking for you that would be needed to avoid 2to3, although you're right xrange -> range can just be redefined

@jtratner
Copy link
Contributor

Yeah, that's what I'm doing. I'm just going fix by fix on this which makes it easier to do. Basically six converts everything to iterators and then you need to explicitly choose to convert things to lists.

@jtratner
Copy link
Contributor

Right now I'm doing u"some string" --> six.u("some string"), etc.

@jreback
Copy link
Contributor

jreback commented Jul 27, 2013

ok
i would ship six with pandas (only 1 python file) and it encourages this

@cpcloud
Copy link
Member Author

cpcloud commented Jul 27, 2013

@jtratner after all ur prs pandas is going to be sparkling clean ❇️

@jtratner
Copy link
Contributor

haha, frankly these fixes end up being great ways to learn the code base, because they break minor things / show up issues and then I can fix them 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Refactor Internal refactoring of code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants