
Hi All, I've always built my python packages as a folder, with a __init__.py, any other python bits and then the miscellany (readme.txt, etc) in the same folder. For distributions, I've historically tarred up the folder and put it up to download with installation instructions to just untar somewhere on the python path. However, I'd now like to distribute one of my products as an egg, and so thought I'd use setuptools to build the source distros as well. The package is mailinglogger and you can see the svn trunk here: https://secure.simplistix.co.uk/svn/Simplistix/mailinglogger/trunk/ The setup.py there is wrong in that the egg is builds only contains the 'tests' subpackage and none of the other modules, and no mailinglogger package to boot. Given the component.xml in there, I'm pretty sure I need to add a zip_safe=True, but what else do I need to do to get setup.py to correctly build an egg and a source distro? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk

At 09:59 PM 8/12/2007 +0100, Chris Withers wrote:
Hi All,
I've always built my python packages as a folder, with a __init__.py, any other python bits and then the miscellany (readme.txt, etc) in the same folder.
For distributions, I've historically tarred up the folder and put it up to download with installation instructions to just untar somewhere on the python path.
However, I'd now like to distribute one of my products as an egg, and so thought I'd use setuptools to build the source distros as well.
The package is mailinglogger and you can see the svn trunk here:
https://secure.simplistix.co.uk/svn/Simplistix/mailinglogger/trunk/
The setup.py there is wrong in that the egg is builds only contains the 'tests' subpackage and none of the other modules, and no mailinglogger package to boot.
Given the component.xml in there, I'm pretty sure I need to add a zip_safe=True, but what else do I need to do to get setup.py to correctly build an egg and a source distro?
Short answer: move the package and any data files that should be included to a mailinglogger/ subdirectory. Alternative answer: use package_dir={'mailinglogger':'.'} and manually list the packages (since find_packages() doesn't support package_dir). Downside to this approach is that "setup.py test" and "setup.py develop" will not work correctly -- for you or anyone else who wants to work on your package in source form.

Phillip J. Eby wrote:
Given the component.xml in there, I'm pretty sure I need to add a zip_safe=True, but what else do I need to do to get setup.py to correctly build an egg and a source distro?
Short answer: move the package and any data files that should be included to a mailinglogger/ subdirectory.
What ends up in the root folder then? just the setup.py? (I want the docs and examples packages in the source distro, I don't know if they make any sense in the egg distro...)
Alternative answer: use package_dir={'mailinglogger':'.'} and manually list the packages (since find_packages() doesn't support package_dir).
I actually tried this before I mailed here, it didn't work but I can't remember the exact reason. I think it may have been that it included the files as modules, but they weren't in a 'mailinglogger' package anymore...
Downside to this approach is that "setup.py test" and "setup.py develop" will not work correctly -- for you or anyone else who wants to work on your package in source form.
I'm not too fussed about either, tbh ;-) cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk

At 10:46 AM 8/13/2007 +0100, Chris Withers wrote:
Phillip J. Eby wrote:
Given the component.xml in there, I'm pretty sure I need to add a zip_safe=True, but what else do I need to do to get setup.py to correctly build an egg and a source distro? Short answer: move the package and any data files that should be included to a mailinglogger/ subdirectory.
What ends up in the root folder then? just the setup.py?
and anything else you want in the source distro, like the docs and examples. I also usually throw my tests there, and don't distribute them with the egg, but preferences vary.
Alternative answer: use package_dir={'mailinglogger':'.'} and manually list the packages (since find_packages() doesn't support package_dir).
I actually tried this before I mailed here, it didn't work but I can't remember the exact reason. I think it may have been that it included the files as modules, but they weren't in a 'mailinglogger' package anymore...
I suspect that you changed package_dir but not packages. You have to explicitly list the packages for that to work.

Phillip J. Eby wrote:
At 10:46 AM 8/13/2007 +0100, Chris Withers wrote:
Phillip J. Eby wrote:
Given the component.xml in there, I'm pretty sure I need to add a zip_safe=True, but what else do I need to do to get setup.py to correctly build an egg and a source distro? Short answer: move the package and any data files that should be included to a mailinglogger/ subdirectory.
What ends up in the root folder then? just the setup.py?
and anything else you want in the source distro, like the docs and examples. I also usually throw my tests there, and don't distribute them with the egg, but preferences vary.
Okay, I think I have this now: https://secure.simplistix.co.uk/svn/Simplistix/mailinglogger/tags/3.2.1/ However, when I do: python2.4 setup.py sdist bdist_egg upload ...none of the package metadata gets uploaded: http://pypi.python.org/pypi?:action=display&name=mailinglogger&version=3.2.1 This used to work: http://pypi.python.org/pypi?:action=display&name=mailinglogger&version=3.2.0 ...and I can't see any changes in my setup.py that might be relevent. Any ideas? Is there a problem with PyPi at the moment?
Alternative answer: use package_dir={'mailinglogger':'.'} and manually list the packages (since find_packages() doesn't support package_dir).
I actually tried this before I mailed here, it didn't work but I can't remember the exact reason. I think it may have been that it included the files as modules, but they weren't in a 'mailinglogger' package anymore...
I suspect that you changed package_dir but not packages. You have to explicitly list the packages for that to work.
I tried prettymuch every combination, all with varying degrees of failure... Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk

At 09:46 AM 8/14/2007 +0100, Chris Withers wrote:
Phillip J. Eby wrote:
At 10:46 AM 8/13/2007 +0100, Chris Withers wrote:
Phillip J. Eby wrote:
Given the component.xml in there, I'm pretty sure I need to add a zip_safe=True, but what else do I need to do to get setup.py to correctly build an egg and a source distro? Short answer: move the package and any data files that should be included to a mailinglogger/ subdirectory.
What ends up in the root folder then? just the setup.py? and anything else you want in the source distro, like the docs and examples. I also usually throw my tests there, and don't distribute them with the egg, but preferences vary.
Okay, I think I have this now:
https://secure.simplistix.co.uk/svn/Simplistix/mailinglogger/tags/3.2.1/
However, when I do:
python2.4 setup.py sdist bdist_egg upload
...none of the package metadata gets uploaded:
http://pypi.python.org/pypi?:action=display&name=mailinglogger&version=3.2.1
This used to work:
http://pypi.python.org/pypi?:action=display&name=mailinglogger&version=3.2.0
...and I can't see any changes in my setup.py that might be relevent.
Any ideas? Is there a problem with PyPi at the moment?
No idea; but it looks correct to me now.

Phillip J. Eby wrote:
Any ideas? Is there a problem with PyPi at the moment?
No idea; but it looks correct to me now.
I had to do: python2.4 setup.py sdist bdist_egg register upload ...which seems a bit weird. So I have to do 'register' every time in order to get the metadata up there? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
participants (2)
-
Chris Withers
-
Phillip J. Eby