Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Build/Test Commands
- Run tests: `tox -e py3` but should also work with just `python -m pytest dandi` if in a venv
- Run tests with hatch: `hatch run test:run`
- Run tests with tox: `tox -e py3` or `python -m pytest dandi` if in a venv
- Tests which require an instance of the archive, would use a fixture to start on using docker-compose.
- Set env var `DANDI_TESTS_PULL_DOCKER_COMPOSE=""` (to empty value) to avoid `docker compose pull` to speed up repetitive runs
- Run single test: `tox r -e py3 -- dandi/tests/test_file.py::test_function -v`
- Run single test with hatch: `hatch run test:run dandi/tests/test_file.py::test_function -v`
- Run single test with tox: `tox r -e py3 -- dandi/tests/test_file.py::test_function -v`
- Lint and type checking: `tox -e lint,typing`
- Install pre-commit hooks (if not installed as could be indicated by absence of
`.git/hooks/pre-commit`): `pre-commit install`
Expand Down
46 changes: 45 additions & 1 deletion DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,40 @@

## Development environment

### Using hatch

This project's hatch environments use [uv](https://github.com/astral-sh/uv)
as the installer, which allows for significant improvements in environment
setup speed. Each environment corresponds to a project
extra (e.g., `test`, `style`, `tools`). To enter a shell in an environment:

```
hatch shell <env-name>
```

For example, to enter the `test` environment:

```
hatch shell test
```

To remove environments so they can be recreated from scratch:

```
hatch env remove <env-name> # remove a specific environment
```

or to remove all environments at once:

```
hatch env prune
```

Refer to [hatch's documentation](https://hatch.pypa.io/latest/cli/reference/)
for full CLI usage.

### Using a virtualenv

Assuming that you have `python3` (and virtualenv) installed, the fastest
way to establish yourself a development environment (or a sample deployment),
is via virtualenv:
Expand All @@ -23,7 +57,17 @@ pre-commit install

### Running tests locally

You can run all tests locally by running `tox` (you can install `tox` running `pip install tox`):
With hatch:
```
hatch run test:run
```

To run a specific test:
```
hatch run test:run dandi/tests/test_file.py::test_function -v
```

Alternatively, with `tox` (install via `pip install tox`):
```
tox -e py3
```
Expand Down
28 changes: 28 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -219,3 +219,31 @@ ignore_missing_imports = true

[tool.pydantic-mypy]
init_forbid_extra = true

[tool.hatch.envs.default]
installer = "uv"
python = "3.10"

[tool.hatch.envs.extensions]
features = ["extensions"]

[tool.hatch.envs.extras]
features = ["extras"]

[tool.hatch.envs.style]
features = ["style"]

[tool.hatch.envs.test]
features = ["test"]
[tool.hatch.envs.test.env-vars]
# Disable the fallback to sequential next-link pagination so tests immediately
# catch if the server changes its pagination strategy.
DANDI_PAGINATION_DISABLE_FALLBACK = "1"
[tool.hatch.envs.test.scripts]
run = "pytest {args:dandi/tests}"

[tool.hatch.envs.tools]
features = ["tools"]

[tool.hatch.envs.all]
features = ["all"]
Loading