How To Package Your Python Code
scotttorborg.com
How To Package Your Python Code
1–10 of 36 posts
Re: How To Package Your Python Code
#2One thing I think is missing is to point out not to use setuptools, but to use the less broken, more maintained, drop in replacement distribute (http://guide.python-distribute.org/). That website also has some further information on the packaging ecosystem that's worth flipping through.
Re: How To Package Your Python Code
#3Taking a quick look through this it looks pretty good! I find that beginners have tons of trouble navigating the slightly tricky waters that is packaging in Python, so more resources is great. One thing I think is missing is to point out not to use setuptools, but to use the less broken, more maintained, drop in replacement distribute ( http://guide.python-distribute.org/ ). That website also has some further informa…
Can you elaborate on the places where setuptools is broken? I wanted to keep things as simple as possible for the sake of this tutorial, and I think the described constraints should avoid any setuptools bugs.
Re: How To Package Your Python Code
#4 from setuptools import setup
kw = {
'name' : 'funniest',
'version' : '0.1',
'description' : 'The funniest joke in the world',
'url' : 'http://github.com/storborg/funniest',
'author' : 'Flying Circus',
'author_email' : 'flyingcircus@example.com',
'license' : 'MIT',
'packages' : ['funniest'],
'zip_safe' : False,
}
if __name__ == '__main__':
setup(**kw)
Here are a few of my setup.py files that follow this convention [2] [3] [4].[1]: http://www.scotttorborg.com/python-packaging/minimal.html#cr...
[2]: https://github.com/gvalkov/harstats-graphite/blob/master/set...
[3]: https://github.com/gvalkov/jenkins-autojobs/blob/master/setu...
[4]: https://github.com/gvalkov/python-evdev/blob/master/setup.py
Re: How To Package Your Python Code
#5Re: How To Package Your Python Code
#6I've wondered why using a dictionary to initialize setuptools.setup() isn't more advocated in such guides. I understand this is superficial, but imho, this looks much clearer than the author's suggestion [1]: from setuptools import setup kw = { 'name' : 'funniest', 'version' : '0.1', 'description' : 'The funniest joke in the world', 'url' : 'http://github.com/storborg/funniest', 'author' : 'Flying Circus', 'author_em…
Additionally, there's no point checking that the script is the main file, as there's only ever one use-case for the script, and that's to call setuptools.
Re: How To Package Your Python Code
#7Re: How To Package Your Python Code
#8I've wondered why using a dictionary to initialize setuptools.setup() isn't more advocated in such guides. I understand this is superficial, but imho, this looks much clearer than the author's suggestion [1]: from setuptools import setup kw = { 'name' : 'funniest', 'version' : '0.1', 'description' : 'The funniest joke in the world', 'url' : 'http://github.com/storborg/funniest', 'author' : 'Flying Circus', 'author_em…
Because the only difference there is neater indentation, which you could do using the keywords method. Additionally, there's no point checking that the script is the main file, as there's only ever one use-case for the script, and that's to call setuptools.
Re: How To Package Your Python Code
#9Earlier quoted context omitted.
Because the only difference there is neater indentation, which you could do using the keywords method. Additionally, there's no point checking that the script is the main file, as there's only ever one use-case for the script, and that's to call setuptools.
It actually comes in handy if you're using Sphinx and don't want to maintain release and version in conf.py separately from the version in setup.py . There's no reasons why the data should be consumable only by setuptools .
Re: How To Package Your Python Code
#10I once tried to do something like this and failed and I had an impression that setuptools are not really intended for such things, but mainly for packaging plain Python modules.
Is this a right impression? If yes, what is a good way to package the whole Python based web application?