This is so cool!
I've written my first python module – *gpsparser and uploaded it to PyPI. Here’s a recipe on how to do it.
Write your module. It should be focused around a class [i.e.
object] (or collection of classes) and the methods that act on it.
Typically the module filename is all lower case, while the name of
the class is capitalized. It is also nice to include an if
__name__ == '__main__': section. This section implements
your class in some standard parent script when run from the command
line. For example, my gpsparser.py, when run from the command-line
takes a filename and string type argument, parses the file for the
string type and writes the results to stdout (See
gpsparser.py -help.
Write a setuptools setup.py file. Here is mine for this initial version:
‘’‘ setup.py script for gpsparser.py ’‘’ from setuptools import setup, find_packages setup(name = ‘gpsparser.py’,
version = '0.0.1',
author = "Val Schmidt",
author_email = "vschmidt@ccom.unh.edu",
description = "gpsparser is a package for the parsing of GPS NMEA strings.",
license = "GPL",
zip_safe = True
)
Create source and egg distributions of your package with
python setup.py sdist bdist_egg
Register yourself and your package with PyPI.
python setup.py Register
At the moment there is a bug in the upload feature of
setuptools, such that the only way to upload your package to PyPI
is to create a $HOME/.pyirc that looks like this:
[server-login] username: vschmidt password: yourpassword
Upload your package to PyPI with:
python setup.py sdist bdist_egg upload
I would prefer not to put my password in the .pypirc file, however an apparent bug in the setuptools module prevents any other operation. Ideally one would be prompted for your password interactively.