PyPI Pitfalls

Say you just wrote a shining new Python package that you would like to submit to PyPI. Here are some pitfalls you might step on.

  • There is a testing repository you may try before submitting to the real repository.

  • No Markdown for now. Stick with reStructuredText for your README instead.

  • I accidentally put a comma at the end of __author_email__ and turned it into a tuple. And distutils.command.upload was quite upset by this.

  • You must chain upload with a distribution command (sdist, etc.). Yup, you cannot execute them separately. You must execute them together.

  • Unlike standard commands, extra commands of setuptools don’t seem to be chain-able?

# upload will complain about
#   error: No dist file created in earlier command
python setup.py sdist
python setup.py upload

# Instead, you must execute them together.
python setup.py sdist upload

# sdist will not be executed because
# test is an extra command.
python setup.py test sdist
Creative Commons License
This blog by Che-Liang Chiou is licensed under a Creative Commons Attribution 4.0 International License.