5.3 KiB
title | tags | updated | description | |||||
---|---|---|---|---|---|---|---|---|
My Python release workflow |
|
2020-10-17 22:55 | A personal reminder with the instructions for releasing new versions of Python packages |
This is a personal reminder for the operations to do in case of a new version release with some of my Python repositories.
Please note that this page is deprecated and will only be kept for historical reference. Have a look at https://frnmst.github.io/fpydocs/workflow_common.html for an updated version.
Rules
-
Use md_toc as an example blueprint.
-
Assume that the root of the repository is
./
. -
Variables are marked with braces and the dollar sign, e.g:
${variable}
. -
${MAJOR}
,${MINOR}
and${PATCH}
refer to the varaibles reported on the Semantic Versioning document. -
3.5 <= Python version < 4
-
commits and tags must be signed; run these commands once per repository:
git config commit.gpgsign true git config user.signingkey ${gpg_signing_key}
Workflow
-
go to the project's directory
cd ${project_name}
-
check that the current branch is not
master
[ "$(echo git branch | grep "*" | tr -d '* ')" = "master" ] && echo "STOP" || echo "OK"
-
finish working on the development branch,
${dev_branch}
, and commit- if needed, create a new asciinema demo file and upload it
cd ./asciinema
- if there have been changes from the previous version
touch ${project_name}_asciinema_${MAJOR}_${MINOR}_${PATCH}_demo.sh
- modify the
${project_name}_asciinema_${MAJOR}_${MINOR}_${PATCH}_demo.sh
file accordingly asciinema rec --command=./${project_name}_asciinema_${MAJOR}_${MINOR}_${PATCH}_demo.sh ${project_name}_asciinema_${MAJOR}_${MINOR}_${PATCH}.json
asciinema play ${project_name}_asciinema_${MAJOR}_${MINOR}_${PATCH}.json
asciinema upload ${project_name}_asciinema_${MAJOR}_${MINOR}_${PATCH}.json
- edit the
./README.rst
file with the new asciinema link
- OTHERWISE, if there have been no significant changes from the previous version
ln -s ${project_name}_asciinema_${MAJOR}_${OLD_MINOR}_${OLD_PATCH}_demo.sh ${project_name}_asciinema_${MAJOR}_${MINOR}_${PATCH}_demo.sh
ln -s ${project_name}_asciinema_${MAJOR}_${OLD_MINOR}_${OLD_PATCH}.json ${project_name}_asciinema_${MAJOR}_${MINOR}_${PATCH}.json
git add -A
git commit -m "${commit_message}"
git push
- if needed, create a new asciinema demo file and upload it
-
if necessary, update version numbers and requirements
- update version numbers in:
./setup.py
./docs/conf.py
- all downstream distribution packages (see the
./packages
directory)
- update the
./Pipfile
with the appropriate packages make install-dev
make doc
make pep
make test
make install
cd ~ && python -c 'import ${package_name}' && cd ${OLDPWD}
make uninstall
make clean
- update copyright years, emails and contributors in:
-
./README.rst
-
./docs/conf.py
-
./docs/copyright_license.rst
-
all Python source files
-
all downstream distribution packages (see the
./packages
directory)update changed files only
git add -A
git commit -m "Preparing for new release."
git push
-
update the documentation
make clean && make doc
rm -rf ~/html && cp -aR docs/_build/html ~
git checkout gh-pages
rm -rf _modules _sources _static _images
mv ~/html/{*,.nojekyll,.buildinfo} .
git add -A
git commit -m "New release."
git push
-
merge the
${dev_branch}
branch intomaster
and create a new annotated git taggit checkout master
git merge ${dev_branch}
git tag -s -a ${version_id} -m "Some sensible comments highlighting relevant changes from the previous release."
git push
git push origin ${version_id}
-
upload the package to PIP
make clean
make dist
make upload
-
upload the package on the [software]({{ site.baseurl}}/software/) page:
- follow the instructions reported [here]({{ site.baseurl}}/software/#upload)
-
update downstream distribution packages
- AUR
- copy
./packages/aur/PKGBUILD
file in the project's AUR git directory (${projects_aur_git_directory}
) - copy the signature file in the project's AUR git directory (
${projects_aur_git_directory}
) - go to the project's AUR git directory
cd ~/${projects_aur_git_directory}
- update the sha512 checksum in the
PKGBUILD
file with the one in the [software]({{ site.baseurl}}/software/) page - test the changes
makepkg -rsi
- remove all the build files and the installed package
rm -rf pkg src *.tar.*
pacman -Rnus ${pacman_package_name}
- update and push
makepkg --printsrcinfo > .SRCINFO
git add PKGBUILD .SRCINFO
git commit -m "New release."
git push
- copy
- AUR
-
if needed, update the entry on the Free Software Directory