Skip to content

Instantly share code, notes, and snippets.

@jodal
Last active September 18, 2020 09:36
Show Gist options
  • Save jodal/6c011e327035cc4ad56dbc2e3c28f1eb to your computer and use it in GitHub Desktop.
Save jodal/6c011e327035cc4ad56dbc2e3c28f1eb to your computer and use it in GitHub Desktop.
Mopidy extension upgrade checklist

Mopidy extension upgrade checklist

Preparations

  • Check if on latest master
  • Create a branch: git checkout -b python3

Project setup

setup.cfg

  • Copy new content, not the entire file, from cookiecutter
  • Update the file with details from setup.py and deps from tox.ini

Copy from the cookiecutter

CC=~/mopidy-dev/cookiecutter-mopidy-ext/\{\{cookiecutter.repo_name\}\}
cp $CC/.gitignore .
cp $CC/setup.py .
cp $CC/pyproject.toml .
cp $CC/tox.ini .
cp $CC/MANIFEST.in .
rm .travis.yml
cp -r $CC/.circleci .

.gitignore

  • Check diff for custom files that should still be ignored

tox.ini

  • Set package name

MANIFEST.in

  • Run tox -e check-manifest to check if everything is included

.travis.yml

  • Check for dependencies installed which needs to go into .circleci/config.yml or the mopidy/ci-python Docker images

.circleci/config.yml

  • Remove {% raw %} clauses: sed -i "s/{% [a-z]* %}//g" .circleci/config.yml

CHANGELOG.rst

  • Split out of README.rst

README.rst

  • Remove ?style=flat from badge urls
  • Update CI and coverage badges
  • Indent badges by 4 spaces
  • Update install docs to use python3 -m pip
  • Add changelog link in resources section
  • Add credits section

Commit

git commit -m "Update project to match cookiecutter-mopidy-ext"

Port to Python 3

Commit for each of the following steps:

  • pyupgrade --py37-plus **/*.py
  • black .
  • isort -rc . && black .
  • Use pathlib in Extension
  • Use pkg_resources to populate __version__
  • Use unittest.mock instead of mock
  • Use f-strings instead of % and .format()
  • Anything else necessary to get tests passing and code running

CircleCI

If first extension in this GitHub org/user:

For each extension:

  • Find project at https://circleci.com/gh/organizations/mopidy/settings#projects
  • Open Project settings on the right project
  • Click the "Follow project" button
  • Open Project settings > Advanced settings
  • Set "Build forked pull requests" to "On"
  • CircleCI is now ready to build any branch/PR with a .circleci/config.yml
  • Setup of coverage data from CircleCI to Codecov.io is automatic

Pull request

  • Push the python3 branch and make a PR
  • Check that CI runs green
  • Merge PR

Release

  • Bump version (now in setup.cfg) to a new major number
  • Add rc1 suffix to the version number
  • Update changelog
  • Commit and close Python 3 tracking issue from the commit message
  • Release to PyPI: rm -rf dist && python setup.py sdist bdist_wheel && twine upload -s dist/*
  • Create release tag: git tag -a -m "Release v2.0.0rc1" v2.0.0rc1
  • Push: git push --follow-tags
@jodal
Copy link
Author

jodal commented Nov 24, 2019

@kingosticks Done and done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment