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

Py3 compat #5

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Py3 compat #5

wants to merge 3 commits into from

Conversation

danielballan
Copy link

  • Use six. (For the uninitiated, it's a package commonly used to simplify py2/3 compatibility.)
  • Remove py2-isms (print statements, has_key, etc.)
  • Remove homebrewed versioning code in favor of versioneer.
  • Remove a couple unused imports.

The important module is importable in Python 3:

In [1]: import diffpy.srxplanar
Only tiff or .npy mask is support since fabio is not available

and versioneer is doing its job.

In [2]: import diffpy

In [3]: diffpy.__version__
Out[3]: '1.1+39.g3a19323.dirty'

The +39 means 39 commits past version 1.1, and the .dirty means there was uncommitted code when I ran this. The last commit was hash g3a19323....

I followed the existing convention of exposing __version__ in the subpackages, although this is a little unusual. You can see that they all still work.

In [4]: diffpy.srxplanar.__version__
Out[4]: '1.1+39.g3a19323.dirty'

In [5]: diffpy.confutils.__version__
Out[5]: '1.1+39.g3a19323.dirty'

attn @pavoljuhas

- Use six.
- Fix simple stuff (print statements, has_key, etc.)
- Remove versioning code in favor of versioneer.
- Remove a couple unused imports.
@zthatch
Copy link

zthatch commented Jun 15, 2021

@danielballan thank you for already having done what I was recently assigned. Looks like I will just add test code to prove that this works on python 2 and 3 (specifically testing how it interfaces with srxplanargui and pdfgetxgui).

It also looks like there is now a conflict, so I will see if I can pull your PR and rebase.

I still have to have a conversation with @pavoljuhas about versioning and will likely switch from versioneer to Rever.

@pavoljuhas
Copy link
Member

diffpy is a namespace-only (for Python-import) package to mark up software packages / products belonging to the DiffPy suite. There are diffpy.structure, diffpy.pdfgui, diffpy.srreal, etc., on PyPI and Conda repositories; each of them installs a diffpy namespace in a way that other diffpy.SOMETHING subpackages are visible and importable even if they reside in a different PYTHONPATH directory.

I'd advice against putting version value or any other content (except of namespacing support) to diffpy/__init__.py, because it would cause conflicts and unpredictable results when several diffpy.SOMETHING packages were installed.

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

Successfully merging this pull request may close these issues.

3 participants