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

Move code into labrad.servers package #418

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

maffoo
Copy link
Contributor

@maffoo maffoo commented Aug 7, 2017

This fixes up the package structure of this repo so that it can be put on the python path without polluting the global package namespace. Mostly file renames, but also had to update some imports for modules that refer to each other. For these imports, I used absolute imports starting with labrad.servers

@maffoo maffoo requested a review from ejeffrey August 7, 2017 23:07
@maffoo maffoo closed this Aug 7, 2017
@maffoo maffoo reopened this Aug 7, 2017
Copy link
Contributor

@ejeffrey ejeffrey left a comment

Choose a reason for hiding this comment

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

I think you need to create a labrad/init.py and/or labrad/servers/init.py that does the namespace package stuff. This will also have to be changed in pylabrad.

__path__ = __import__('pkgutil').extend_path(__path__, __name__)

@maffoo
Copy link
Contributor Author

maffoo commented Aug 8, 2017

I added labrad/servers/__init__.py with the magic snippet to make this a namespace package, in case the import order is different. From my local testing, it seems this gets picked up by the import machinery and it is not necessary to also add labrad/__init__.py in this repo.

@ejeffrey
Copy link
Contributor

ejeffrey commented Aug 8, 2017

I believe the "real" answer is that whichever package is first in the users PYTHONPATH gets imported first, and needs to have the magic pkgutil snippet to make the later entries get searched.

Copy link
Contributor

@ejeffrey ejeffrey left a comment

Choose a reason for hiding this comment

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

LGTM

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.

None yet

2 participants