@@ -15,85 +15,45 @@ When using this template remember to:
1515
1616## Getting started
1717
18+ ### Prerequisites
19+
20+ Install the ` uv ` package manager by following the [ official documentation] ( https://docs.astral.sh/uv/getting-started/installation/ ) .
21+
1822### Install via makefile
1923
2024``` commandline
2125make setup
2226```
2327
24- This will create a virtual environment called ` venv ` , build ` requirements.txt ` and
25- ` requirements-dev.txt ` from ` pyproject.toml ` if they're out of date, install the Python
26- and Node dependencies and install ` pre-commit ` .
27-
28- It's safe and fast to run ` make setup ` repeatedly as it will only update these things if
29- they have changed.
30-
31- After ` make setup ` you can run ` pre-commit ` to run pre-commit checks on staged changes and
32- ` pre-commit run --all-files ` to run them on all files. This replicates the linter checks that
33- run from GitHub actions.
34-
35-
36- ### Alternative installation
37-
38- You will need Python 3.11. On Debian you may need:
39- * ` sudo add-apt-repository -y 'deb http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal main' ` (or ` jammy ` in place of ` focal ` for later Debian)
40- * ` sudo apt update `
41- * ` sudo apt install python3.11 python3.11-venv `
42-
43- and on Ubuntu you may need
44- * ` sudo add-apt-repository -y 'ppa:deadsnakes/ppa' `
45- * ` sudo apt update `
46- * ` sudo apt install python3.11 python3.11-venv `
47-
48- To prepare running it:
28+ This will create a Python virtual environment, install basic testing and linting
29+ dependencies and install ` pre-commit ` .
4930
50- * ` virtualenv venv -p python3.11 `
51- * ` . venv/bin/activate `
52- * ` rehash `
53- * ` python -m ensurepip -U `
54- * ` pip3 install -r requirements.txt `
55- * ` pip3 install -r requirements-dev.txt `
56-
57- You should also configure your IDE to use black so that code is automatically reformatted on save.
31+ After ` make setup ` you can run ` make check ` to run linting and type checking.
5832
5933## Building and testing
6034
61- This component uses ` pytest ` tests and the ` ruff ` and ` black ` linters. ` black ` will reformat your code in an
62- opinionated way.
35+ This component uses ` pytest ` tests and the ` ruff ` linter and ` pyright ` type checker.
36+
37+ See Makefile for all available commands.
6338
6439A number of ` make ` targets are defined:
6540* ` make test ` : run tests continuously
6641* ` make testonce ` : run tests once
67- * ` make lint ` : lint and reformat
42+ * ` make check ` : run linting and type checking
43+ * ` make format ` : reformat code
44+ * ` make install ` : install dependencies
45+ * ` make update ` : update dependencies
6846* ` make dockerbuild ` : build a ` latest ` Docker image (use ` make dockerbuild ` VERSION=1.2.3` for a release image)
6947* ` make dockerpush ` : push a ` latest ` Docker image (again, you can add ` VERSION=1.2.3 ` ) - normally this should be done
7048 only via the build system and its GitHub actions.
7149
72- ## Managing requirements
73-
74- Requirements are specified in ` pyproject.toml ` , with development requirements listed separately. Specify version
75- constraints as necessary but not specific versions. After changing them:
76-
77- * Run ` pip-compile ` (or ` pip-compile -U ` to upgrade requirements within constraints) to regenerate ` requirements.txt `
78- * Run ` pip-compile --extra dev -o requirements-dev.txt ` (again, add ` -U ` to upgrade) to regenerate
79- ` requirements-dev.txt ` .
80- * Run the ` pip3 install -r requirements.txt ` and ` pip3 install -r requirements-dev.txt ` commands again and test.
81- * Commit these files.
82-
83- If you see the error
84-
85- ``` commandline
86- Backend subprocess exited when trying to invoke get_requires_for_build_wheel
87- Failed to parse /.../template-python/pyproject.toml
88- ```
89-
90- then install and run ` validate-pyproject pyproject.toml ` and/or ` pip3 install . ` to check its syntax.
50+ ## Managing dependencies
9151
92- To check for vulnerable dependencies , run ` pip-audit ` .
52+ To add a new dependency , run ` uv add <dependency> ` or see ` uv help add ` .
9353
9454## Releasing
9555
96- Ensure that ` make lint ` and ` make test ` work correctly and produce no further changes to code formatting before
56+ Ensure that ` make check ` and ` make test ` work correctly and produce no further changes to code formatting before
9757continuing.
9858
9959Releases tagged ` latest ` and targeted at development environments can be created from the ` main ` branch. Releases for
0 commit comments