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

Reorganize lib to fit distribution conventions. #54

Merged
merged 1 commit into from
Aug 30, 2017

Conversation

kronosapiens
Copy link
Contributor

Unfortunately, my earlier PR (#53) didn't quite fix the packaging issues.

To solve the problem, I moved the source files into a snappy subdirectory and added an __init__.py to preserve the existing API. The only API change is that command-line invocation requires referencing the snappy.cmd module, as snappy now refers to a package, instead of an individual module.

I have tested the new packaging by building and installing form source and wheels, run the test suites, and tested the command-line invocation.

@martindurant
Copy link
Member

martindurant commented Aug 29, 2017

I believe you would not need to change the CLI invocation if cmd.py->__main__.py

@kronosapiens
Copy link
Contributor Author

I will try it and update the PR!

@kronosapiens
Copy link
Contributor Author

@martindurant Correct! I renamed cmd.py to __main__.py and the original python -m snappy invocation succeeded!

test_snappy.py Outdated
@@ -29,7 +29,7 @@
import os
import sys
import random
import snappy
from snappy import snappy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will all users of the new structure need to do this?
Could not the __init__.py import everything one might need from the module, so that we don't force a code change on users of snappy?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@martindurant short answer is no, the public API is unchanged.

In this case, the tests expect access to internal snappy variables (_CHUNK_MAX for example) which didn't make sense to include in the API and import in __init__.py. My first approach was to import the internal snappy module so the tests could access those internal variables.

I've updated the PR to import snappy at the top level and access the hidden variables via snappy.snappy. Let me know what you think.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine with me, so long as the PR is transparent for users.

Copy link
Contributor Author

@kronosapiens kronosapiens Aug 30, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed; the current API is preserved, assuming users are not attempting to access private variables.

@martindurant
Copy link
Member

Anyone with any further comments?

@andrix
Copy link
Collaborator

andrix commented Aug 30, 2017

LGTM! 👍

@martindurant
Copy link
Member

Thank you @kronosapiens for your work!

@martindurant martindurant merged commit db3c4dd into intake:master Aug 30, 2017
@kronosapiens
Copy link
Contributor Author

kronosapiens commented Aug 30, 2017

My pleasure! Do you know when the new version will be on PyPi?

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