Application Packages

Diez B. Roggisch deets at nospam.web.de
Wed Sep 16 00:40:17 CEST 2009


Dj Gilcrease schrieb:
> Say I have an application that lives in /usr/local/myapp it comes with
> some default plugins that live in /usr/local/myapp/plugins and I allow
> users to have plugins that would live in ~/myapp/plugins
> 
> Is there a way to map ~/myapp to a user package so I could do "from
> user.plugins import *" or better yet map it to myapp.user?

No. You can execfile things in there, or you can add ~/myapp to the 
sys.path and then import things in there. And you can create aliases for 
those of course.

Alternatively, namespace-packages and virtualenvs might be a solution, 
but not exactly straight-forward as well.

Diez



More information about the Python-list mailing list