1

I have a simple python script which reads a text file and do some processing on it. I need to distribute this code. So any one with Ubuntu operating system could run it. I import some modules as follows.

import pandas
import httpbl
from prettytable import from_csv

etc...

My question is how to make these packages installable with my script in any other users machine(Ubuntu).

There are lot of questions asked and I found this as the closest match. But any way I do not have much knowledge on doing this.

Community
  • 1
  • 1
Nilani Algiriyage
  • 32,876
  • 32
  • 87
  • 121
  • ubuntu comes with python. just distribute the source code :) – Raiyan Nov 08 '13 at 06:13
  • @Raiyan Yes, Python is there,but other packages have to be installed? E.g.Pandas,prettytable etc. – Nilani Algiriyage Nov 08 '13 at 06:16
  • How about making a folder for your work. Put the main python script there. Also copy the libraries into that folder. Than import the libraries in your main file from this new relative location. You can zip/gzip this entire folder and distribute your work. – Raiyan Nov 08 '13 at 06:18
  • Another possibility, put the entire project on github and tell you friends to download from there – Raiyan Nov 08 '13 at 06:18

1 Answers1

1

You should checkout setuptools: http://pythonhosted.org/setuptools/ which can do exactly what you're looking for.

As an example (this is just a script in the same directory called "recat"):

from setuptools import setup

setup(
    name = 'recat',
    version = '0.1',
    packages = [],
    author = 'Name',
    author_email = 'email',
    description = 'Replay log files simply and easily',
    license = 'GPLv3',
    keywords = 'log replay',
    url = 'URL',
    scripts = ['recat']
)

You might also consider creating a Ubuntu package out of it. The FPM project can help you with that: https://github.com/jordansissel/fpm

apg
  • 2,611
  • 1
  • 18
  • 19