I have been playing around with ta stand-alone python package for sage. It works really well except that I have not found a "nice" way to import classes into the global namespace. I suspect that it is just something in the way that I have configured things, so I've distilled my code down to a minimal example in the hope that some one can tell me how to fix it.
My package layout is: package/ |- setup.py |- mytest/ |- __init__.py |- test.py where the files setup.py, __init__.py and test.py are as follows: *setup.py* from setuptools import setup setup(name='mytest', packages=['mytest']) *__init__.py* from __future__ import absolute_import from .test import atest from mytest import * *test.py* def atest(): print 'A working test' To install this "package" you can either use plain setup tools with sage setup.py install but I decided to pip instead, installing it "locally" and in development mode with: sage -pip install -e --user . This works fine in that I can start sage and import and use the package, but not quite as easily as I'd like: sage: import mytest sage: mytest.atest() A working test sage: atest() --------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-3-3d2a871a5605> in <module>() ----> 1 atest() NameError: name 'atest' is not defined sage: from mytest import atest # manually import atest sage: atest() A working test I thought that `atest` would be automatically available from the global namespace because of either the second and or the third lines of __init__.py. Instead, it still needs to be manually imported. Is there a way to put atest into the global namespace when the package is imported? Of course, it would be even better if the mytest package was automatically imported into the global namespace at run-time. Andrew -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.