May 27th, 2012 by exhuma.twn
Just today I needed to remove files from a package. And I realised that I forgot to mention that removing files from the MANIFEST.in files has a small gotcha… Here’s the small note I added to the original article:
When running the setup script, it will create a folder with the extension .egg-info. If you make changes to your MANIFEST.in file, you should delete this folder. It contains a file named SOURCES.txt which contains all the file in the package. If you remove files from your manifest, the will only disappear when that file is changes as well. So the easiest way is to delete the egg-info folder and let the setup script re-create it!
Posted in Uncategorized | No Comments »
May 19th, 2012 by exhuma.twn
Following some of the comments, the previous article about python packaging has been updated.
- Added a note about pip install -e as an alternative to python setup.py develop
- Added a note about testpypi.python.org
- Fixed the section about the manifest (I forgot to add include_package_data to the setup script)
Posted in Uncategorized | No Comments »
May 13th, 2012 by exhuma.twn
One of the really useful things in python are the setup scripts. When doing “serious” business, you really should look into them. Setup scripts are amazingly powerful. But they don’t necessarily need to be complex. But because of this flexibility, the documentation around them seems like a lot to read. Additionally, the state of packaging has changed quite a bit over the years. So you now have a couple of packages (distutils, setuptools, distribute) which all seem to try to solve the same problem. SeeĀ the current state of packaging for more details on this.
This post attempts to summarize the important bits using a “Hello World” project and steeping through the process of creating the setup.py file:
- Creating a package distribution
- Automatic generation of executables
- Version numbers
- Dependency management
- Publishing your package (thus also making it available for automatic dependency resolution)
- Some more food for thought.
NOTE: The
setup.py script we will construct in this post, will use two bits of code which may not work in all cases:
- importing the package itself (to centralize the version number)
- Reading the long_description content from a text-file
Both methodologies have their issues. Importing the package only works if you can import it cleanly (i.e. without dependencies) from standard python. Reading the text file only works if the setup.py is called from the proper location.
This is mostly true. There are corner-cases however where this is not possible. If that is the case, you will need to live without these helpful shortcuts. See the comments on this article for more on this.
Read the rest of this entry »
Posted in Python | 30 Comments »
May 7th, 2012 by latz.twn
Are you using git/svn/mercurial/bazaar as version control system and you ever wanted to visualize your work, how the project developed over time well Gource is there to visualize all this in a beautiful way. It takes the history of your svn/git/mercurial/bazaar repository and visualizes the changes over time, by whom they were done and so forth.
sudo apt-get install gource
Now run the following with path/to/project being your projects root directory, and give gource the .git subfolder. Run it and you should see the animation being presented.
gource /path/to/project/.git/
Now to export this to an mpeg4 video do the following.
gource /path/to/project/.git/ --stop-at-end --output-ppm-stream - | ffmpeg -y -b 6000k -r 60 -f image2pipe -vcodec ppm -i - -vcodec mpeg4 /tmp/gource.mp4
Here an example I created from one of my projects.
Posted in Linux | No Comments »