Skip to content

Latest commit

 

History

History
102 lines (81 loc) · 3.04 KB

dev.md

File metadata and controls

102 lines (81 loc) · 3.04 KB

Dev Install

poetry install

# install osxdocker as symlink to avoid reinstall whenever code changes
# https://github.com/python-poetry/poetry/issues/1135
# workaround using __name__ == '__main__' and fire
poetry run task dev_osxdocker

# may need the following command to install watchdog, used for sphinx-autobuild
# sudo xcode-select --switch /Library/Developer/CommandLineTools
# https://github.com/streamlit/streamlit/issues/283#issuecomment-546682661

Test pypi install

# install from test pypi, allow pull from non-test pypi for fire
pip3 install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple osxdocker

Dev tools

Deploy

https://github.com/python-poetry/poetry manages building and deploying.
You'll need one of the following:

  1. ~/.pypirc set up
  2. pass the --username and --password to publish commands
  3. use POETRY_HTTP_BASIC_PYPI_USERNAME and _PASSWORD environment variables.

A github action pushes every git tag to pypi. A webhook polls the github repo to keep the docs in sync.

# build dist
poetry build

# publish to test pypi https://github.com/python-poetry/poetry/issues/742#issuecomment-609642943
poetry config repositories.testpypi https://test.pypi.org/legacy/
# ensure latest version is built
poetry publish --build --repository testpypi

# publish to real pypi
poetry publish --build

Tests

poetry run task tests

Note tests are not working in github actions yet because docker can't be installed on the github osx images. See #5 and https://gh.neting.ccmunity/t5/GitHub-Actions/Why-is-Docker-not-installed-on-macOS/m-p/39364#M3782

Tested locally on OSX Mojave 10.14.6, docker 19.03.5 (installed via brew install docker).

Linter

# to autoformat python code
poetry run task lint

# to sort imports
poetry run task isort

Docs

# built with sphinx-autobuild
poetry run task build_docs

https://docs.readthedocs.io/ issue with poetry and dev deps. readthedocs/readthedocs.org#4912 won't install poetry dev packages, need docs/source/requirements.txt generate using poetry run pip freeze > docs/source/requirements.txt

Version management

# pass args e.g. patch, minor, major
poetry run bumpversion --commit --tag patch

# e.g. typical release cycle
poetry run task tests
poetry run task ci_lint
poetry run bumpversion --commit --tag patch
git push
git push --tags

poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry publish --build --repository testpypi

Source of truth is .bumpversion.cfg. See #7 and python-poetry/poetry#144 (comment)

Git hooks

poetry run task install_hooks
# use --force to overwrite hooks if they already exist

GNU screen

Had failing test on clear_log. Screen session was in invalid state, possibly from force quitting test suite. Solution was to log on to screen manually and flush STDIN.