Document how to run MonkeyType

This commit is contained in:
Martin Mahner 2020-06-03 17:45:29 +02:00
parent 09ad7d2871
commit 08f7d9c27f
5 changed files with 21 additions and 1 deletions

1
.gitignore vendored
View file

@ -6,3 +6,4 @@ dpaste/static/
dpaste.egg-info dpaste.egg-info
dpaste.sqlite dpaste.sqlite
node_modules node_modules
monkeytype.sqlite3

View file

@ -13,7 +13,7 @@ endef
.PHONY: test .PHONY: test
test: ## Run Django tests test: ## Run Django tests
rm -f .coverage rm -f .coverage
docker-compose run --rm app monkeytype run /usr/local/bin/pytest dpaste/ docker-compose run --rm app /usr/local/bin/pytest dpaste/
.PHONY: code-cleanup .PHONY: code-cleanup
code-cleanup: ## Black and isort the Python codebase code-cleanup: ## Black and isort the Python codebase

View file

@ -25,6 +25,7 @@ services:
BUILD_EXTRAS: dev BUILD_EXTRAS: dev
image: app image: app
environment: environment:
DJANGO_SETTINGS_MODULE: dpaste.settings.local
STATIC_ROOT: /collectstatic STATIC_ROOT: /collectstatic
DATABASE_URL: sqlite:////db/dpaste.sqlite DATABASE_URL: sqlite:////db/dpaste.sqlite
PORT: 8000 PORT: 8000

View file

@ -45,5 +45,23 @@ Then simply call it from the project directory.
py36-django-20: commands succeeded py36-django-20: commands succeeded
congratulations :) congratulations :)
Type Annotation
===============
Type annotation can be added automatically using MonkeyType_.
.. code-block:: bash
# Generate the database
docker-compose run --rm app monkeytype -c dpaste.monkeytype:config run /usr/local/bin/pytest dpaste/
# List available modules
docker-compose run --rm app monkeytype -c dpaste.monkeytype:config list-modules
# Apply them one by one.
docker-compose run --rm app monkeytype -c dpaste.monkeytype:config stub <module-name> --ignore-existing-annotations
docker-compose run --rm app monkeytype -c dpaste.monkeytype:config apply <module-name> --ignore-existing-annotations
.. _Travis: https://travis-ci.org/bartTC/dpaste .. _Travis: https://travis-ci.org/bartTC/dpaste
.. _tox: http://tox.readthedocs.org/en/latest/ .. _tox: http://tox.readthedocs.org/en/latest/
.. _MonkeyType: https://monkeytype.readthedocs.io/en/stable/

Binary file not shown.