Skip to content

Commit 7529ee2

Browse files
authored
chore: add devcontainer configuration (#288)
1 parent 9e4df09 commit 7529ee2

File tree

6 files changed

+66
-2
lines changed

6 files changed

+66
-2
lines changed

.devcontainer/devcontainer.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Format: https://containers.dev/implementors/json_reference/
2+
{
3+
"name": "Python",
4+
// Supported image versions: https://github.com/devcontainers/images/issues/90
5+
// README: https://github.com/devcontainers/images/tree/main/src/python
6+
"image": "mcr.microsoft.com/devcontainers/python:3.13-bookworm",
7+
// https://containers.dev/features
8+
"features": {
9+
"ghcr.io/jsburckhardt/devcontainer-features/uv:1": {
10+
"version": "0.6.13"
11+
}
12+
},
13+
"postCreateCommand": "uv sync && git config push.autosetupremote true && uv run pre-commit install-hooks && uv run pre-commit install",
14+
// Tool-specific properties: https://containers.dev/supporting
15+
"customizations": {
16+
"vscode": {
17+
// see also .vscode/extensions.json
18+
"extensions": [
19+
"EditorConfig.EditorConfig",
20+
"DavidAnson.vscode-markdownlint",
21+
"redhat.vscode-yaml",
22+
"streetsidesoftware.code-spell-checker",
23+
"yzhang.markdown-all-in-one"
24+
],
25+
// keep this in sync with .vscode/settings.json
26+
"settings": {
27+
// see: https://squidfunk.github.io/mkdocs-material/creating-your-site/?h=vscode#minimal-configuration-visual-studio-code
28+
"yaml.schemas": {
29+
"https://squidfunk.github.io/mkdocs-material/schema.json": "mkdocs.yml"
30+
},
31+
"yaml.customTags": [
32+
"!ENV scalar",
33+
"!ENV sequence",
34+
"!relative scalar",
35+
"tag:yaml.org,2002:python/name:material.extensions.emoji.to_svg",
36+
"tag:yaml.org,2002:python/name:material.extensions.emoji.twemoji",
37+
"tag:yaml.org,2002:python/name:pymdownx.superfences.fence_code_format"
38+
]
39+
}
40+
}
41+
}
42+
}

.pre-commit-config.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,14 @@ repos:
1212
- id: check-executables-have-shebangs
1313
- id: check-json
1414
# file contains comments
15-
exclude: ^\.vscode/settings.json$
15+
exclude: |
16+
(?x)(
17+
^(
18+
\.vscode/settings\.json
19+
|\.vscode/extensions\.json
20+
|\.devcontainer/devcontainer.json
21+
)
22+
)
1623
- id: check-merge-conflict
1724
- id: check-toml
1825
- id: check-xml
@@ -77,6 +84,12 @@ repos:
7784
- id: check-renovate
7885
args: ["--verbose"]
7986
additional_dependencies: ['json5']
87+
# requires: https://github.com/python-jsonschema/check-jsonschema/issues/341
88+
# - id: check-jsonschema
89+
# name: "Validate devcontainer"
90+
# files: ^\.devcontainer/.*\.json$
91+
# args: ["--schemafile", "https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.schema.json"]
92+
# waiting for custom YAML tags support: https://github.com/python-jsonschema/check-jsonschema/issues/489
8093
# - id: check-jsonschema
8194
# name: "Validate MkDocs file"
8295
# files: ^mkdocs\.ya?ml$

.vscode/extensions.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
2+
// keep in sync with extensions in .devcontainer/devcontainer.json
23
"recommendations": [
34
"editorconfig.editorconfig",
45
"redhat.vscode-yaml",
56
"davidanson.vscode-markdownlint",
6-
"streetsidesoftware.code-spell-checker"
7+
"streetsidesoftware.code-spell-checker",
8+
"yzhang.markdown-all-in-one"
79
]
810
}

.vscode/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
// keep in sync with settings in .devcontainer/devcontainer.json
12
{
3+
// see: https://squidfunk.github.io/mkdocs-material/creating-your-site/?h=vscode#minimal-configuration-visual-studio-code
24
"yaml.schemas": {
35
"https://squidfunk.github.io/mkdocs-material/schema.json": "mkdocs.yml"
46
},

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ The documentation is split into several parts:
2929

3030
### Getting started
3131

32+
> [!NOTE]
33+
> If you use [GitHub Codespaces](https://github.com/features/codespaces) or use a *Dev Container* extension, you do not need to do any of the below steps.
34+
> They are run automatically on startup.
35+
3236
All you need is [`uv`](https://docs.astral.sh/uv) to set up your environment.
3337

3438
```shell

REUSE.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ SPDX-License-Identifier = "CC-BY-SA-4.0"
2020

2121
[[annotations]]
2222
path = [
23+
".devcontainer/devcontainer.json",
2324
".vscode/extensions.json",
2425
".vscode/settings.json",
2526
]

0 commit comments

Comments
 (0)