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

Convert to Python 3 #4

Closed
baagaard-usgs opened this issue Jun 11, 2019 · 4 comments · Fixed by #23
Closed

Convert to Python 3 #4

baagaard-usgs opened this issue Jun 11, 2019 · 4 comments · Fixed by #23
Labels
deficiency Undesirable behavior or annoying in progress

Comments

@baagaard-usgs
Copy link
Contributor

Need to convert to Python 3 before end of life for Python v2.

@baagaard-usgs
Copy link
Contributor Author

@willic3 You can remove more futurize boilerplate.

Remove these statements

from builtins import object
from __future__ import print_function
from builtins import range

Also remove old_div with Python 2.7/3 compatible code (original should be ok).

Stuff that needs more investigation

Can we eliminate these?

from builtins import str
from past.builtins import basestring
from past.builtins import execfile

Potential problems (need to test):

journal/colors/ColorANSI.py might have a problem with str(scheme_list).replace(...).

Ideally, we would like code that is compatible with Python 2.7/3 without any workarounds. In cases where this is not possible, we want to add as few dependencies as possible (i.e., we might have to depend on the future module, but hopefully that is it).

@baagaard-usgs baagaard-usgs added this to the Python 2/3 compatibility milestone Aug 8, 2019
@baagaard-usgs
Copy link
Contributor Author

baagaard-usgs commented Nov 26, 2020

Using futurize to update to Python 2/3 compatibility.

Stuff that is not Python 3 compatible:

  • ConfigParser
./pyre/inventory/cfg/Parser.py`
from ConfigParser import SafeConfigParser
  • urllib
opal/applications/CGIParser.py
pyre/inventory/pml/parser/Facility.py
pyre/inventory/pml/parser/Property.py
  • metaclass

Possible "fixes" to identify incompatibilities:

  • libfuturize.fixes.fix_future_builtins
  • libfuturize.fixes.fix_metaclass

@baagaard-usgs
Copy link
Contributor Author

  • Created nemesis branch baagaard/update-python-3 for updates to Python C API used by nemesis. This branch only works for Python 3.5 and later.

  • Updated mpi/_mpi.c via cython for Python 2/3 compatibility.

@baagaard-usgs
Copy link
Contributor Author

Check to see if we can allow configparser to have strict=False. If strict=True, then each .cfg file cannot have duplicate section headings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deficiency Undesirable behavior or annoying in progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant