Skip to content

Commit dee6830

Browse files
Update resonant-cookiecutter to v0.51.1
1 parent fa378ff commit dee6830

17 files changed

Lines changed: 411 additions & 4 deletions

.copier-answers.resonant.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
_commit: v0.48.1
1+
_commit: v0.51.1
22
_src_path: https://github.com/kitware-resonant/cookiecutter-resonant
33
core_app_name: api
44
include_example_code: false

.devcontainer/devcontainer.json

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
22
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose
33
{
4+
<<<<<<< before updating
45
"name": "DANDI Archive Django",
56
"dockerComposeFile": [
67
"../docker-compose.yml",
@@ -78,4 +79,94 @@
7879
"--all-extras",
7980
"--all-groups"
8081
]
82+
=======
83+
"name": "DANDI Archive",
84+
"dockerComposeFile": [
85+
"../docker-compose.yml",
86+
"../docker-compose.override.yml",
87+
"./docker-compose.devcontainer.yml"
88+
],
89+
"service": "django",
90+
"overrideCommand": true,
91+
// The "vscode" user and remoteUser are set by the base image label (devcontainers/base).
92+
"workspaceFolder": "/home/vscode/dandiapi",
93+
"features": {
94+
"ghcr.io/devcontainers/features/git-lfs:1": {},
95+
"ghcr.io/devcontainers/features/node:2": {
96+
"version": "24",
97+
// Work around https://github.com/devcontainers/features/pull/1625
98+
"pnpmVersion": "none"
99+
},
100+
"ghcr.io/rails/devcontainer/features/postgres-client:1": {
101+
"version": 18
102+
},
103+
"ghcr.io/devcontainers/features/terraform:1": {},
104+
"ghcr.io/devcontainers/features/aws-cli:1": {},
105+
"ghcr.io/devcontainers/features/github-cli:1": {},
106+
"ghcr.io/devcontainers-extra/features/heroku-cli:1": {}
107+
},
108+
"customizations": {
109+
"vscode": {
110+
"extensions": [
111+
// Python
112+
"ms-python.python",
113+
"ms-python.vscode-pylance",
114+
"ms-python.debugpy",
115+
"ms-python.mypy-type-checker",
116+
"charliermarsh.ruff",
117+
// Django
118+
"batisteo.vscode-django",
119+
"augustocdias.tasks-shell-input",
120+
// Other file formats
121+
"editorconfig.editorconfig",
122+
"mikestead.dotenv",
123+
"tamasfe.even-better-toml",
124+
"timonwong.shellcheck",
125+
// Infrastructure
126+
"ms-azuretools.vscode-containers",
127+
"hashicorp.terraform",
128+
"github.vscode-github-actions",
129+
// Remove AWS extension, as only the CLI is wanted; see: https://github.com/devcontainers/features/issues/1228
130+
"-AmazonWebServices.aws-toolkit-vscode"
131+
],
132+
"settings": {
133+
"containers.containerClient": "com.microsoft.visualstudio.containers.docker",
134+
// Container-specific Python paths
135+
"python.defaultInterpreterPath": "/home/vscode/venv/bin/python",
136+
// Disable automatic Python venv activation in new terminals.
137+
"python-envs.terminal.autoActivationType": "off",
138+
// Ensure that `envFile` from any user settings is ignored; Docker Compose provides it.
139+
"python.envFile": "",
140+
// Reduce file watcher overhead for generated/cache directories.
141+
"files.watcherExclude": {
142+
"**/__pycache__/**": true,
143+
"**/.pytest_cache/**": true,
144+
"**/node_modules/**": true
145+
}
146+
}
147+
}
148+
},
149+
// Prevent a prompt every time the debugger opens a port or Django auto-restarts.
150+
"otherPortsAttributes": {
151+
"onAutoForward": "silent"
152+
},
153+
"portsAttributes": {
154+
"8000": {
155+
"label": "Django",
156+
// Show a dialog if the port isn't free.
157+
"requireLocalPort": true,
158+
"onAutoForward": "silent"
159+
}
160+
},
161+
// Install a global Python and create a venv before VSCode extensions start,
162+
// to prevent prompts and ensure test discovery works on first load.
163+
"onCreateCommand": {
164+
"python": ["uv", "python", "install", "--default"],
165+
"venv": ["uv", "sync", "--all-extras", "--all-groups"]
166+
},
167+
// Ensure it is re-synced on restarts.
168+
"updateContentCommand": {
169+
"venv": ["uv", "sync", "--all-extras", "--all-groups"]
170+
}
171+
>>>>>>> after updating
81172
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
services:
2+
django:
3+
# Don't expose ports, devcontainer forwarding is superior, since we can just bind to localhost.
4+
ports: !reset []
5+
# Don't auto-run the default command, launch.json or the terminal will be used.
6+
command: !reset []
7+
8+
celery:
9+
# Celery will be started via launch.json or the terminal.
10+
profiles: ["celery"]

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ indent_size = 2
2727
indent_size = 4
2828
max_line_length = 100
2929

30+
[*.sh]
31+
indent_size = 2
32+
3033
[*.toml]
3134
indent_size = 2
3235

.vscode/launch.json

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"version": "0.2.0",
33
"configurations": [
4+
<<<<<<< before updating
45
// Put Django Server first so it's the default when starting debugging
56
{
67
"name": "Python: Django Server",
@@ -52,6 +53,109 @@
5253
],
5354
"console": "integratedTerminal",
5455
"justMyCode": false
56+
=======
57+
{
58+
"name": "Django: Server",
59+
"type": "debugpy",
60+
"request": "launch",
61+
"program": "${workspaceFolder}/manage.py",
62+
"args": ["runserver_plus", "--print-sql", "localhost:8000"],
63+
"django": true,
64+
"console": "integratedTerminal",
65+
"justMyCode": false,
66+
"presentation": {
67+
"group": "2-services",
68+
"order": 1
69+
}
70+
},
71+
{
72+
"name": "Django: Server (eager Celery)",
73+
"type": "debugpy",
74+
"request": "launch",
75+
"program": "${workspaceFolder}/manage.py",
76+
"args": ["runserver_plus", "--print-sql", "localhost:8000"],
77+
"env": {
78+
"DJANGO_CELERY_TASK_ALWAYS_EAGER": "true"
79+
},
80+
"django": true,
81+
"console": "integratedTerminal",
82+
"justMyCode": false,
83+
"presentation": {
84+
"group": "3-utilities",
85+
"order": 1
86+
}
87+
},
88+
{
89+
"name": "Django: Management Command",
90+
"type": "debugpy",
91+
"request": "launch",
92+
"program": "${workspaceFolder}/manage.py",
93+
"args": ["${input:managementCommand}"],
94+
"django": true,
95+
"console": "integratedTerminal",
96+
"justMyCode": false,
97+
"presentation": {
98+
"group": "3-utilities",
99+
"order": 2
100+
}
101+
},
102+
{
103+
"name": "Celery: Worker",
104+
"type": "debugpy",
105+
"request": "launch",
106+
"module": "celery",
107+
"args": [
108+
"--app",
109+
"dandiapi.celery",
110+
"worker",
111+
"--loglevel",
112+
"INFO",
113+
"--without-mingle",
114+
"--without-heartbeat",
115+
"--without-gossip"
116+
],
117+
"console": "integratedTerminal",
118+
"justMyCode": false,
119+
"presentation": {
120+
"group": "2-services",
121+
"order": 2
122+
}
123+
},
124+
{
125+
"name": "Pytest: Debug",
126+
"type": "debugpy",
127+
"request": "launch",
128+
"purpose": ["debug-test"],
129+
"console": "integratedTerminal",
130+
"django": true,
131+
"justMyCode": false,
132+
"presentation": {
133+
"hidden": true
134+
}
135+
}
136+
],
137+
"compounds": [
138+
{
139+
"name": "Django + Celery",
140+
"configurations": ["Django: Server", "Celery: Worker"],
141+
"stopAll": true,
142+
"presentation": {
143+
"group": "1-compound",
144+
"order": 1
145+
}
146+
}
147+
],
148+
"inputs": [
149+
{
150+
"id": "managementCommand",
151+
"type": "command",
152+
"command": "shellCommand.execute",
153+
"args": {
154+
"command": "./manage.py help --commands",
155+
"description": "Django management command",
156+
"allowCustomValues": true
157+
}
158+
>>>>>>> after updating
55159
}
56160
]
57161
}

.vscode/settings.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
// File cleanup
3+
"files.trimTrailingWhitespace": true,
4+
"files.insertFinalNewline": true,
5+
"files.trimFinalNewlines": true,
6+
7+
// Python
8+
"python.analysis.autoFormatStrings": true,
9+
"python.testing.pytestEnabled": true,
10+
"python.analysis.autoImportCompletions": true,
11+
"python.analysis.gotoDefinitionInStringLiteral": true,
12+
// Allow auto-importing from deeper symbols inside of Django.
13+
"python.analysis.packageIndexDepths": [
14+
{
15+
"name": "django",
16+
"depth": 6
17+
}
18+
],
19+
"python.analysis.inlayHints.pytestParameters": true,
20+
21+
// Django templates
22+
"emmet.includeLanguages": {
23+
"django-html": "html"
24+
},
25+
26+
// Type checking: Use Mypy and disable Pylance.
27+
"mypy-type-checker.importStrategy": "fromEnvironment",
28+
// Mypy daemon seems better, but is buggy in practice.
29+
"mypy-type-checker.preferDaemon": false,
30+
"mypy-type-checker.reportingScope": "file",
31+
"python.analysis.typeCheckingMode": "off",
32+
33+
// Ruff
34+
"[python]": {
35+
"editor.defaultFormatter": "charliermarsh.ruff"
36+
}
37+
}

Procfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
release: python ./manage.py migrate
2+
<<<<<<< before updating
23
web: gunicorn --config gunicorn.conf.py dandiapi.wsgi
34
# celery-beat: REMAP_SIGTERM=SIGQUIT celery --app dandiapi.celery beat --loglevel INFO
45
# Rather than using a dedicated worker for Celery Beat, we simply use the -B option on the priority task worker.
@@ -9,3 +10,9 @@ web: gunicorn --config gunicorn.conf.py dandiapi.wsgi
910
worker: REMAP_SIGTERM=SIGQUIT celery --app dandiapi.celery worker --loglevel INFO --without-mingle --without-heartbeat --without-gossip --queues celery --beat
1011
# The checksum-worker calculates blob checksums and updates zarr checksum files
1112
checksum-worker: REMAP_SIGTERM=SIGQUIT celery --app dandiapi.celery worker --loglevel INFO --without-mingle --without-heartbeat --without-gossip --queues calculate_sha256,ingest_zarr_archive
13+
=======
14+
# Set `graceful_timeout` to shorter than the 30 second limit imposed by Heroku restarts
15+
# Set `timeout` to shorter than the 30 second limit imposed by the Heroku router
16+
web: gunicorn --bind 0.0.0.0:$PORT --graceful-timeout 25 --timeout 15 dandiapi.wsgi
17+
worker: REMAP_SIGTERM=SIGQUIT celery --app dandiapi.celery worker --loglevel INFO --without-mingle --without-heartbeat --without-gossip
18+
>>>>>>> after updating

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# DANDI Archive
22

3+
<<<<<<< before updating
34
![](https://about.dandiarchive.org/assets/dandi_logo.svg)
45

56
## DANDI: Distributed Archives for Neurophysiology Data Integration
@@ -29,3 +30,37 @@ see the [DANDI Docs](https://docs.dandiarchive.org).
2930
* To understand how to hack on the archive codebase:
3031
- Django backend: [`DEVELOPMENT.md`](DEVELOPMENT.md)
3132
- Vue frontend: [`web/README.md`](web/README.md)
33+
=======
34+
## Setup
35+
1. Install [VS Code with dev container support](https://code.visualstudio.com/docs/devcontainers/containers#_installation).
36+
1. Open the project in VS Code, then run `Dev Containers: Reopen in Container`
37+
from the Command Palette (`Ctrl+Shift+P`).
38+
1. Once the container is ready, open a terminal and run:
39+
```sh
40+
./manage.py migrate
41+
./manage.py createsuperuser
42+
```
43+
44+
## Run
45+
Open the **Run and Debug** panel (`Ctrl+Shift+D`) and select a launch configuration:
46+
47+
* **Django: Server** - Starts the development server at http://localhost:8000/
48+
* **Django: Server (eager Celery)** - Same, but Celery tasks run synchronously
49+
in the web process (useful for debugging task code without a worker)
50+
* **Celery: Worker** - Starts only the Celery worker
51+
* **Django + Celery** - Starts both the server and a Celery worker
52+
* **Django: Management Command** - Pick and run any management command
53+
54+
## Test
55+
Run the full test suite from a terminal: `tox`
56+
57+
Auto-format code: `tox -e format`
58+
59+
Run and debug individual tests from the **Testing** panel (`Ctrl+Shift+;`).
60+
61+
## Rebuild
62+
After changes to the Dockerfile, Docker Compose files, or `devcontainer.json`,
63+
run `Dev Containers: Rebuild Container` from the Command Palette (`Ctrl+Shift+P`).
64+
65+
For dependency changes in `pyproject.toml`, just run `uv sync --all-extras --all-groups`.
66+
>>>>>>> after updating

dandiapi/settings/heroku_production.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212

1313
# This needs to be set by the HTTPS terminating reverse proxy.
1414
# Heroku and Render automatically set this.
15+
<<<<<<< before updating
1516
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
17+
=======
18+
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
19+
>>>>>>> after updating
1620

1721
# Inform rate limiting that "X-Forwarded-For" should be trusted, as it's appended by Heroku.
1822
ALLAUTH_TRUSTED_PROXY_COUNT = 1

0 commit comments

Comments
 (0)