The requirement of Evolve making it into SIFT is that it needs to be installed from the Python Package Index (PyPI). This is a very reasonable requirement since it makes the maintenance of SIFT a much more reasonable project. A project, may I add, that is also available for free and maintained in the free time of the volunteers. Thanks!
I started reading about Python packages and distribution, and found that it is very capable and very flexible, almost too much. It has been a challenge for me to squeeze in the reading and testing between the demands of my full time job, but I finally stumbled my way through it to a final version. There are many tutorials available that explain the basics of Python packages, but I had a little different problem than what most Python projects face, I guess. I wanted to write this all down to share my experience for any of you that might benefit.
El Problemo
Put me aside now, and let’s talk about the technical problem with packaging Evolve. A typical package available from PyPI is python code. You get a little more exotic when you find the author including some code written in C or C++ to make for a more efficient function. This code requires compiling, but the PyPI can handle it, and does it well (except for on Windows). Where Evolve presented the problem is in the HTML, CSS, JS, and images used in the web interface. These aren’t considered code by the Python packager, so it was a challenge for me to get them included.
Basic Building
Creating the setup.py file to start it all off
This tutorial was very helpful in building the basics of the setup.py file. It explains most of the properties well. The part that I found lacking was in the sections for including extra non-python code in the package.
The trouble with including non-python files
C/O
http://stackoverflow.com/questions/7522250/how-to-include-package-data-with-setuptools-distribute
This was a great help in truly understanding what I thought I understood after reading the Python docs. It also helped keep me sane and moving forward!
Including some other files
This helped me somewhat. I was able to get the folder of HTML files included, but it was a rather manual process. I knew I could fall back on this, but I figured that there must be a better way. We are doing programmer things, after all.
More on including other files
Another good tutorial on the packaging process, but it didn’t fully register with what I needed.
Yet another on the process of building
This is the article that finally made things fit together. In fairness to the others, I think it just took some time to sink in.
Highlighted Points
sdist and bdist use different properties
__init__.py is a critical file, even if it’s blank
I am using classes in Evolve, but only for the Morphs. It’s something I want to address in the future, but moving the main code into classes will require time in refactoring and testing that I just don’t have quite yet.
MANIFEST is not MANIFEST.in
Use distutils instead of setuptools
That’s It
James Habben
@JamesHabben