Need advice on distributing small module

kj socyl at 987jk.com.invalid
Fri May 15 18:20:41 EDT 2009


In <99246143-a853-4041-bc45-eeb648388cc4 at r3g2000vbp.googlegroups.com> Carl Banks <pavlovevidence at gmail.com> writes:

>On May 14, 1:26=A0pm, kj <so... at 987jk.com.invalid> wrote:
>> I've written a tiny module that I'd like to make available online
>> from my website. =A0This module is not "production-grade" code; it
>> is meant only as an illustration, but still I'd like to make its
>> download and installation as painless as possible.
>>
>> I could simply bundle everything into a .tgz file, but I'd like
>> the distribution to conform to the expectations of Python users,
>> as far as the installation sequence is concerned. =A0I'm fairly new
>> to Python, and would appreciate your advice on this last point.

>First of all, if it's just a single module, I recommend that one of
>the options is to allow the file to be downloaded as-is, with no
>packaging, because a lot of Python users would find it least
>cumbersome to simply drop the file right into the site-packages
>directory.  The README file would be a separate download or just a
>page on the website.

>For more official-looking packages, you want to create a setup.py file
>that lists your module's build information and meta-information.  Read
>the section of the Python documentation entitled "Distributing Python
>Modules" for information on how to write a setup file.  Once you write
>it, you can run python setup.py sdist and it'll build a distrribution
>for you.


>> The module has only one non-standard dependency, described by the
>> following code:
>>
>> if sys.version_info[:2] >=3D (2, 6):
>> =A0 =A0 import json
>> else:
>> =A0 =A0 import simplejson as json
>>
>> If possible, I'd like to make distribution procedure such that if
>> necessary it also installs json or simplejson (as the case may be).

>Next recommendation: just tell your users to download and install json
>if they want to use the module.  A small demo module shouldn't be
>taking the initiative to install a fairly large package on the user's
>behalf.

>Furthermore, some users have extreme hatred for software that
>"helpfully" downloads and installs other packages without asking
>first.

>If you want to proceed along these lines in spite of this, the way to
>do it is to add some information to setup.py that lists dependencies.
>There is a script, easy_install.py, that uses this information to
>install dependencies automatically.  However, I don't know the details
>of how to do that.


Thanks, that's very useful advice.

kynn

-- 
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.



More information about the Python-list mailing list