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
43 changes: 23 additions & 20 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
{
// Dev Container definition for python_template
"name": "python_template",
"dockerComposeFile": ["docker-compose.yaml"],
"service": "app",
"workspaceFolder": "/workspace",
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"installZsh": true
},
"ghcr.io/devcontainers/features/git:1": {}
},
"customizations": {
"vscode": {
"settings": {
"python.defaultInterpreterPath": "${containerWorkspaceFolder}/.venv/bin/python",
"terminal.integrated.defaultProfile.linux": "zsh"
},
"extensions": [
"ms-python.python",
"charliermarsh.ruff",
Expand All @@ -24,14 +9,32 @@
"mhutchie.git-graph",
"Gruntfuggly.todo-tree",
"esbenp.prettier-vscode"
]
],
"settings": {
"python.defaultInterpreterPath": "${containerWorkspaceFolder}/.venv/bin/python",
"terminal.integrated.defaultProfile.linux": "zsh"
}
}
},
"forwardPorts": [8888],
"remoteUser": "vscode",
"dockerComposeFile": [
"docker-compose.yaml"
],
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"installZsh": true
},
"ghcr.io/devcontainers/features/git:1": {}
},
"forwardPorts": [
8888
],
"name": "python_template",
"postCreateCommand": "bash .devcontainer/postCreateCommand.sh",
"postStartCommand": "bash .devcontainer/postStartCommand.sh",
"remoteEnv": {
"PATH": "${containerEnv:PATH}:/home/vscode/.local/bin"
},
"postCreateCommand": "bash .devcontainer/postCreateCommand.sh",
"postStartCommand": "bash .devcontainer/postStartCommand.sh"
"remoteUser": "vscode",
"service": "app",
"workspaceFolder": "/workspace"
}
31 changes: 13 additions & 18 deletions .devcontainer/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
version: "3.8"
services:
app:
user: vscode
build:
# Use repository root as build context so we can pre-warm dependencies (pyproject/uv.lock)
context: ..
dockerfile: .devcontainer/Dockerfile
args:
VARIANT: 3.13-bookworm
volumes:
- ..:/workspace:cached # Shared workspace between host and devcontainer
- python_template_extensions:/home/vscode/.vscode-server/extensions # Storing extensions
- python_template_commandhistory:/home/vscode/commandhistory # Persistant command line history
- python_template_cache:/home/vscode/.cache # Caching poetry/pip wheels
- /workspace/.venv

# Overrides default command so things don't shut down after the process ends.
context: ..
dockerfile: .devcontainer/Dockerfile
command: sleep infinity

# Volumes that are not shared between Host and Devcontainer must be listed here.
user: vscode
volumes:
- ../:/workspace:cached
- python_template_extensions:/home/vscode/.vscode-server/extensions
- python_template_commandhistory:/home/vscode/commandhistory
- python_template_cache:/home/vscode/.cache
- /workspace/.venv
version: '3.8'
volumes:
python_template_extensions:
python_template_commandhistory:
python_template_cache:
python_template_cache: null
python_template_commandhistory: null
python_template_extensions: null
25 changes: 14 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
name: ci

on:
pull_request:
push:
branches: [main]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Install uv based on the version defined in pyproject.toml
uses: astral-sh/setup-uv@v6
- uses: actions/checkout@v3
- uses: j178/prek-action@v1
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Run prek hooks
uses: j178/prek-action@v1
with:
extra-args: --hook-stage manual --all-files
name: ci
'on':
pull_request: null
push:
branches:
- main
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
minimum_pre_commit_version: "3.5.0"
default_stages: [commit]
default_stages: [commit, manual]

############################################################
# Global Exclusions
Expand Down Expand Up @@ -70,27 +70,27 @@ repos:
language: system
pass_filenames: false
always_run: true
stages: [pre-push]
stages: [pre-push, manual]
# Optional faster feedback: args: ["-q", "--maxfail=1"]
- id: pylint
name: Pylint (design checks)
entry: uv run pylint
language: system
types: [python]
args: ["--rcfile=pyproject.toml"]
stages: [pre-push]
stages: [pre-push, manual]
- id: deptry
name: Deptry (dependency hygiene)
entry: uv run deptry python_template
language: system
pass_filenames: false
stages: [pre-push]
stages: [pre-push, manual]
- id: vulture
name: Vulture (dead code)
entry: uv run vulture python_template
language: system
pass_filenames: false
stages: [pre-push]
stages: [pre-push, manual]

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

- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.8.22
hooks:
- id: uv-lock
name: Validate pyproject / lock
stages: [pre-push]
stages: [pre-push, manual]
pass_filenames: false
24 changes: 12 additions & 12 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"arrowParens": "always",
"bracketSpacing": true,
"embeddedLanguageFormatting": "auto",
"endOfLine": "lf",
"htmlWhitespaceSensitivity": "css",
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 120,
"tabWidth": 2,
"useTabs": false,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"semi": true,
"singleQuote": false,
"quoteProps": "as-needed",
"jsxSingleQuote": false,
"tabWidth": 2,
"trailingComma": "es5",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"arrowParens": "always",
"proseWrap": "preserve",
"htmlWhitespaceSensitivity": "css",
"vueIndentScriptAndStyle": false,
"endOfLine": "lf",
"embeddedLanguageFormatting": "auto"
"useTabs": false,
"vueIndentScriptAndStyle": false
}
23 changes: 10 additions & 13 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Module",
"type": "debugpy",
"request": "launch",
"module": "{{ package_name }}",
"justMyCode": false
}
]
"configurations": [
{
"justMyCode": false,
"module": "python_template",
"name": "Python: Module",
"request": "launch",
"type": "debugpy"
}
],
"version": "0.2.0"
}
45 changes: 24 additions & 21 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
{
// Editor settings for Python
"[python]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
},
"editor.rulers": [100],
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnSave": true,
"editor.rulers": [
100
],
"files.trimTrailingWhitespace": true
},

// Editor settings for YAML
"[yaml]": {
"editor.insertSpaces": true,
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2,
"editor.autoIndent": "keep",
"gitlens.codeLens.scopes": ["document"],
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.insertSpaces": true,
"editor.quickSuggestions": {
"other": true,
"comments": false,
"other": true,
"strings": true
}
},
"editor.tabSize": 2,
"gitlens.codeLens.scopes": [
"document"
]
},
"python.testing.pytestEnabled": true,
"python.testing.autoTestDiscoverOnSaveEnabled": true,
"python.testing.pytestArgs": ["tests"],
"ruff.enable": true,
"python.analysis.typeCheckingMode": "basic",
"python.analysis.autoImportCompletions": true,
"python.testing.unittestEnabled": false,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python"
"python.analysis.autoImportCompletions": true,
"python.analysis.typeCheckingMode": "basic",
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
"python.testing.autoTestDiscoverOnSaveEnabled": true,
"python.testing.pytestArgs": [
"tests"
],
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"ruff.enable": true
}
Loading