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
9 changes: 9 additions & 0 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: v0.7.1
_src_path: gh:ahcodedev/python-project-template
description: Various Data Structures and Algorithm Solutions in Python
github_repo: ahcodedev/python-ds-algorithms
package_name: python_ds_algorithms
project_name: python-ds-algorithms
use_docs: false
use_releases: false
17 changes: 10 additions & 7 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.238.0/containers/python-3/.devcontainer/base.Dockerfile
# See here for image contents: https://github.com/devcontainers/images/tree/main/src

# [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
ARG VARIANT="3.14-bookworm"
FROM mcr.microsoft.com/devcontainers/python:${VARIANT}
# Image version 3.3.2, Python 3.14, Debian bookworm. Tag and digest are updated by Dependabot.
FROM mcr.microsoft.com/vscode/devcontainers/python:3.15-bookworm@sha256:25ac34e3c1a4c5b19a89ece73ed0278e92afc1cfd25ecb51714891e82bede421

# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
ARG NODE_VERSION="none"
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi

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

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

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

# [Optional] Uncomment this line to install global node packages.
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
33 changes: 9 additions & 24 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,46 +1,28 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/devcontainers/images/tree/main/src/
// https://github.com/devcontainers/images/tree/main/src
{
"name": "Python 3",
"build": {
"dockerfile": "Dockerfile",
"context": "..",
"args": {
"VARIANT": "3.14-bookworm",
// The Python version is pinned in the Dockerfile's FROM line (tag + digest).
// Options
"NODE_VERSION": "none"
}
},

// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"python.autoComplete.extraPaths": ["/workspaces"],
"python.defaultInterpreterPath": "/usr/local/bin/python",
"editor.tabSize": 4,
"files.autoSave": "afterDelay",
"files.trimTrailingWhitespace": true,
"terminal.integrated.localEchoStyle": "dim",
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.ruff": "explicit",
"source.organizeImports.ruff": "explicit"
}
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python"
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"Anthropic.claude-code",
"DavidAnson.vscode-markdownlint",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-vscode-remote.remote-containers",
"charliermarsh.ruff"
]
"extensions": []
}
},

Expand All @@ -51,5 +33,8 @@
"postCreateCommand": "uv sync --all-groups",

// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
"remoteUser": "vscode",
"features": {
"ghcr.io/devcontainers/features/github-cli:1": "latest"
}
}
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.devcontainer/* -linguist-detectable
.github/** -linguist-detectable
.github/** -linguist-detectable
46 changes: 46 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Dependabot configuration.
# See https://docs.github.com/en/code-security/dependabot/working-with-dependabot/dependabot-options-reference
version: 2

updates:
# GitHub Actions used in .github/workflows (updates SHA pins and their version comments)
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
cooldown:
default-days: 7
labels: ["dependencies"]
groups:
github-actions:
update-types: ["minor", "patch"]

# Python dependencies in pyproject.toml / uv.lock
- package-ecosystem: "uv"
directory: "/"
schedule:
interval: "weekly"
cooldown:
default-days: 7
labels: ["dependencies"]
groups:
python-minor-and-patch:
update-types: ["minor", "patch"]

# Base image in .devcontainer/Dockerfile
- package-ecosystem: "docker"
directory: "/.devcontainer"
schedule:
interval: "weekly"
cooldown:
default-days: 7
labels: ["dependencies"]

# Features in .devcontainer/devcontainer.json
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: "weekly"
cooldown:
default-days: 7
labels: ["dependencies"]
14 changes: 14 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## Summary

<!-- What does this PR change and why? -->

## Related Issues

<!-- e.g. Closes #123 -->

## Checklist

- [ ] `just lint` passes
- [ ] `just coverage` passes
- [ ] Tests added or updated for the change
- [ ] `README.md` updated if needed
36 changes: 0 additions & 36 deletions .github/workflows/Python.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Dependabot Auto-Merge

# Enables auto-merge on Dependabot PRs for minor and patch updates. The PR merges once
# required status checks pass. Needs "Allow auto-merge" enabled in the repo settings.

on:
pull_request:
types: [ opened, reopened, synchronize ]

permissions: {}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
auto-merge:
if: github.event.pull_request.user.login == 'dependabot[bot]'
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
pull-requests: write
steps:
- name: Fetch Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0

- name: Enable auto-merge
if: steps.metadata.outputs.update-type != 'version-update:semver-major'
env:
GH_TOKEN: ${{ github.token }}
PR_URL: ${{ github.event.pull_request.html_url }}
run: |
gh pr merge --auto --squash "$PR_URL"
57 changes: 57 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Python CI Checks

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

permissions: {}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
code-check-and-unit-test:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
enable-cache: false
version: ">=0.13,<0.14"
- name: Setup environment
run: |
uv tool install rust-just==1.59.0
uv tool install actionlint-py==1.7.12.25
uv tool install yamllint==1.38.0
just sync
- name: Lint
run: |
just ci-lint
- name: Spell check
uses: crate-ci/typos@276087d9a4f06398b3e04825487805e2d7375888 # v1.52.2
- name: Unit tests
run: |
just coverage
markdownlint:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# Keep markdownlint-cli2 in step with the VS Code markdownlint extension
- name: Markdownlint
uses: DavidAnson/markdownlint-cli2-action@21c1be1b93ad9ed58fa840aacc3f279cde2a72ff # v24.2.0
with:
globs: "**/*.md"
75 changes: 75 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: GitHub Actions Security Analysis

on:
push:
branches: ["main"]
pull_request:
branches: ["**"]

permissions: {}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
zizmor:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read # only needed for private or internal repos
actions: read # only needed for private or internal repos
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Run zizmor
uses: zizmorcore/zizmor-action@45d7276c9ca790aabd705e31ca99c6185c3e76dd # v0.8.1
with:
advanced-security: false
pip-audit:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
enable-cache: false
version: ">=0.13,<0.14"
- name: Setup environment
run: |
uv tool install rust-just==1.59.0
just sync
- name: Audit dependencies
run: |
just audit
betterleaks:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read # needed to check out a private repo
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
fetch-depth: 0
# betterleaks has no official action or PyPI package, so it is built from source
- name: Install Go
uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0
with:
go-version: stable
cache: false
- name: Install betterleaks
run: |
go install github.com/betterleaks/betterleaks@v1.10.1
- name: Scan git history for secrets
run: |
"$(go env GOPATH)/bin/betterleaks" git --redact .
Loading