Skip to content

Commit ce0f744

Browse files
committed
Adopt python-project-template via Copier
Generate the project tooling from ahcodedev/python-project-template v0.4.0 and record the answers in .copier-answers.yml so future template changes can be pulled in with copier update. Project-specific README content, dependencies, and settings are kept. Rename Python.yml to python.yml to match the template and README badges.
1 parent 1cde262 commit ce0f744

28 files changed

Lines changed: 1628 additions & 168 deletions

‎.copier-answers.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
2+
_commit: v0.4.0
3+
_src_path: gh:ahcodedev/python-project-template
4+
description: Various Data Structures and Algorithm Solutions in Python
5+
github_repo: ahcodedev/python-ds-algorithms
6+
package_name: python_ds_algorithms
7+
project_name: python-ds-algorithms

‎.devcontainer/Dockerfile‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.238.0/containers/python-3/.devcontainer/base.Dockerfile
1+
# See here for image contents: https://github.com/devcontainers/images/tree/main/src
22

3-
# [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster
4-
ARG VARIANT="3.14-bookworm"
5-
FROM mcr.microsoft.com/devcontainers/python:${VARIANT}
3+
# Image version 3.3.2, Python 3.14, Debian bookworm. Tag and digest are updated by Dependabot.
4+
FROM mcr.microsoft.com/vscode/devcontainers/python:3.15-bookworm@sha256:25ac34e3c1a4c5b19a89ece73ed0278e92afc1cfd25ecb51714891e82bede421
5+
6+
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
7+
ARG NODE_VERSION="none"
8+
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
69

710
# Just Installation
8-
COPY --from=ghcr.io/casey/just:latest /just /usr/local/bin/
11+
COPY --from=ghcr.io/casey/just:1.59.0@sha256:014cbe6e6de678864004e2fd8b0405f77ce43b20b225e816feb330f2fb575c01 /just /usr/local/bin/
912

1013
# uv Installation
11-
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /usr/local/bin/
14+
COPY --from=ghcr.io/astral-sh/uv:0.13.7@sha256:96f40d3904aad8d0bd010539001d36c8e2188b981e1334471a90c4a1d93bb490 /uv /uvx /usr/local/bin/
1215

1316
# [Optional] Uncomment this section to install additional OS packages.
1417
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
1518
# && apt-get -y install --no-install-recommends <your-package-list-here>
1619

1720
# [Optional] Uncomment this line to install global node packages.
18-
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
21+
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1

‎.devcontainer/devcontainer.json‎

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,28 @@
11
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2-
// https://github.com/devcontainers/images/tree/main/src/
2+
// https://github.com/devcontainers/images/tree/main/src
33
{
44
"name": "Python 3",
55
"build": {
66
"dockerfile": "Dockerfile",
77
"context": "..",
88
"args": {
9-
"VARIANT": "3.14-bookworm",
9+
// The Python version is pinned in the Dockerfile's FROM line (tag + digest).
10+
// Options
1011
"NODE_VERSION": "none"
1112
}
1213
},
1314

1415
// Configure tool-specific properties.
1516
"customizations": {
16-
// Configure properties specific to VS Code.
1717
"vscode": {
1818
// Set *default* container specific settings.json values on container create.
1919
"settings": {
2020
"python.autoComplete.extraPaths": ["/workspaces"],
21-
"python.defaultInterpreterPath": "/usr/local/bin/python",
22-
"editor.tabSize": 4,
23-
"files.autoSave": "afterDelay",
24-
"files.trimTrailingWhitespace": true,
25-
"terminal.integrated.localEchoStyle": "dim",
26-
"[python]": {
27-
"editor.defaultFormatter": "charliermarsh.ruff",
28-
"editor.formatOnSave": true,
29-
"editor.codeActionsOnSave": {
30-
"source.fixAll.ruff": "explicit",
31-
"source.organizeImports.ruff": "explicit"
32-
}
21+
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python"
3322
},
3423

3524
// Add the IDs of extensions you want installed when the container is created.
36-
"extensions": [
37-
"Anthropic.claude-code",
38-
"DavidAnson.vscode-markdownlint",
39-
"ms-python.python",
40-
"ms-python.vscode-pylance",
41-
"ms-vscode-remote.remote-containers",
42-
"charliermarsh.ruff"
43-
]
25+
"extensions": []
4426
}
4527
},
4628

@@ -51,5 +33,8 @@
5133
"postCreateCommand": "uv sync --all-groups",
5234

5335
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
54-
"remoteUser": "vscode"
36+
"remoteUser": "vscode",
37+
"features": {
38+
"ghcr.io/devcontainers/features/github-cli:1": "latest"
39+
}
5540
}

‎.gitattributes‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
.devcontainer/* -linguist-detectable
2-
.github/** -linguist-detectable
2+
.github/** -linguist-detectable

‎.github/dependabot.yml‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Dependabot configuration.
2+
# See https://docs.github.com/en/code-security/dependabot/working-with-dependabot/dependabot-options-reference
3+
version: 2
4+
5+
updates:
6+
# GitHub Actions used in .github/workflows (updates SHA pins and their version comments)
7+
- package-ecosystem: "github-actions"
8+
directory: "/"
9+
schedule:
10+
interval: "monthly"
11+
cooldown:
12+
default-days: 7
13+
labels: ["dependencies"]
14+
groups:
15+
github-actions:
16+
patterns: ["*"]
17+
18+
# Python dependencies in pyproject.toml / uv.lock
19+
- package-ecosystem: "uv"
20+
directory: "/"
21+
schedule:
22+
interval: "monthly"
23+
cooldown:
24+
default-days: 7
25+
labels: ["dependencies"]
26+
groups:
27+
python-minor-and-patch:
28+
update-types: ["minor", "patch"]
29+
30+
# Base image in .devcontainer/Dockerfile
31+
- package-ecosystem: "docker"
32+
directory: "/.devcontainer"
33+
schedule:
34+
interval: "monthly"
35+
cooldown:
36+
default-days: 7
37+
labels: ["dependencies"]
38+
39+
# Features in .devcontainer/devcontainer.json
40+
- package-ecosystem: "devcontainers"
41+
directory: "/"
42+
schedule:
43+
interval: "monthly"
44+
cooldown:
45+
default-days: 7
46+
labels: ["dependencies"]

‎.github/pull_request_template.md‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
## Summary
2+
3+
<!-- What does this PR change and why? -->
4+
5+
## Related Issues
6+
7+
<!-- e.g. Closes #123 -->
8+
9+
## Type of Change
10+
11+
<!--
12+
Add a release label to this PR from the Labels section of the PR sidebar
13+
(not a prefix in the PR title or commit message). It sets the release notes section and the version bump:
14+
breaking -> major
15+
feature / enhancement -> minor
16+
bug / fix -> patch
17+
chore / ci / dependencies / documentation / refactor -> patch
18+
skip-changelog -> excluded from release notes
19+
-->
20+
21+
## Checklist
22+
23+
- [ ] `just lint` passes
24+
- [ ] `just test` passes
25+
- [ ] Tests added or updated for the change
26+
- [ ] `README.md` updated if needed
27+
- [ ] Release label added

‎.github/release-drafter.yml‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Release Drafter configuration.
2+
# See https://github.com/release-drafter/release-drafter for more information.
3+
name-template: 'v$RESOLVED_VERSION'
4+
tag-template: 'v$RESOLVED_VERSION'
5+
category-template: '### $TITLE'
6+
change-template: '- $TITLE (#$NUMBER) @$AUTHOR'
7+
change-title-escapes: '\<*_&@'
8+
exclude-labels:
9+
- 'skip-changelog'
10+
categories:
11+
- title: 'Breaking Changes'
12+
labels: ['breaking']
13+
- title: 'Features'
14+
labels: ['feature', 'enhancement']
15+
- title: 'Bug Fixes'
16+
labels: ['bug', 'fix']
17+
- title: 'Maintenance'
18+
labels: ['chore', 'ci', 'dependencies', 'documentation', 'refactor']
19+
version-resolver:
20+
major:
21+
labels: ['breaking']
22+
minor:
23+
labels: ['feature', 'enhancement']
24+
patch:
25+
labels: ['bug', 'fix', 'chore', 'ci', 'dependencies', 'documentation', 'refactor']
26+
default: patch
27+
autolabeler:
28+
- label: 'feature'
29+
branch: ['/^feat(ure)?\/.+/']
30+
- label: 'bug'
31+
branch: ['/^(bug)?fix\/.+/']
32+
- label: 'chore'
33+
branch: ['/^chore\/.+/']
34+
- label: 'ci'
35+
branch: ['/^ci\/.+/']
36+
files: ['.github/workflows/*']
37+
- label: 'documentation'
38+
branch: ['/^docs?\/.+/']
39+
files: ['*.md']
40+
- label: 'refactor'
41+
branch: ['/^refactor\/.+/']
42+
- label: 'dependencies'
43+
files: ['uv.lock']
44+
template: |
45+
$CHANGES

‎.github/workflows/Python.yml‎

Lines changed: 0 additions & 36 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Dependabot Auto-Merge
2+
3+
# Enables auto-merge on Dependabot PRs for minor and patch updates. The PR merges once
4+
# required status checks pass. Needs "Allow auto-merge" enabled in the repo settings.
5+
6+
on:
7+
pull_request:
8+
types: [ opened, reopened, synchronize ]
9+
10+
permissions: {}
11+
12+
jobs:
13+
auto-merge:
14+
if: github.event.pull_request.user.login == 'dependabot[bot]'
15+
runs-on: ubuntu-slim
16+
permissions:
17+
contents: write
18+
pull-requests: write
19+
steps:
20+
- name: Fetch Dependabot metadata
21+
id: metadata
22+
uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0
23+
24+
- name: Enable auto-merge
25+
if: steps.metadata.outputs.update-type != 'version-update:semver-major'
26+
env:
27+
GH_TOKEN: ${{ github.token }}
28+
PR_URL: ${{ github.event.pull_request.html_url }}
29+
run: |
30+
gh pr merge --auto --squash "$PR_URL"

‎.github/workflows/python.yml‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Python CI Checks
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
permissions: {}
10+
11+
jobs:
12+
code-check-and-unit-test:
13+
runs-on: ubuntu-slim
14+
permissions:
15+
contents: read
16+
steps:
17+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
18+
with:
19+
persist-credentials: false
20+
- name: Install uv
21+
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
22+
with:
23+
enable-cache: false
24+
version: ">=0.13,<0.14"
25+
- name: Setup environment
26+
run: |
27+
uv tool install rust-just
28+
just sync
29+
- name: Lint
30+
run: |
31+
just ci-lint
32+
- name: Unit tests
33+
run: |
34+
just test
35+
- name: Docs build
36+
run: |
37+
just docs-build
38+
markdownlint:
39+
runs-on: ubuntu-slim
40+
permissions:
41+
contents: read
42+
steps:
43+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
44+
with:
45+
persist-credentials: false
46+
# Keep markdownlint-cli2 in step with the VS Code markdownlint extension
47+
- name: Markdownlint
48+
uses: DavidAnson/markdownlint-cli2-action@21c1be1b93ad9ed58fa840aacc3f279cde2a72ff # v24.2.0
49+
with:
50+
globs: "**/*.md"

0 commit comments

Comments
 (0)