Skip to content

Commit e2cc11d

Browse files
committed
Update md files + justfile
1 parent 9cd49fb commit e2cc11d

3 files changed

Lines changed: 91 additions & 51 deletions

File tree

CONTRIBUTING.md

Lines changed: 60 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,59 +2,78 @@
22

33
## Development
44

5-
- Use a virtual environment and pip for building and packaging of this Python project. For local development, create and activate a venv, then install the extras with pip.
5+
### Environment setup
66

7-
- We're using `pytest` for testing the code and a variety of plugins for linting
8-
and checking for bugs, including:
7+
Development uses [devbox](https://www.jetify.com/devbox) to provide a
8+
reproducible, isolated shell with all required tools (Python 3.12, `uv`,
9+
`just`, `taskwarrior`, etc.) without touching your system packages.
910

10-
- [mypy](http://mypy-lang.org/)
11-
- [pyright](https://github.com/Microsoft/pyright)
12-
- [pycln](https://hadialqattan.github.io/pycln/)
13-
- [isort](https://pypi.org/project/isort/)
14-
- [pre-commit](https://pre-commit.com/)
11+
1. [Install devbox](https://www.jetify.com/docs/devbox/installing-devbox).
1512

16-
All these development dependencies will be available inside a virtual
17-
environment. Recommended steps:
13+
1. Enter the dev shell and set up the project in one go:
1814

19-
```sh
20-
# create and activate a venv (example)
21-
python -m venv .venv
22-
source .venv/bin/activate
23-
python -m pip install --upgrade pip
15+
```sh
16+
devbox shell
17+
just setup-dev
18+
```
2419

25-
# install development and optional extras for testing
26-
python -m pip install -e ".[all]"
27-
```
20+
`devbox shell` activates the environment (creates a `.venv` and installs
21+
Python dependencies via `uv` automatically on first run). `just setup-dev`
22+
installs the package in editable mode and registers the `pre-commit` hooks.
2823

29-
To run all the linters in one go you can use `pre-commit`. To do this:
24+
1. For subsequent sessions just re-enter the shell:
3025

31-
1. Setup the `virtualenv` as described above.
32-
1. Get a shell inside the virtualenv. Install the `pre-commit` hook.
26+
```sh
27+
devbox shell # or: just shell
28+
```
3329

34-
```sh
35-
pre-commit install
36-
```
30+
### Common tasks via `just`
3731

38-
1. While inside this `virtualenv` you can run `pre-commit run --all-files` to
39-
run all the linting/formatting checks (excluding the tests).
40-
1. The linting and formatting programs will run on all files that changed on
41-
every new commit automatically.
32+
`just` is the project's task runner. Run `just` (no arguments) inside the dev
33+
shell to list all available recipes.
4234

43-
- To run the tests just run `pytest`. The pytest configuration for this project
44-
(as well as the configuration for each one of the tools can be found in the
45-
`pyproject.toml` file. At the time of writing it's the following:
35+
| Recipe | What it does |
36+
|---|---|
37+
| `just setup-dev` | Full first-time setup (deps + pre-commit) |
38+
| `just setup-deps` | Re-install Python dependencies only |
39+
| `just setup-pre-commit` | (Re-)install pre-commit hooks |
40+
| `just shell` | Open a devbox shell |
41+
| `just check` | Run all pre-commit checks across the whole codebase |
42+
| `just test` | Run the test suite |
43+
| `just gen-completions` | Regenerate shell completions |
4644

47-
```toml
48-
# pytest -----------------------------------------------------------------------
49-
[tool.pytest.ini_options]
50-
addopts = ["--ignore-glob=quickstart*", "--doctest-modules"]
51-
```
45+
### Linting and formatting
46+
47+
The project uses [ruff](https://docs.astral.sh/ruff/) for linting and
48+
formatting, wired up through [pre-commit](https://pre-commit.com/). The
49+
configuration lives in `pyproject.toml` under `[tool.ruff]`.
50+
51+
Use `just check` to run all checks (including ruff) across the whole codebase:
52+
53+
```sh
54+
just check
55+
```
56+
57+
All hooks also run automatically on every commit. To run only the ruff hooks:
58+
59+
```sh
60+
pre-commit run ruff --all-files
61+
```
62+
63+
### Running the tests
64+
65+
```sh
66+
just test
67+
```
68+
69+
The pytest configuration lives in `pyproject.toml`.
70+
71+
### Isolating test runs from your real data
5272

53-
- If you want to test your changes during development but don't want to tamper
54-
with your existing synchronizations, consider setting the `SYNCALL_TESTENV`
55-
environment variable before execution. With this variable set, `syncall`
56-
instead of `$XDG_CONFIG_HOME/syncall,` will use the
57-
`$XDG_CONFIG_HOME/test_syncall` directory.
73+
Set `SYNCALL_TESTENV` before running a sync executable to redirect all config
74+
reads/writes to `$XDG_CONFIG_HOME/test_syncall` instead of the default
75+
`$XDG_CONFIG_HOME/syncall`. This lets you experiment without touching your
76+
live synchronization data.
5877

5978
## Git Guidelines
6079

README.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -166,20 +166,23 @@ Here's some of the available options for installing it:
166166
pip3 install --user --upgrade .[gkeep,fs,google,tw,caldav,asana]
167167
```
168168

169-
- Setup using a virtualenv and pip - handy for local development and for isolation of dependencies:
169+
- Local development (recommended) — uses [devbox](https://www.jetify.com/devbox)
170+
for a reproducible environment and `just` as the task runner:
170171

171172
```sh
172173
git clone https://github.com/bergercookie/syncall
173-
python -m venv .venv
174-
source .venv/bin/activate
175-
python -m pip install --upgrade pip
176-
python -m pip install -e ".[all]"
177-
178-
# now the executables of all the services should be in your PATH for the
179-
# current shell and you can also edit the source code without further
180-
# re-installation ...
174+
cd syncall
175+
devbox shell # activates Python 3.12 + uv, creates .venv automatically
176+
just setup-dev # installs the package (editable) and pre-commit hooks
181177
```
182178

179+
All executables are now in your `PATH` for the current shell and source
180+
changes take effect immediately without re-installation. Run `just` to see
181+
all available development recipes.
182+
183+
See [CONTRIBUTING.md](CONTRIBUTING.md) for the full development guide
184+
(linting with `ruff`, running tests, etc.).
185+
183186
### Sample Usage Instructions
184187

185188
Here's the CLI help page for the synchronizations available.

justfile

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,25 @@ setup-pre-commit:
3030

3131
# Install dependencies for local development
3232
setup-deps:
33-
python -m pip install -e ".[all]"
33+
uv pip install -e ".[all]"
34+
35+
# check / test recipes ---------------------------------------------------------
36+
37+
alias pre-commit := check
38+
39+
# Run all pre-commit hooks against all files (lint, format, and other checks)
40+
check:
41+
pre-commit run --all-files
42+
43+
# Run the test suite
44+
test *args='':
45+
pytest {{ args }}
46+
47+
# scripts ----------------------------------------------------------------------
48+
49+
# Generate shell completions (bash, zsh, fish) for all sync executables
50+
gen-completions:
51+
bash scripts/generate-shell-completions.sh
3452

3553
# self -------------------------------------------------------------------------
3654

0 commit comments

Comments
 (0)