Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand DEVELOPERS docs #9

Merged
merged 2 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 52 additions & 2 deletions DEVELOPERS.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Notes for developers


## Local development environment
## Prerequisites for local development

We use [just](https://github.com/casey/just) as our command runner.
### Just

We use [`just`](https://github.com/casey/just) as our command runner. It's
a single file binary available for many platforms so should be easy to
install.

```sh
# macOS
Expand All @@ -19,7 +23,53 @@ source <(just --completions bash)
just # shortcut for just --list
```

### Python

You'll need an appropriate version of Python on your PATH. Check the
`.python-version` file for the required version.

### Docker

Possibly something API compatibile with Docker would also work, but we
don't officially support that.


## Getting started

Set up a local development environment with:
```
just devenv
```

You'll probably find you need to run this twice. The first time it will
complain that you don't have a `.env` environment file and will create
one for you. Then you'll need to run the command again with the `.env`
file in place.

Check that Django is configured correctly with:
```
just manage check
```

You can run all the tests with:
```
just test
```

### Running commands without using `just`

`just` automatically takes care of a few things:

* ensuring commands are run using the correct Python virtual
environment;
* ensuring that the installed packages match what's specified in the
`requirements.*.txt` files;
* ensuring that the variables specified in `.env` are loaded into the
environment.

Running commands outside of `just` is a reasonable and supported
workflow, but you will need to handle the above tasks yourself e.g. by
activating a virtual environment and running something like:
```bash
set -a; source .env; set +a
```
5 changes: 5 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,13 @@ virtualenv: ensure-env

# create venv and upgrade pip
if [[ ! -d $VIRTUAL_ENV ]]; then
# Collapse output when running in Github Actions
[[ -v CI ]] && echo "::group::Setting up venv (click to view)" || true

$PYTHON_VERSION -m venv $VIRTUAL_ENV
$PIP install --upgrade pip

[[ -v CI ]] && echo "::endgroup::" || true
fi


Expand Down