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
14 changes: 14 additions & 0 deletions .devcontainer/devcontainer-lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"features": {
"ghcr.io/devcontainers-extra/features/pandoc:1": {
"version": "1.0.15",
"resolved": "ghcr.io/devcontainers-extra/features/pandoc@sha256:c700be82b7d6448aac4bae5bd97745a3c031870ba98e34269e8052d06868849f",
"integrity": "sha256:c700be82b7d6448aac4bae5bd97745a3c031870ba98e34269e8052d06868849f"
},
"ghcr.io/devcontainers-extra/features/uv:1": {
"version": "1.0.2",
"resolved": "ghcr.io/devcontainers-extra/features/uv@sha256:1ac5b9f17a9e9e745933d0ac2ecf758e06ed3da4423cd22c94cce4d482fd2dd8",
"integrity": "sha256:1ac5b9f17a9e9e745933d0ac2ecf758e06ed3da4423cd22c94cce4d482fd2dd8"
}
}
}
33 changes: 33 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "python-blosc2",
"image": "mcr.microsoft.com/devcontainers/python:3-3.12",
"features": {
"ghcr.io/devcontainers-extra/features/uv:1": {},
// nbsphinx needs pandoc to render the notebooks in doc/
"ghcr.io/devcontainers-extra/features/pandoc:1": {}
},
// Already set by Microsoft's container, but more clear for /home below
"remoteUser": "vscode",
"containerEnv": {
// Keep the venv out of the bind-mounted checkout so it never collides with a host-side .venv
"UV_PROJECT_ENVIRONMENT": "/home/vscode/.venv"
},
"remoteEnv": {
"PATH": "/home/vscode/.venv/bin:${containerEnv:PATH}"
},
"updateContentCommand": "uv sync --group dev --group test --group doc && pre-commit install",
"customizations": {
"vscode": {
"settings": {
"python.defaultInterpreterPath": "/home/vscode/.venv/bin/python",
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff"
}
},
"extensions": [
"ms-python.python",
"charliermarsh.ruff"
]
}
}
}
35 changes: 35 additions & 0 deletions README_DEVELOPERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,41 @@ pre-commit install

Pre-commit will now run automatically on `git commit`.

### Using a dev container

As an alternative to a local setup, the repository includes a
[dev container](https://containers.dev) configuration in `.devcontainer/`. It
provides a Linux environment with Python 3.12 (to match the version used by the
main CI test job), uv, and pandoc, and uses uv to install the `dev`, `test` and
`doc` groups for you.

You need Docker (or a compatible engine) and a client that supports dev
containers, such as VS Code with the
[Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
extension (or Cursor or a similar fork with a compatible extension), GitHub
Codespaces, or the
[`devcontainer` CLI](https://github.com/devcontainers/cli). In VS Code, open the
repository and run **Dev Containers: Reopen in Container**. The first build
compiles the C extension and takes a few minutes; later sessions reuse the
container and so skip the compilation and launch faster.

Things to know:

- The virtual environment lives at `/home/vscode/.venv`, outside the checkout,
and is on `PATH`, so `pytest`, `python -m sphinx`, etc. work as shown in this
document. A `.venv` created on the host is ignored.
- The pre-commit hook is installed for you. The `.git` directory is shared with
the host (i.e., your computer outside the container), which means the same hook
also runs for commits made on the host. Be sure to run commits from inside the
container; committing from the host requires `pre-commit` to be installed there
as well.
- After dependencies change in `pyproject.toml`, run
`uv sync --group dev --group test --group doc` again, or rebuild the container.
- On Windows, clone the repository inside the WSL filesystem (or use **Dev
Containers: Clone Repository in Container Volume**). A checkout on a Windows
drive (e.g., `C:\`) is mounted through a slow file-sharing layer, so avoid
opening the dev container straight from a Windows checkout, where you can.

### On Windows

clang-cl is required. Make sure LLVM is on `PATH` and build with Ninja:
Expand Down
Loading