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

python3 support for NEXUS and QMCPACK #1290

Closed
1 of 7 tasks
prckent opened this issue Jan 2, 2019 · 5 comments
Closed
1 of 7 tasks

python3 support for NEXUS and QMCPACK #1290

prckent opened this issue Jan 2, 2019 · 5 comments
Assignees

Comments

@prckent
Copy link
Contributor

prckent commented Jan 2, 2019

A transition is needed due to python 2.7 becoming unsupported soon. https://pythonclock.org/

How much work will it take?

  • Port core generic module to Python 3
  • Get existing tests to work in Python 3
  • Get a couple of existing workflows to work in Python 3
  • Expand test set in Python 2
  • Get expanded Python 2 tests to work in Python 3
  • Careful pass over remaining code for known 2 vs 3 issues (e.g. division, sorting)
  • Road test Python 3 version prior to release

See #158 (Nexus tests) for detailed breakdown of needed tests.

@jtkrogel
Copy link
Contributor

jtkrogel commented Jan 8, 2019

Yes, it does look like the time is indeed now: https://python3statement.org/. I am in favor of making a clean break to full Python 3 support and dropping Python 2 as this is less work and there is little benefit to continue Python 2 support in the transition.

The changes are not small, e.g. the meaning of division changes and several core class functions (e.g. for dict's) have altered return types. The extensive use of Nexus' obj class rather than dict may blunt the impact of some of the changes, but I will just need to dig in and try it.

The main work item, prior to full porting, is further rounding out the test set and then porting over the needed changes. I will edit the initial comment to list work items.

@jtkrogel
Copy link
Contributor

jtkrogel commented Jan 9, 2019

I just tried this morning to port the core generic module to Python 3. This is a good starting point because extensive unit tests exist for this module.

I was successful after a couple of hours, though some of the changes required were revealing. For example, Python 3 sorting is no longer generic (it now simply falls over when sorting a list containing, say integers and strings). This feature is relied upon heavily in some I/O and error reporting. I ended up finding a python2-like fall back sort online that I will try to use instead.

Another change is in NumPy's class hierarchy (may or may not be linked with Python 3), i.e. numpy integers are no longer derived from Python integers which makes dynamic type checking more complicated. Perhaps there is a way to capture both without complicating the code, but it will take a little more searching.

@jtkrogel
Copy link
Contributor

jtkrogel commented Jan 9, 2019

Anyone who is interested can follow developments in my Python 3 branch of Nexus:

https://github.com/jtkrogel/qmcpack/tree/nx_py3

@ye-luo
Copy link
Contributor

ye-luo commented Mar 21, 2021

@prckent close this? I think we have more recent issues to track this.

@prckent
Copy link
Contributor Author

prckent commented Mar 22, 2021

And we have transitioned! Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants