|
| 1 | +## Creating a development environment |
| 2 | + |
| 3 | +If you plan to make code changes to this repository, you will need to install the following dependencies first: |
| 4 | + |
| 5 | +- [Git](https://git-scm.com/downloads) |
| 6 | +- [Python 3.9+](https://www.python.org/downloads/) |
| 7 | +- [Hatch](https://hatch.pypa.io/latest/) |
| 8 | + |
| 9 | +Once you finish installing these dependencies, you can clone this repository: |
| 10 | + |
| 11 | +```shell |
| 12 | +git clone https://github.com/reactive-python/reactpy-router.git |
| 13 | +cd reactpy-router |
| 14 | +``` |
| 15 | + |
| 16 | +## Executing test environment commands |
| 17 | + |
| 18 | +By utilizing `hatch`, the following commands are available to manage the development environment. |
| 19 | + |
| 20 | +### Tests |
| 21 | + |
| 22 | +| Command | Description | |
| 23 | +| --- | --- | |
| 24 | +| `hatch test` | Run Python tests using the current environment's Python version | |
| 25 | +| `hatch test --all` | Run tests using all compatible Python versions | |
| 26 | +| `hatch test --python 3.9` | Run tests using a specific Python version | |
| 27 | +| `hatch test -k test_navigate_with_link` | Run only a specific test | |
| 28 | + |
| 29 | +??? question "What other arguments are available to me?" |
| 30 | + |
| 31 | + The `hatch test` command is a wrapper for `pytest`. Hatch "intercepts" a handful of arguments, which can be previewed by typing `hatch test --help`. |
| 32 | + |
| 33 | + Any additional arguments in the `test` command are directly passed on to pytest. See the [pytest documentation](https://docs.pytest.org/en/stable/reference/reference.html#command-line-flags) for what additional arguments are available. |
| 34 | + |
| 35 | +### Linting and Formatting |
| 36 | + |
| 37 | +| Command | Description | |
| 38 | +| --- | --- | |
| 39 | +| `hatch fmt` | Run all linters and formatters | |
| 40 | +| `hatch fmt --check` | Run all linters and formatters, but do not save fixes to the disk | |
| 41 | +| `hatch fmt --linter` | Run only linters | |
| 42 | +| `hatch fmt --formatter` | Run only formatters | |
| 43 | + |
| 44 | +??? tip "Configure your IDE for linting" |
| 45 | + |
| 46 | + This repository uses `hatch fmt` for linting and formatting, which is a [modestly customized](https://hatch.pypa.io/latest/config/internal/static-analysis/#default-settings) version of [`ruff`](https://github.com/astral-sh/ruff). |
| 47 | + |
| 48 | + You can install `ruff` as a plugin to your preferred code editor to create a similar environment. |
| 49 | + |
| 50 | +### Documentation |
| 51 | + |
| 52 | +| Command | Description | |
| 53 | +| --- | --- | |
| 54 | +| `hatch run docs:serve` | Start the [`mkdocs`](https://www.mkdocs.org/) server to view documentation locally | |
| 55 | +| `hatch run docs:build` | Build the documentation | |
| 56 | +| `hatch run docs:linkcheck` | Check for broken links in the documentation | |
| 57 | + |
| 58 | +### Environment Management |
| 59 | + |
| 60 | +| Command | Description | |
| 61 | +| --- | --- | |
| 62 | +| `hatch build --clean` | Build the package from source | |
| 63 | +| `hatch env prune` | Delete all virtual environments created by `hatch` | |
| 64 | +| `hatch python install 3.12` | Install a specific Python version to your system | |
| 65 | + |
| 66 | +??? tip "Check out Hatch for all available commands!" |
| 67 | + |
| 68 | + This documentation only covers commonly used commands. |
| 69 | + |
| 70 | + You can type `hatch --help` to see all available commands. |
0 commit comments