Skip to content

Commit 7a2e8be

Browse files
Build from template@8d4daaf (#14)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 9ca138e commit 7a2e8be

8 files changed

Lines changed: 381 additions & 414 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,6 @@
11
{
2-
// Dev Container definition for python_template
3-
"name": "python_template",
4-
"dockerComposeFile": ["docker-compose.yaml"],
5-
"service": "app",
6-
"workspaceFolder": "/workspace",
7-
"features": {
8-
"ghcr.io/devcontainers/features/common-utils:2": {
9-
"installZsh": true
10-
},
11-
"ghcr.io/devcontainers/features/git:1": {}
12-
},
132
"customizations": {
143
"vscode": {
15-
"settings": {
16-
"python.defaultInterpreterPath": "${containerWorkspaceFolder}/.venv/bin/python",
17-
"terminal.integrated.defaultProfile.linux": "zsh"
18-
},
194
"extensions": [
205
"ms-python.python",
216
"charliermarsh.ruff",
@@ -24,14 +9,32 @@
249
"mhutchie.git-graph",
2510
"Gruntfuggly.todo-tree",
2611
"esbenp.prettier-vscode"
27-
]
12+
],
13+
"settings": {
14+
"python.defaultInterpreterPath": "${containerWorkspaceFolder}/.venv/bin/python",
15+
"terminal.integrated.defaultProfile.linux": "zsh"
16+
}
2817
}
2918
},
30-
"forwardPorts": [8888],
31-
"remoteUser": "vscode",
19+
"dockerComposeFile": [
20+
"docker-compose.yaml"
21+
],
22+
"features": {
23+
"ghcr.io/devcontainers/features/common-utils:2": {
24+
"installZsh": true
25+
},
26+
"ghcr.io/devcontainers/features/git:1": {}
27+
},
28+
"forwardPorts": [
29+
8888
30+
],
31+
"name": "python_template",
32+
"postCreateCommand": "bash .devcontainer/postCreateCommand.sh",
33+
"postStartCommand": "bash .devcontainer/postStartCommand.sh",
3234
"remoteEnv": {
3335
"PATH": "${containerEnv:PATH}:/home/vscode/.local/bin"
3436
},
35-
"postCreateCommand": "bash .devcontainer/postCreateCommand.sh",
36-
"postStartCommand": "bash .devcontainer/postStartCommand.sh"
37+
"remoteUser": "vscode",
38+
"service": "app",
39+
"workspaceFolder": "/workspace"
3740
}

.devcontainer/docker-compose.yaml

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
1-
version: "3.8"
21
services:
32
app:
4-
user: vscode
53
build:
6-
# Use repository root as build context so we can pre-warm dependencies (pyproject/uv.lock)
7-
context: ..
8-
dockerfile: .devcontainer/Dockerfile
94
args:
105
VARIANT: 3.13-bookworm
11-
volumes:
12-
- ..:/workspace:cached # Shared workspace between host and devcontainer
13-
- python_template_extensions:/home/vscode/.vscode-server/extensions # Storing extensions
14-
- python_template_commandhistory:/home/vscode/commandhistory # Persistant command line history
15-
- python_template_cache:/home/vscode/.cache # Caching poetry/pip wheels
16-
- /workspace/.venv
17-
18-
# Overrides default command so things don't shut down after the process ends.
6+
context: ..
7+
dockerfile: .devcontainer/Dockerfile
198
command: sleep infinity
20-
21-
# Volumes that are not shared between Host and Devcontainer must be listed here.
9+
user: vscode
10+
volumes:
11+
- ../:/workspace:cached
12+
- python_template_extensions:/home/vscode/.vscode-server/extensions
13+
- python_template_commandhistory:/home/vscode/commandhistory
14+
- python_template_cache:/home/vscode/.cache
15+
- /workspace/.venv
16+
version: '3.8'
2217
volumes:
23-
python_template_extensions:
24-
python_template_commandhistory:
25-
python_template_cache:
18+
python_template_cache: null
19+
python_template_commandhistory: null
20+
python_template_extensions: null

.github/workflows/ci.yaml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
name: ci
2-
3-
on:
4-
pull_request:
5-
push:
6-
branches: [main]
7-
81
jobs:
92
lint:
103
runs-on: ubuntu-latest
114
steps:
12-
- name: Install uv based on the version defined in pyproject.toml
13-
uses: astral-sh/setup-uv@v6
14-
- uses: actions/checkout@v3
15-
- uses: j178/prek-action@v1
5+
- name: Checkout code
6+
uses: actions/checkout@v4
7+
- name: Install uv
8+
uses: astral-sh/setup-uv@v6
9+
- name: Run prek hooks
10+
uses: j178/prek-action@v1
11+
with:
12+
extra-args: --hook-stage manual --all-files
13+
name: ci
14+
'on':
15+
pull_request: null
16+
push:
17+
branches:
18+
- main

.pre-commit-config.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
minimum_pre_commit_version: "3.5.0"
2-
default_stages: [commit]
2+
default_stages: [commit, manual]
33

44
############################################################
55
# Global Exclusions
@@ -70,27 +70,27 @@ repos:
7070
language: system
7171
pass_filenames: false
7272
always_run: true
73-
stages: [pre-push]
73+
stages: [pre-push, manual]
7474
# Optional faster feedback: args: ["-q", "--maxfail=1"]
7575
- id: pylint
7676
name: Pylint (design checks)
7777
entry: uv run pylint
7878
language: system
7979
types: [python]
8080
args: ["--rcfile=pyproject.toml"]
81-
stages: [pre-push]
81+
stages: [pre-push, manual]
8282
- id: deptry
8383
name: Deptry (dependency hygiene)
8484
entry: uv run deptry python_template
8585
language: system
8686
pass_filenames: false
87-
stages: [pre-push]
87+
stages: [pre-push, manual]
8888
- id: vulture
8989
name: Vulture (dead code)
9090
entry: uv run vulture python_template
9191
language: system
9292
pass_filenames: false
93-
stages: [pre-push]
93+
stages: [pre-push, manual]
9494

9595
- repo: https://github.com/Yelp/detect-secrets
9696
rev: v1.5.0
@@ -99,12 +99,12 @@ repos:
9999
name: Detect Secrets (baseline)
100100
args: ["--baseline", ".secrets.baseline"]
101101
exclude: uv.lock
102-
stages: [pre-push]
102+
stages: [pre-push, manual]
103103

104104
- repo: https://github.com/astral-sh/uv-pre-commit
105105
rev: 0.8.22
106106
hooks:
107107
- id: uv-lock
108108
name: Validate pyproject / lock
109-
stages: [pre-push]
109+
stages: [pre-push, manual]
110110
pass_filenames: false

.prettierrc.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
{
2+
"arrowParens": "always",
3+
"bracketSpacing": true,
4+
"embeddedLanguageFormatting": "auto",
5+
"endOfLine": "lf",
6+
"htmlWhitespaceSensitivity": "css",
7+
"jsxBracketSameLine": false,
8+
"jsxSingleQuote": false,
29
"printWidth": 120,
3-
"tabWidth": 2,
4-
"useTabs": false,
10+
"proseWrap": "preserve",
11+
"quoteProps": "as-needed",
512
"semi": true,
613
"singleQuote": false,
7-
"quoteProps": "as-needed",
8-
"jsxSingleQuote": false,
14+
"tabWidth": 2,
915
"trailingComma": "es5",
10-
"bracketSpacing": true,
11-
"jsxBracketSameLine": false,
12-
"arrowParens": "always",
13-
"proseWrap": "preserve",
14-
"htmlWhitespaceSensitivity": "css",
15-
"vueIndentScriptAndStyle": false,
16-
"endOfLine": "lf",
17-
"embeddedLanguageFormatting": "auto"
16+
"useTabs": false,
17+
"vueIndentScriptAndStyle": false
1818
}

.vscode/launch.json

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
{
2-
// Use IntelliSense to learn about possible attributes.
3-
// Hover to view descriptions of existing attributes.
4-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5-
"version": "0.2.0",
6-
"configurations": [
7-
{
8-
"name": "Python: Module",
9-
"type": "debugpy",
10-
"request": "launch",
11-
"module": "{{ package_name }}",
12-
"justMyCode": false
13-
}
14-
]
2+
"configurations": [
3+
{
4+
"justMyCode": false,
5+
"module": "python_template",
6+
"name": "Python: Module",
7+
"request": "launch",
8+
"type": "debugpy"
9+
}
10+
],
11+
"version": "0.2.0"
1512
}

.vscode/settings.json

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,41 @@
11
{
2-
// Editor settings for Python
32
"[python]": {
4-
"editor.formatOnSave": true,
5-
"editor.defaultFormatter": "charliermarsh.ruff",
63
"editor.codeActionsOnSave": {
74
"source.fixAll": "explicit",
85
"source.organizeImports": "explicit"
96
},
10-
"editor.rulers": [100],
7+
"editor.defaultFormatter": "charliermarsh.ruff",
8+
"editor.formatOnSave": true,
9+
"editor.rulers": [
10+
100
11+
],
1112
"files.trimTrailingWhitespace": true
1213
},
13-
14-
// Editor settings for YAML
1514
"[yaml]": {
16-
"editor.insertSpaces": true,
17-
"editor.formatOnSave": true,
18-
"editor.defaultFormatter": "esbenp.prettier-vscode",
19-
"editor.tabSize": 2,
2015
"editor.autoIndent": "keep",
21-
"gitlens.codeLens.scopes": ["document"],
16+
"editor.defaultFormatter": "esbenp.prettier-vscode",
17+
"editor.formatOnSave": true,
18+
"editor.insertSpaces": true,
2219
"editor.quickSuggestions": {
23-
"other": true,
2420
"comments": false,
21+
"other": true,
2522
"strings": true
26-
}
23+
},
24+
"editor.tabSize": 2,
25+
"gitlens.codeLens.scopes": [
26+
"document"
27+
]
2728
},
28-
"python.testing.pytestEnabled": true,
29-
"python.testing.autoTestDiscoverOnSaveEnabled": true,
30-
"python.testing.pytestArgs": ["tests"],
31-
"ruff.enable": true,
32-
"python.analysis.typeCheckingMode": "basic",
33-
"python.analysis.autoImportCompletions": true,
34-
"python.testing.unittestEnabled": false,
3529
"editor.defaultFormatter": "esbenp.prettier-vscode",
3630
"editor.formatOnSave": true,
37-
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python"
31+
"python.analysis.autoImportCompletions": true,
32+
"python.analysis.typeCheckingMode": "basic",
33+
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
34+
"python.testing.autoTestDiscoverOnSaveEnabled": true,
35+
"python.testing.pytestArgs": [
36+
"tests"
37+
],
38+
"python.testing.pytestEnabled": true,
39+
"python.testing.unittestEnabled": false,
40+
"ruff.enable": true
3841
}

0 commit comments

Comments
 (0)