[
https://issues.apache.org/jira/browse/BEAM-3981?focusedWorklogId=86702&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-86702
]
ASF GitHub Bot logged work on BEAM-3981:
----------------------------------------
Author: ASF GitHub Bot
Created on: 02/Apr/18 18:52
Start Date: 02/Apr/18 18:52
Worklog Time Spent: 10m
Work Description: RobbeSneyders opened a new pull request #4990:
[BEAM-3981] Futurize and fix python 2 compatibility for coders subpackage
URL: https://github.com/apache/beam/pull/4990
This pull request is the result of applying the [automatic conversion
provided by the future
package](http://python-future.org/overview.html#automatic-conversion-to-py2-3-compatible-code)
to the coders subpackage, after which all python 2 errors were fixed. The
result is python 3 styled code with python 2 compatibility.
This pull request is the first of a series in which all subpackages will be
updated. We should therefore discuss the chosen approach, so we can agree on
one strategy to apply throughout.
The approach I've taken, is to focus on writing python 3 code with python 2
compatibility:
- The future package provides tools to forward-port our code, while the six
package focuses more on backporting. I've therefore replaced six with future
everywhere it was already used.
- One of the biggest problems in porting python 2 code to python 3, is the
changed handling of strings and bytes. To get a consistent behavior between
versions, I have tried to rewrite everything to use the `str` and `bytes` type
provided by the future.builtins package. I have not used the `from __future__
import unicode_literals` import since [its changes are too implicit and
introduces a risk of subtle regressions on python
2](http://python-future.org/unicode_literals.html)
I started out with running futurize on the complete coders subpackage and
then tried to fix the errors introduced by the automatic conversion. This
however proved to be difficult, because it's not obvious where certain errors
were introduced.
I therefore switched to a per module approach, in which I first updated all
non-test modules. This way, I could check if everything still ran with the
native python 2 tests. Afterwards, I updated all test modules.
This pull request also contains updates to run_pylint.sh and tox.ini, so
pylint can be run with the --py3k parameter. This should help avoid regression
between the different steps of the update process.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 86702)
Time Spent: 10m
Remaining Estimate: 0h
> Futurize and fix python 2 compatibility for coders package
> ----------------------------------------------------------
>
> Key: BEAM-3981
> URL: https://issues.apache.org/jira/browse/BEAM-3981
> Project: Beam
> Issue Type: Sub-task
> Components: sdk-py-core
> Reporter: Robbe
> Assignee: Ahmet Altay
> Priority: Major
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Run automatic conversion with futurize tool on coders subpackage and fix
> python 2 compatibility. This prepares the subpackage for python 3 support.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)