Closed cclauss closed 5 years ago
OK. I will create a new branch with the nasty code the Futurize
created. As you can expect both Py2 and Py3 tests fail before even beggining...
I used entropy
package for Py3 and found that hilarious screenshot that summarizes Python Packaging System quite well:
Using pytest
package both for Py2 and Py3 tests (just to be in the same page). It's also a good idea to change it in travis-ci too (it prevents STDOUT and gets a lot faster).
Working on it right now...
Can't thank you enough for your effort on that!
Oh and a line like the following in your shells rc
(_profile
?)would be really handy:
alias pytest3='python3 -m pytest'
Aggressive... The trick was to Futurize just the Test directory first and get all tests to pass before Futurizing the code. But let's try it this way. I do not know entropy -- have to read up. The way we have Travis working is that we have a Py2 env and a Py3 env that test in parallel. You can do that locally with tox but I have never done that. Let's see how we progress.
entropy
is the package that is used to test the homebrew hashing algorithm
. It just ensures that it returns "seemingly" random data.
The joke was on the "collecting entropy
" pip's
quote, that implies that Python Packaging is a bit random (have you tried to upload to PyPI
lately?)...
If you find it difficult to proceed with the full futurized
mess I can recreate the branch from master
This list (posted in the link you posted) sums it all up nicely:
To summarize:
The problem is that almost all the API work with bytes but accept strings...
Second paragraph was...
Regardless of which tool you choose, they will update your code to run under Python 3 while staying compatible with the version of Python 2 you started with. Depending on how conservative you want to be, you may want to run the tool over your test suite first and visually inspect the diff to make sure the transformation is accurate. After you have transformed your test suite and verified that all the tests still pass as expected, then you can transform your application code knowing that any tests which fail is a translation failure.
yes, I firgured out later. I thought you were initially referring to the "Use feature detection instead of version detection" paragraph. Want me to scrap and recreate?
Yes. I think you should recreate with:
future
added to requirements.txt
futurize
only run on the tests
directoryWe need to have Python 2.7 running in a stable way against the futurized tests before futurizing the rest of the codebase and then finally making Python 3 changes again.
The new branch is ready at "https://github.com/operatorequals/covertutils/tree/py3_compatibility"
Hi, just came to this project from Python Weekly. FYI I've seen six
used much more often in the python ecosystem and thus modernize
is my preferred approach.
Hi @operatorequals I have been away from this project but could come back to it now if you want to make Py3 support mainstream.
I see that currently the Python 3 tests are failing on TabErrors. This is because Python 3 has zero tolerance when space and tab indentation are mixed in the same code block. If you want to stick with tab indentation, that needs to be used everywhere. We could fix the TabErrors and then edit .travis.yml to take Python 3 out of allow_failures mode to enforce discipline on all pull requests.
Your thoughts?
See https://docs.python.org/3/howto/pyporting.html#update-your-code