-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b8891c5
commit 4ddf9e8
Showing
2 changed files
with
63 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Development | ||
|
||
Dotbot uses the [Hatch] project manager ([installation instructions][hatch-install]). Hatch automatically manages dependencies and runs testing, type checking, and other operations in isolated [environments][hatch-environments]. | ||
|
||
[Hatch]: https://hatch.pypa.io/ | ||
[hatch-install]: https://hatch.pypa.io/latest/install/ | ||
[hatch-environments]: https://hatch.pypa.io/latest/environment/ | ||
|
||
## Testing | ||
|
||
You can run the tests on your local machine with: | ||
|
||
```bash | ||
hatch test | ||
``` | ||
|
||
The [`test` command][hatch-test] supports options such as `-c` for measuring test coverage, `-a` for testing with a matrix of Python versions, and appending an argument like `tests/test_shell.py::test_shell_can_override_defaults` for running a single test. | ||
|
||
[hatch-test]: https://hatch.pypa.io/latest/tutorials/testing/overview/ | ||
|
||
### Isolation | ||
|
||
Dotbot executes shell commands and interacts with the filesystem, and the tests exercise this functionality. The tests try to [insulate][dotbot-conftest] themselves from the machine, but if you prefer to run tests in an isolated container using Docker, you can do so with the following: | ||
|
||
```bash | ||
docker run -it --rm -v "${PWD}:/dotbot" -w /dotbot python:3.13-bookworm /bin/bash | ||
``` | ||
|
||
After spawning the container, install Hatch with `pip install hatch`, and then run the tests as described above. | ||
|
||
[dotbot-conftest]: tests/conftest.py | ||
|
||
## Type checking | ||
|
||
You can run the [mypy static type checker][mypy] with: | ||
|
||
```bash | ||
hatch run types:check | ||
``` | ||
|
||
[mypy]: https://mypy-lang.org/ | ||
|
||
## Formatting and linting | ||
|
||
You can run the [Ruff][ruff] formatter and linter with: | ||
|
||
```bash | ||
hatch fmt | ||
``` | ||
|
||
[ruff]: https://github.com/astral-sh/ruff | ||
|
||
## Packaging | ||
|
||
You can use `hatch build` to create build artifacts, a [source distribution ("sdist")][sdist] and a [built distribution ("wheel")][bdist]. | ||
|
||
[sdist]: https://packaging.python.org/en/latest/glossary/#term-Source-Distribution-or-sdist | ||
[bdist]: https://packaging.python.org/en/latest/glossary/#term-Built-Distribution |