package with executable

S

Stefano Costa

Hi,
my name is Stefano Costa, I am an archaeologist and I am developing
GNUCal, a radiocarbon calibration program released under the GNU GPL.
[1][2]

Currently the program consists of a small "library", largely based on
Matplotlib and Numpy, and a command line program. My goal is to create a
distributable package, that should ideally contain both the "gnucal"
package and the command line program.

As you can see in the source code [3], I am following some sort of
standard layout for my project, but some things aren't still clear to
me, even after reading setuptools' documentation and looking to the
source of some known Python packages (like sphinx, pastescript, django):
* where should the executable module be wrt setup.py and/or the
package directory in the source tree
* how should I format the console_scripts entry in setup() to make
the executable module available to the system PATH after
installing
* how should I call the "gnucal" package from inside the
executable script (currently I'm using "from gnucal import core"
but it doesn't seem to work)

I'm using virtualenv to create testing environments for the install
process, and my Python is 2.5.4 on Debian Sid.

Any suggestion is appreciated, particularly if there are some real
examples to draw from.

thanks,
steko

[1] http://gnucal.iosa.it/
[2] http://en.wikipedia.org/wiki/Radiocarbon_dating#Calibration
[3] http://bitbucket.org/steko/gnucal/

--
Stefano Costa
http://www.iosa.it/ Open Archaeology

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEABECAAYFAkoTAFMACgkQHmNiC9DTAkUq8gCeI8gsT3D8EViX1oSjbeR5LBLq
lQoAn17RCFE1GkBq1cKgagvp3oRiXezh
=uIP+
-----END PGP SIGNATURE-----
 
J

Jeff McNeil

Hi,
my name is Stefano Costa, I am an archaeologist and I am developing
GNUCal, a radiocarbon calibration program released under the GNU GPL.
[1][2]

Currently the program consists of a small "library", largely based on
Matplotlib and Numpy, and a command line program. My goal is to create a
distributable package, that should ideally contain both the "gnucal"
package and the command line program.

As you can see in the source code [3], I am following some sort of
standard layout for my project, but some things aren't still clear to
me, even after reading setuptools' documentation and looking to the
source of some known Python packages (like sphinx, pastescript, django):
      * where should the executable module be wrt setup.py and/or the
        package directory in the source tree
      * how should I format the console_scripts entry in setup() to make
        the executable module available to the system PATH after
        installing
      * how should I call the "gnucal" package from inside the
        executable script (currently I'm using "from gnucal import core"
        but it doesn't seem to work)

I'm using virtualenv to create testing environments for the install
process, and my Python is 2.5.4 on Debian Sid.

Any suggestion is appreciated, particularly if there are some real
examples to draw from.

thanks,
steko

[1]http://gnucal.iosa.it/
[2]http://en.wikipedia.org/wiki/Radiocarbon_dating#Calibration
[3]http://bitbucket.org/steko/gnucal/

--
Stefano Costahttp://www.iosa.it/Open Archaeology

 signature.asc
< 1KViewDownload

So, I've got a couple packages where I've used the same method.
Generally, I've formatted my entry_points argument as follows:

entry_points = {
'console_scripts': [ 'xmlrpctool =
hostapi.clients.xmlrpc:main' ]
},

It's just a dictionary with a 'console_scripts' key. The value is a
list of wrapper scripts that are to be installed along with the
library files. In this scenario, I'm installing a wrapper script
called 'xmlrpctool' which calls a function named main in the xmlrpc
module within my hostapi.clients package. SetupTools generates that
wrapper for you.

That main function can be any callable. Looking at the way you've
formatted your gnucal.py script, I'm not sure it's going to work
without a bit of modification.

My personal approach would be to move that code into your gnucal
directory, either as it's own module or within one of the existing,
and implement it as a "main" function.

Then an entry_points line such as the following will make sure
'gnucal' gets installed in a directory on your path:

entry_points = {
'console_scripts': [ 'gnucal = gnucal.core:main' ]
},

This, of course, assumes that you move your main function into
'gnucal.core.'

HTH,

Jeff
mcjeff.blogspot.com
 
M

MRAB

Ben said:
Stefano Costa said:
my name is Stefano Costa, I am an archaeologist and I am developing
GNUCal, a radiocarbon calibration program released under the GNU GPL.
[1][2]

That is a great use of Python, and sounds like interesting work.

I would highly recommend you change the name, though.

Your project is not (I assume) developed under the auspice of the GNU
project, so it's misleading to call it “GNU foobar†instead of just
“foobarâ€. There's no trademark involved, but it's still best to keep
the namespace clearly deliniated (which is also entirely in the Python
spirit :)

Also, to call a program “cal†risks great confusion among those who
know the standard ‘cal’ program as a calendar-generation utility. It's
best to avoid that confusion since it's entirely predictable.

Better would be something that evokes radiocarbon calibration; or, since
that's probably a pretty difficult job for a simple name, choose
something snappy that is at least evocative of the themes of
archaeology, radiocarbon dating, or measurement calibration.

Naming isn't an easy job, but it's an important one and is your only
chance at a first impression for the project.
The name that springs to my mind is "radcarbcal", but then that's just
me. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,069
Latest member
SimplyleanKetoReviews

Latest Threads

Top