Contribute Media
A thank you to everyone who makes this possible: Read More

Publishing well-formed Python packages


Julin S

#### Why Most of the well established projects follow some practices and has some mechanism in place to ensure better maintainability.

But we can find a good number of packages online which are being developed without an equivalent mechanism.

In this talk, I will mention some tools, which when used, can lay the foundation for a well formed package.

#### Well-formed package

A package whose source has some structure which makes testing and development more efficient and less error-prone.

Such a package also makes working with its source a more pleasant experience.

A well-formed package makes things easier for both the developer and the user.

But it is easier to get started with a structure than to maintain that form. Which calls for a mechanism to maintain that structure.

#### How

The source code should adopt a style and stick with it. A linting tool like pylint can help with it. Or you could use black.

Use type annotations along with tools like mypy.

Eliminate unused code with vulture.

Add tests to be sure that the different functionalities work as intended using tools like pytest or the built-in unittest. This will be extremely useful to be sure that further modifications do not break existing code.

Ensure proper test coverage with After all, adding tests isn't everything. One got to make sure it reaches every nook and corner.

Automate tests with tox, nox, etc.

Package the project in tune with the future of packaging. setuptools, flit or poetry

And add some CI/CD.

Other tools like pre-commit, bumpversion, etc may also be used.

#### Intended audience

People who create and publish python packages. The presentation is from the package developer's perspective and not exactly about the innards of the different python packaging tools.

#### Pre-requisites

Basic Python programming. Git

## Tentative talk outline

  • Linting
  • Type checking
  • Eliminating dead code
  • Tests
  • Test coverage
  • Test automation
  • Packaging
  • CI/CD
  • Other tools
  • Future of packaging

#### Speaker info (anonymized):

Using Python for 5 years. Interested in text processing.

Published a few packages to PyPI using different packaging tools.

The proposed talk is derived from experience of creating them.

Produced by NDV:

Python, PyCon, PyConAU, PyConline

Sat Sep 5 13:00:00 2020 at Floperator

Improve this page