Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More

Publishing to PyPI

Here we go for releasing a new version of Lino to the world. This usually involves several packages. We usually do such a series of releases when some production site needs an upgrade and hence the list of packages we release depends on what we need for that site.

Cheat sheet

  • We assume that you have configured your environment.

  • Check you have a clean working copy of all projects maintained by the Synodalsoft team:

    $ pp git pull
    
  • Check that all test suites are passing and all doc trees are building:

    $ pp inv prep test clean -b bd
    
  • (Currently not used:) For every demo project that has a test_restore.py file in its test suite, run makemigdump and add the new version to the tested_versions in the test_restore.py file. See Migration tests for details.

  • Decide which packages to release. In each package you can say git log to decide whether there are relevant changes since the last release to pypi.

  • For each package you want to release, read How to release a new version.

  • Update the release notes and the changelog in the book.

How to release a new version

Before migrating from setup.py to pyproject.toml

  • Update the version in the setup_info.py file. See Date-based versioning for details.

  • Create a source tarball and then publish it to PyPI:

    $ inv sdist release -b
    
  • Commit and push the new version number:

    $ git ci -am "release to pypi" && git push
    

After migrating from setup.py to pyproject.toml

Instead of saying inv sdist release, say:

# make sure that your repository is clean:
git st
# see current version:
hatch version
# increase either micro or minor part of version number:
hatch version micro
# or (if month has changed since last version)
hatch version minor
# see what it did:
git diff
# remove old dist files:
rm dist/*
python -m build
twine check dist/*
twine upload dist/*
git ci -am "release to pypi"; git push

Configure your environment

Of course you need maintainer’s permission on PyPI for the repositories to which you want to write.

You also need to configure your ~/.pypirc file:

[distutils]
    index-servers = pypi

[pypi]
    username = __token__
    password = pypi-SomeLongString

The twine software package should be installed on your Linux distro. To check if you have twine installed on your machine, run:

$ twine --version

If you do not have twine installed on your machine, you can install it using aptitude or snap package manager (depending on your distro there maybe few other package managers that indexes twine), run the following command to install it using aptitude:

$ sudo apt install twine