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

Please add an __init__.py file to the project root #41

Open
attilaolah opened this issue Mar 12, 2010 · 1 comment
Open

Please add an __init__.py file to the project root #41

attilaolah opened this issue Mar 12, 2010 · 1 comment

Comments

@attilaolah
Copy link

Hi,

Please consider adding an empty init.py file to the project root. Here's why.

I'm using bloggart under a custom prefix ('/blog/'), with a buildout-based application. The easiest way for me to set it up is to use http://github.com/zerok/zerokspot.gitrecipe/ to grab the latest revision from github.

I don't change anything to the code, I just have a custom dict with my own settings and scripts that look like this (pseudocode):

# my_custom_static.py:
from somewhere import my_custom_settings
# mangle sys.path to insert bloggart's directory
# (which is actually a symlink as I use rod.recipe.appengine
# to put things together for me)
import config # this is bloggart config
[setattr(config, *item) for item in my_custom_settings.iteritems()]

# Then do the rest
from static import main # this is your static.py
if __name__ == '__main__':
    main()

As you can see, it is quite frustrating and also it's hard not to make filename clashes. If you'd add an init.py to the root, that probably wouldn't change anything for your code if run stand-alone, but my code would be much cleaner as I could use your code like a package, without manging my sys.path.

@Arachnid
Copy link
Owner

I'd be surprised if this is sufficient - I believe bloggart uses absolute imports in places. If you want to try this, and it works, however, send me a pull request and I'll approve it!

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

2 participants