Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send a package to PyPi?

i wrote a little module and i would like to know what are the basic steps to package it in order to send it to pypi:

  • what is the file hierarchy?
  • how should i name files?
  • should i use distutils to create PKG-INFO?
  • where should i include my documentation (made with sphinx)?
like image 305
Mermoz Avatar asked Sep 07 '10 11:09

Mermoz


2 Answers

I recommend reading The Hitchhiker's Guide to Packaging. Specifically, you should look at the Quick Start section, which describes how to:

  1. Lay out your project
  2. Describe your project
  3. Create your first release
  4. Register your package with the Python Package Index (PyPI)
  5. Upload your release, then grab your towel and save the Universe!

You should also look at the Current State of Packaging in the Introduction to Packaging section, as this helps untangle some of the confusion surrounding setuptools, distutils, distutils2, and distribute.

Update Re: How to Name Files

The excerpt below is from PEP8, which answers your question about how to name files:

Modules should have short, all-lowercase names. Underscores can be used in the module name if it improves readability. Python packages should also have short, all-lowercase names, although the use of underscores is discouraged.

Since module names are mapped to file names, and some file systems are case insensitive and truncate long names, it is important that module names be chosen to be fairly short -- this won't be a problem on Unix, but it may be a problem when the code is transported to older Mac or Windows versions, or DOS.

like image 70
Matthew Rankin Avatar answered Oct 23 '22 11:10

Matthew Rankin


an example is always the best way to see how to do:

http://packages.python.org/an_example_pypi_project/

like image 39
Mermoz Avatar answered Oct 23 '22 12:10

Mermoz