|
2 | 2 |
|
3 | 3 | All contributions are welcome! Besides code contributions, this includes things like documentation improvements, bug reports, and feature requests. |
4 | 4 |
|
5 | | -You should first check if there is a [GitHub issue](https://github.com/joshuadavidthomas/django-bird/issues) already open or related to what you would like to contribute. If there is, please comment on that issue to let others know you are working on it. If there is not, please open a new issue to discuss your contribution. |
| 5 | +You should first check if there is a [GitHub issue](https://github.com/joshuadavidthomas/django-github-app/issues) already open or related to what you would like to contribute. If there is, please comment on that issue to let others know you are working on it. If there is not, please open a new issue to discuss your contribution. |
6 | 6 |
|
7 | 7 | Not all contributions need to start with an issue, such as typo fixes in documentation or version bumps to Python or Django that require no internal code changes, but generally, it is a good idea to open an issue first. |
8 | 8 |
|
9 | 9 | We adhere to Django's Code of Conduct in all interactions and expect all contributors to do the same. Please read the [Code of Conduct](https://www.djangoproject.com/conduct/) before contributing. |
10 | 10 |
|
11 | | -## Setup |
| 11 | +### Requirements |
| 12 | + |
| 13 | +- [uv](https://github.com/astral-sh/uv) - Modern Python toolchain that handles: |
| 14 | + - Python version management and installation |
| 15 | + - Virtual environment creation and management |
| 16 | + - Fast, reliable dependency resolution and installation |
| 17 | + - Reproducible builds via lockfile |
| 18 | +- [direnv](https://github.com/direnv/direnv) (Optional) - Automatic environment variable loading |
| 19 | +- [just](https://github.com/casey/just) (Optional) - Command runner for development tasks |
| 20 | + |
| 21 | +### `Justfile` |
| 22 | + |
| 23 | +The repository includes a `Justfile` that provides all common development tasks with a consistent interface. Running `just` without arguments shows all available commands and their descriptions: |
| 24 | + |
| 25 | +```bash |
| 26 | +$ just |
| 27 | +# or explicitly |
| 28 | +$ just --list --list-submodules |
| 29 | +<!-- [[[cog |
| 30 | +import subprocess |
| 31 | +import cog |
| 32 | + |
| 33 | +output_raw = subprocess.run(['just', '--list', '--list-submodules'], stdout=subprocess.PIPE) |
| 34 | +output_list = output_raw.stdout.decode('utf-8').split('\n') |
| 35 | + |
| 36 | +for i, line in enumerate(output_list): |
| 37 | + if not line: |
| 38 | + continue |
| 39 | + cog.out(line) |
| 40 | + if i < len(output_list): |
| 41 | + cog.out('\n') |
| 42 | +]]] --> |
| 43 | +Available recipes: |
| 44 | + bootstrap |
| 45 | + coverage *ARGS |
| 46 | + lint |
| 47 | + lock *ARGS |
| 48 | + manage *COMMAND |
| 49 | + test *ARGS |
| 50 | + testall *ARGS |
| 51 | + types *ARGS |
| 52 | + docs: |
| 53 | + build LOCATION="docs/_build/html" # Build documentation using Sphinx |
| 54 | + serve PORT="8000" # Serve documentation locally |
| 55 | +<!-- [[[end]]] --> |
| 56 | +``` |
12 | 57 |
|
13 | | -The following setup steps assume you are using a Unix-like operating system, such as Linux or macOS, and that you have a [supported](https://django-bird.readthedocs.io/#requirements) version of Python installed. If you are using Windows, you will need to adjust the commands accordingly. If you do not have Python installed, you can visit [python.org](https://www.python.org/) for instructions on how to install it for your operating system. |
| 58 | +All commands below will contain the full command as well as its `just` counterpart. |
14 | 59 |
|
15 | | -1. Fork the repository and clone it locally. |
16 | | -2. Create a virtual environment and activate it. You can use whatever tool you prefer for this. Below is an example using the Python standard library's `venv` module: |
| 60 | +## Setup |
17 | 61 |
|
18 | | -```shell |
19 | | -python -m venv venv |
20 | | -source venv/bin/activate |
21 | | -``` |
| 62 | +The following instructions will use `uv` and assume a Unix-like operating system (Linux or macOS). |
22 | 63 |
|
23 | | -3. Install `django-bird` and the `dev` dependencies in editable mode: |
| 64 | +Windows users will need to adjust commands accordingly, though the core workflow remains the same. |
| 65 | +Alternatively, any Python package manager that supports installing from `pyproject.toml` ([PEP 621](https://peps.python.org/pep-0621/)) can be used. If not using `uv`, ensure you have Python installed from [python.org](https://www.python.org/). |
24 | 66 |
|
25 | | -```shell |
26 | | -python -m pip install --editable '.[dev]' |
27 | | -# or using [just](#just) |
| 67 | +1. Fork the repository and clone it locally. |
| 68 | +2. Use `uv` too bootstrap your development environment: |
| 69 | +
|
| 70 | +```bash |
| 71 | +uv python install |
| 72 | +uv sync --locked |
| 73 | +# or |
28 | 74 | just bootstrap |
29 | 75 | ``` |
30 | 76 |
|
31 | | -## Testing |
| 77 | + This will install the correct Python version, create and configure a virtual environment, and install all dependencies. |
| 78 | +
|
| 79 | +## Tests |
32 | 80 |
|
33 | | -We use [`pytest`](https://docs.pytest.org/) for testing and [`nox`](https://nox.thea.codes/) to run the tests in multiple environments. |
| 81 | +The project uses [`pytest`](https://docs.pytest.org/) for testing and [`nox`](https://nox.thea.codes/) to run the tests in multiple environments. |
34 | 82 |
|
35 | 83 | To run the test suite against the default versions of Python (lower bound of supported versions) and Django (lower bound of LTS versions), run: |
36 | 84 |
|
37 | | -```shell |
38 | | -python -m nox --session "test" |
39 | | -# or using [just](#just) |
| 85 | +```bash |
| 86 | +uv run nox --session test |
| 87 | +# or |
40 | 88 | just test |
41 | 89 | ``` |
42 | 90 |
|
43 | | -To run the test suite against all supported versions of Python and Django, run: |
| 91 | +To run the test suite against the entire matrix of supported versions of Python and Django, run: |
44 | 92 |
|
45 | | -```shell |
46 | | -python -m nox --session "tests" |
47 | | -# or using [just](#just) |
| 93 | +```bash |
| 94 | +uv run nox --session tests |
| 95 | +# or |
48 | 96 | just testall |
49 | 97 | ``` |
50 | 98 |
|
51 | | -## `just` |
52 | | - |
53 | | -[`just`](https://github.com/casey/just) is a command runner that is used to run common commands, similar to `make` or `invoke`. A `Justfile` is provided at the base of the repository, which contains commands for common development tasks, such as running the test suite or linting. |
54 | | - |
55 | | -To see a list of all available commands, ensure `just` is installed and run the following command at the base of the repository: |
| 99 | +Both can be passed additional arguments that will be provided to pytest: |
56 | 100 |
|
57 | | -```shell |
58 | | -just |
| 101 | +```bash |
| 102 | +uv run nox --session test -- -v --last-failed |
| 103 | +uv run nox --session tests -- --failed-first --maxfail=1 |
| 104 | +# or |
| 105 | +just test -v --last-failed |
| 106 | +just testall --failed-first --maxfail=1 |
59 | 107 | ``` |
0 commit comments