Updated post.

dev
Franco Masotti 3 years ago
parent 7212801928
commit 33fc9d821e
  1. 68
      _posts/2018-04-16-my-python-release-workflow.md

@ -1,7 +1,7 @@
---
title: My Python release workflow
tags: [python, git, workflow]
updated: 2019-04-14 17:06
updated: 2019-06-19 16:40
description: A personal reminder with the instructions for releasing new versions of Python packages
---
@ -14,36 +14,46 @@ in case of a new version release with some of my Python repositories.
- Use [fpyutils](https://github.com/frnmst/fpyutils) or [md_toc](https://github.com/frnmst/md-toc), as example blueprints.
- Assume that the root of the repository is `./`.
- Variables are marked with the dollar (`$`) sign.
- 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](https://semver.org/#summary) document.
- 3.5 <= Python version < 4
## Workflow
1. Check that the current branch is not `master`:
```shell
[ "$(echo git branch | grep "*" | tr -d '* ')" = "master" ] && echo "STOP" || echo "OK"
```
1. go to the project's directory
1. `cd ${project_name}`
2. Finish working on the development branch (usually `dev`) and commit
1. `git add -A`
2. `git commit -am "$commit_message"`
3. `git push`
2. check that the current branch is not `master`
1. `[ "$(echo git branch | grep "*" | tr -d '* ')" = "master" ] && echo "STOP" || echo "OK"`
3. Update version numbers, requirements, and do all necessary verifications
3. finish working on the development branch, `${dev_branch}`, and commit
1. if needed, create a new [asciinema](https://asciinema.org/) demo file and upload it
1. `cd ./asciinema`
2. `touch ${project_name}_asciinema_${MAJOR}_${MINOR}_${PATCH}_demo.sh`
3. modify the `${project_name}_asciinema_${MAJOR}_${MINOR}_${PATCH}_demo.sh` file accordingly
4. `asciinema rec --command=${project_name}_asciinema_${MAJOR}_${MINOR}_${PATCH}_demo.sh ${project_name}_asciinema_${MAJOR}_${MINOR}_${PATCH}.json`
5. `asciinema play ${project_name}_asciinema_${MAJOR}_${MINOR}_${PATCH}.json`
6. `asciinema upload ${project_name}_asciinema_${MAJOR}_${MINOR}_${PATCH}.json`
2. `git add -A`
3. `git commit -am "${commit_message}"`
4. `git push`
4. if necessary, update version numbers, requirements
1. update version numbers in:
- `./setup.py`
- `./docs/conf.py`
- any file in the `./packages` directory.
2. update the `./requirements.txt` file with the appropriate packages.
- all downstream distribution packages (see the`./packages` directory)
2. update the `./requirements.txt` file with the appropriate packages
3. `sudo pip install -r requirements.txt`
4. `make pep`
5. `make test`
6. `sudo make install`
7. `cd ~ && python`
8. `import $package_name`
9. `cd $OLDPWD`
9. `cd ${OLDPWD}`
10. `sudo make uninstall`
11. `make clean`
12. Update copyright years, emails, contributors if necessary in:
12. update copyright years, emails and contributors in:
- `./README.rst`
- `./docs/conf.py`
- `./docs/copyright_license.rst`
@ -52,7 +62,7 @@ in case of a new version release with some of my Python repositories.
14. `git commit -am "Preparing for new release."`
15. `git push`
4. Update the documentation
5. update the documentation
1. `make doc`
2. `cp -aR docs/_build/html ~`
3. `git checkout gh-pages`
@ -62,15 +72,31 @@ in case of a new version release with some of my Python repositories.
7. `git commit -am "New release."`
8. `git push`
5. Merge the `$dev_branch` branch into `master` and create a new annotated git tag
6. merge the `${dev_branch}` branch into `master` and create a new annotated git tag
1. `git checkout master`
2. `git merge $dev_branch`
3. `git tag -a $version_id -m "New release."`
2. `git merge ${dev_branch}`
3. `git tag -a ${version_id} -m "New release."`
4. `git push`
5. `git push origin $version_id`
6. Upload the package to PIP
7. upload the package to PIP
1. `make dist`
2. `make upload`
7. Update downstream distribution packages (eg: `PKGBUILD` files).
8. update downstream distribution packages
1. [AUR](https://wiki.archlinux.org/index.php/Arch_User_Repository)
1. copy `./packages/aur/PKGBUILD` file in the project's AUR git directory (`${projects_aur_git_directory}`)
2. go to the project's AUR git directory
1. `cd ~/${projects_aur_git_directory}`
2. update the sha256 checksum
1. `checksum="$(wget -O - ${project_url_archive_file_last_version} | sha256sum)"`
2. update the `PKGBUILD` file with `${checksum}`
3. test the modifications
1. `makepkg -rsi`
2. remove all the build files
1. `rm -rf pkg src *.tar.*`
4. update and push
1. `makepkg --printsrcinfo > .SRCINFO`
2. `git add PKGBUILD .SRCINFO`
3. `git commit -m "New release."`
4. `git push`

Loading…
Cancel
Save