File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
44
55## Build/Test Commands
6- - Run tests: ` tox -e py3 ` but should also work with just ` python -m pytest dandi ` if in a venv
6+ - Run tests with hatch: ` hatch run test:run `
7+ - Run tests with tox: ` tox -e py3 ` or ` python -m pytest dandi ` if in a venv
78- Tests which require an instance of the archive, would use a fixture to start on using docker-compose.
89- Set env var ` DANDI_TESTS_PULL_DOCKER_COMPOSE="" ` (to empty value) to avoid ` docker compose pull ` to speed up repetitive runs
9- - Run single test: ` tox r -e py3 -- dandi/tests/test_file.py::test_function -v `
10+ - Run single test with hatch: ` hatch run test:run dandi/tests/test_file.py::test_function -v `
11+ - Run single test with tox: ` tox r -e py3 -- dandi/tests/test_file.py::test_function -v `
1012- Lint and type checking: ` tox -e lint,typing `
1113- Install pre-commit hooks (if not installed as could be indicated by absence of
1214 ` .git/hooks/pre-commit ` ): ` pre-commit install `
Original file line number Diff line number Diff line change 22
33## Development environment
44
5+ ### Using hatch
6+
7+ This project's hatch environments use [ uv] ( https://github.com/astral-sh/uv )
8+ as the installer, which allows for significant improvements in environment
9+ setup speed. Each environment corresponds to a project
10+ extra (e.g., ` test ` , ` style ` , ` tools ` ). To enter a shell in an environment:
11+
12+ ```
13+ hatch shell <env-name>
14+ ```
15+
16+ For example, to enter the ` test ` environment:
17+
18+ ```
19+ hatch shell test
20+ ```
21+
22+ To remove environments so they can be recreated from scratch:
23+
24+ ```
25+ hatch env remove <env-name> # remove a specific environment
26+ ```
27+
28+ or to remove all environments at once:
29+
30+ ```
31+ hatch env prune
32+ ```
33+
34+ Refer to [ hatch's documentation] ( https://hatch.pypa.io/latest/cli/reference/ )
35+ for full CLI usage.
36+
37+ ### Using a virtualenv
38+
539Assuming that you have ` python3 ` (and virtualenv) installed, the fastest
640way to establish yourself a development environment (or a sample deployment),
741is via virtualenv:
@@ -23,7 +57,17 @@ pre-commit install
2357
2458### Running tests locally
2559
26- You can run all tests locally by running ` tox ` (you can install ` tox ` running ` pip install tox ` ):
60+ With hatch:
61+ ```
62+ hatch run test:run
63+ ```
64+
65+ To run a specific test:
66+ ```
67+ hatch run test:run dandi/tests/test_file.py::test_function -v
68+ ```
69+
70+ Alternatively, with ` tox ` (install via ` pip install tox ` ):
2771```
2872tox -e py3
2973```
Original file line number Diff line number Diff line change @@ -219,3 +219,31 @@ ignore_missing_imports = true
219219
220220[tool .pydantic-mypy ]
221221init_forbid_extra = true
222+
223+ [tool .hatch .envs .default ]
224+ installer = " uv"
225+ python = " 3.10"
226+
227+ [tool .hatch .envs .extensions ]
228+ features = [" extensions" ]
229+
230+ [tool .hatch .envs .extras ]
231+ features = [" extras" ]
232+
233+ [tool .hatch .envs .style ]
234+ features = [" style" ]
235+
236+ [tool .hatch .envs .test ]
237+ features = [" test" ]
238+ [tool .hatch .envs .test .env-vars ]
239+ # Disable the fallback to sequential next-link pagination so tests immediately
240+ # catch if the server changes its pagination strategy.
241+ DANDI_PAGINATION_DISABLE_FALLBACK = " 1"
242+ [tool .hatch .envs .test .scripts ]
243+ run = " pytest {args:dandi/tests}"
244+
245+ [tool .hatch .envs .tools ]
246+ features = [" tools" ]
247+
248+ [tool .hatch .envs .all ]
249+ features = [" all" ]
You can’t perform that action at this time.
0 commit comments