2

I have a Python project I've been working on for three months, and the project consists of several modules for our team to deploy our software and run scale tests on AWS. Now I want to take the source code, compile that into a binary distribution and bundle all the modules there, like the way python libraries are done. That's for Unix systems. So, suppose one of the modules is called cluster.py, the other scale.py ... if I wanted to create a cluster in AWS I would run:

python cluster.py <args>

I've been reading about dist in Python, and I wanted to do exactly the same how Python libraries do: The user downloads the package, lets say a .zip file, and run:

python setup.py build

then

python setup.py install

so the user could from the command line execute:

cluster <args>

Thus, as I add more functionalities, they would be all bundled up into the package. However, to install all the libraries and other dependencies, I use another python script, called deploy.py. So the build step would consist pretty much of running deploy.py.

from setuptools import setup, find_packages
setup(
    name = "Tools",
    version = "1.0",
    packages = find_packages(),
    scripts = ['deploy.py', 'cluster.py'],

    # Project uses reStructuredText, so ensure that the docutils get
    # installed or upgraded on the target machine
    install_requires = ['docutils>=0.3'],

    package_data = {
    },

    # metadata for upload to PyPI
    author = "Me",
    author_email = "me@example.com",
    description = "This is an Example Package",
    license = "PSF",
    keywords = "hello world example examples",
    url = "http://example.com/HelloWorld/",   # project home page, if any

    # could also include long_description, download_url, classifiers, etc.
)
cybertextron
  • 10,547
  • 28
  • 104
  • 208
  • Does the title need attention "...create a a built..." ? Unless this is the technical terminology? – Deepend Mar 06 '14 at 11:07
  • Your users shouldn't care that the command-line utilities are implemented in Python. If all dependencies are pure Python then just [make a single file executable zip named `cluster`](http://stackoverflow.com/a/5356563/4279) to be run as `./cluster `. If there are C dependencies then you could use [`fpm`](https://github.com/jordansissel/fpm) to build native package for your platform. The installation is using `apt-get` or similar. – jfs Mar 06 '14 at 20:09
  • If the destination platform has no python installed then the simple executable zip-archive might be not enough, you could use [PyInstaller](http://www.pyinstaller.org/), [cx_Freeze](http://cx-freeze.readthedocs.org/en/latest/) to bundle python and all other dependencies for the `cluster`, `scale` scripts – jfs Mar 06 '14 at 20:23
  • @philippe are you scripts being run automatically when the setup.py file is run? – Cas Jun 18 '14 at 18:02

0 Answers0