From c7cad6fc257c178b24b3f574b8c6992002c6f072 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Mon, 26 Sep 2022 12:26:31 -0700 Subject: [PATCH] Documentation for Just, closes #494 Also added 'just init' and fixed a couple of missing pipenv run calls. --- Justfile | 8 ++++++-- docs/contributing.rst | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/Justfile b/Justfile index 4fe3fb9..a479717 100644 --- a/Justfile +++ b/Justfile @@ -1,6 +1,10 @@ # Run tests and linters @default: test lint +# Setup project +@init: + pipenv run pip install -e '.[test,docs,mypy,flake8]' + # Run pytest with supplied options @test *options: pipenv run pytest {{options}} @@ -10,11 +14,11 @@ pipenv run black . --check pipenv run flake8 pipenv run mypy sqlite_utils tests - cog --check README.md docs/*.rst + pipenv run cog --check README.md docs/*.rst # Rebuild docs with cog @cog: - cog -r README.md docs/*.rst + pipenv run cog -r README.md docs/*.rst @docs: cog cd docs && pipenv run make livehtml diff --git a/docs/contributing.rst b/docs/contributing.rst index a1041f5..ef5a875 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -79,6 +79,46 @@ Both commands can then be run in the root of the project like this:: All three of these tools are run by our CI mechanism against every commit and pull request. +Using Just and pipenv +===================== + +If you install `Just `__ and `pipenv `__ you can use them to manage your local development environment. + +To create a virtual environment and install all development dependencies, run:: + + cd sqlite-utils + just init + +To run all of the tests and linters:: + + just + +To run tests, or run a specific test module or test by name:: + + just test # All tests + just test tests/test_cli_memory.py # Just this module + just test -k test_memory_no_detect_types # Just this test + +To run just the linters:: + + just lint + +To apply Black to your code:: + + just black + +To update documentation using Cog:: + + just cog + +To run the live documentation server (after building with Cog first):: + + just docs + +And to list all available commands:: + + just -l + .. _release_process: Release process