By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,122 Members | 1,581 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,122 IT Pros & Developers. It's quick & easy.

should I distribute .pyc files?

P: n/a
Hi,

I am creating not-so-important opensource application written in python
for Linux. I have two files python source in src directory, named
blabla1.py and blabla2.py. There are byte compiled files too, named
blabla1.pyc and blabla2.pyc. Should I distribute these files (pyc
files) to users? If I don't distribute them, and user installed my
application into /usr (not writable by normal user) then run it as
normal user, off course, the python cannot make byte-compiled version.
Will my program runs slower in user computer then in my computer
because I have byte compiled version?

Thank you.

Dec 19 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"akbar" <ak*******@gmail.comwrote:
I am creating not-so-important opensource application written in python
for Linux. I have two files python source in src directory, named
blabla1.py and blabla2.py. There are byte compiled files too, named
blabla1.pyc and blabla2.pyc. Should I distribute these files (pyc
files) to users? If I don't distribute them, and user installed my
application into /usr (not writable by normal user) then run it as
normal user, off course, the python cannot make byte-compiled version.
Will my program runs slower in user computer then in my computer
because I have byte compiled version?
Short answer: use distutils or build a python egg. These will automate most
of the distribution process.

Longer answer:

distutils (standard in Python) will build you a variety of installation
packages such as zip, tar, rpm, or windows .exe (even from linux). The
installation step will do all necessary compiling from .py to .pyc (and
also builds extension modules although that can be problematic for a
windows distribution where the correct compiler almost certainly isn't
available).

setuptools (http://cheeseshop.python.org/pypi/setuptools) is a collection
of enhancements to distutils which let you build .egg files. Once you start
using egg files you can include dependencies between package versions and
if your product requires a bunch of other packages the installation step
will download and install the appropriate versions.

See http://peak.telecommunity.com/DevCenter/EasyInstall for instructions on
installing packages built in this way, but in short, the user has to run
ez_setup.py from the EasyInstall page, and then a command like:

easy_install http://example.com/path/to/MyPackage-1.2.3.tgz

would download and install your package and all the other products it
depends on. If at a later stage they want to upgrade to a more recent
version then all they need to do is to run:

easy_install --upgrade MyPackage

Installed eggs usually exist in a single file (importable zip) which makes
uninstalling especially easy: just one file to delete.
Dec 19 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.