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

Gathering references for the best way to customize python imports #1

Closed
asmodehn opened this issue Jan 11, 2016 · 6 comments
Closed

Comments

@asmodehn
Copy link
Member Author

Interestingly six also has some module proxy to enable lazy loading :
Check the renamed/moved section https://pythonhosted.org/six/

@asmodehn
Copy link
Member Author

One thing to consider also is http://setuptools.readthedocs.io/en/latest/pkg_resources.html
It is different from import mechanism, but could be used for plugin system, and as a prerequisites for optional dependencies...

@asmodehn
Copy link
Member Author

For future reference, the standard python way to dynamically import a module or package is to use https://docs.python.org/2.7/library/importlib.html

@asmodehn
Copy link
Member Author

asmodehn commented Apr 5, 2017

We should dig more into http://setuptools.readthedocs.io/en/latest/pkg_resources.html#supporting-custom-importers

We are already using pkg_resources, as the standard way to setup path and customize import behavior like in https://github.com/asmodehn/pyros-setup/blob/master/pyros_setup/__init__.py#L20, and also for namespace packages...

Maybe setting up ROS environment can be done as soon as any python code is trying to import a ros package (using pkg_resources and a custom importer for ROS...)

@asmodehn
Copy link
Member Author

asmodehn commented Apr 5, 2017

@asmodehn
Copy link
Member Author

I guess all of this now belongs there :
pyros-dev/rosimport#4

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

No branches or pull requests

1 participant