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

Cannot import a class from original module after it has been established as an entry_point #640

Open
mattwthompson opened this issue Nov 14, 2019 · 1 comment

Comments

@mattwthompson
Copy link
Member

It seems that once a thing (class, function, etc.) is established an mBuild recipe via an entry_point, it can no longer be imported directly from its original class. This is concerning only in the sense that it might be confusing for a developer to lose this import after setting up their packages as a recipe. If there's no straightforward way around this, that's fine, it should just be documented.

This is the Python script I used to test this behavior. Here I am comparing behavior on the master branch (no recipe configuration) of Ray's pore builder recipe and a feature branch that sets up the recipe.

(master)$ python -W ignore check-import.py 
Importing from module was a:
	Success!
Importing from mBuild was a:
	Failure.
(mosdef-dev) [Clausius] ~/software/recipes/Pore-Builder
(master)$ git checkout recipe ; pip install -e .
Switched to branch 'recipe'
Obtaining file:///Users/mwt/software/recipes/Pore-Builder
Installing collected packages: porebuilder
  Found existing installation: porebuilder 0.1
    Uninstalling porebuilder-0.1:
      Successfully uninstalled porebuilder-0.1
  Running setup.py develop for porebuilder
Successfully installed porebuilder
(mosdef-dev) [Clausius] ~/software/recipes/Pore-Builder
(recipe)$ python -W ignore check-import.py 
Importing from module was a:
	Failure.
Importing from mBuild was a:
Success!
@mattwthompson
Copy link
Member Author

mattwthompson commented Nov 14, 2019

Looks like it also has something to do with the order of importing the module vs importing mbuild

This works:

import mbuild; from porebuilder.porebuilder import GraphenePore

This does not

import porebuilder; from porebuilder.porebuilder import GraphenePore

And also this doesn't work

from mbuild.recipes import GraphenePore

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

1 participant