As described in Package Manager, the package manager expects three files for each package:

  • A PACKAGE.dep file, which lists the versions and dependencies of the package.  The general format is:
PACKAGE/VERSION: DEPENDENCY1/DEP1_VERSION, DEPENDENCY2/DEP2_VERSION, ...
  • A PACKAGE.py file, which describes how the package should be compiled.  The simplest python package will have a file like:
from python_package import python_package

class PACKAGE_package(python_package):
    def init(self):
        super(psp_package, self).init()
  • A PACKAGE-VERSION.tar.gz file containing the contents of the package.

This archive should unpack into a directory with the general structure:

  • setup.py
  • PACKAGE/
    • __init__.py
    • module1.py
    • ...

The setup.py file should look like:

from distutils.core import setup

setup(name='PACKAGE', version='VERSION', packages=['PACKAGE'],
      description='Description of the Package',
      author='Author Name', author_email='author@slac.stanford.edu')

The python setuptools also support dependencies, etc. but this is the bare minimum needed.

Once this is done, a source tarball can be created by running:

% python setup.py sdist

This will create dist/PACKAGE-VERSION.tar.gz.

 

  • No labels