Skip to content

Commit

Permalink
init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
fpgmaas committed Sep 3, 2024
1 parent 5d1e42e commit 8db6b42
Show file tree
Hide file tree
Showing 69 changed files with 4,236 additions and 1 deletion.
27 changes: 27 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python
{
"name": "Cookiecutter uv",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
"features": {
"ghcr.io/devcontainers-contrib/features/cookiecutter:2": {}
},

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "./.devcontainer/postCreateCommand.sh",

// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": ["ms-python.python", "editorconfig.editorconfig"],
"settings": {
"python.testing.pytestArgs": ["tests"],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"python.defaultInterpreterPath": "/workspaces/cookiecutter-uv/.venv/bin/python",
"python.testing.pytestPath": "/workspaces/cookiecutter-uv/.venv/bin/pytest"
}
}
}
}
7 changes: 7 additions & 0 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#! /usr/bin/env bash

# Install Dependencies
uv sync

# Install pre-commit hooks
uv run pre-commit install --install-hooks
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[*]
max_line_length = 120

[*.json]
indent_style = space
indent_size = 4
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Bug report
about: Create a bug report to help us improve
title: "Bug Summary"
labels: "bug"
assignees: "fpgmaas"
---

**Describe the bug**

<!-- A clear and concise description of what the bug is. -->

**To Reproduce**

Steps to reproduce the behavior:

1. ...
2. ...
3. ...

**Expected behavior**

<!-- A clear and concise description of what you expected to happen. -->

**System [please complete the following information]:**

- OS: e.g. [Ubuntu 18.04]
- Language Version: [e.g. Python 3.8]
- Virtual environment: [e.g. uv 1.0.0]

**Additional context**

<!-- Add any other context about the problem here. -->
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Feature request
about: Suggest a new feature
title: "Feature Request Summary"
labels: "enhancement"
assignees: "fpgmaas"
---

**Is your feature request related to a problem? Please describe.**

<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when ... -->

**Describe the solution you would like**

<!-- A clear and concise description of what you want to happen. -->

**Additional context**

<!-- Add any other context or screenshots about the feature request here. -->
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/general_question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: General question
about: Ask a question about anything related to this project
title: "Question"
labels: "question"
assignees: "fpgmaas"
---

**Question**

<!-- Please ask your question here. It can be about the usage of this project, the internals, the implementation or whatever interests you.
Please use the BUG template for bugs and the FEATURE REQUEST template for feature requests. -->
25 changes: 25 additions & 0 deletions .github/actions/setup-python-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "Setup Python Environment"
description: "Set up Python environment for the given Python version"

inputs:
python-version:
description: "Python version for setup-python"
required: true
default: "3.12"

runs:
using: "composite"
steps:
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}

- name: Install uv
run: pipx install uv
env:
UV_VERSION: "0.4.2"
shell: bash

- name: Install Python dependencies
run: uv sync --frozen
shell: bash
10 changes: 10 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
**PR Checklist**

- [ ] A description of the changes is added to the description of this PR.
- [ ] If there is a related issue, make sure it is linked to this PR.
- [ ] If you've fixed a bug or added code that should be tested, add tests!
- [ ] Documentation in `docs` is updated

**Description of changes**

<!-- Please state what you've changed and how it might affect the user. -->
71 changes: 71 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Main

on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [main]

jobs:
quality:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4

- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}

- name: Set up the environment
uses: ./.github/actions/setup-python-env

- name: Run pre-commit
run: uv run pre-commit run -a --show-diff-on-failure

- name: Inspect dependencies
run: uv run deptry .

- name: Check lock file consistency
run: uv sync --locked

tests-and-type-check:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
fail-fast: false
defaults:
run:
shell: bash
steps:
- name: Check out
uses: actions/checkout@v4

- name: Set up the environment
uses: ./.github/actions/setup-python-env
with:
python-version: ${{ matrix.python-version }}

- name: Run tests
run: uv run python -m pytest tests --cov --cov-config=pyproject.toml --cov-report=xml

- name: Check typing
run: uv run mypy

- name: Upload coverage reports to Codecov with GitHub Action on Python 3.11 for Ubuntu
uses: codecov/codecov-action@v3
if: ${{ matrix.python-version == '3.11' }}

check-docs:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4

- name: Set up the environment
uses: ./.github/actions/setup-python-env

- name: Check if documentation can be built
run: uv run mkdocs build -s
67 changes: 67 additions & 0 deletions .github/workflows/on-release-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: release-main

on:
release:
types: [published]
branches: [main]

jobs:
set-version:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Export tag
id: vars
run: echo tag=${GITHUB_REF#refs/*/} >> $GITHUB_OUTPUT
if: ${{ github.event_name == 'release' }}

- name: Update project version
run: |
sed -i "s/^version = \".*\"/version = \"$RELEASE_VERSION\"/" pyproject.toml
env:
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
if: ${{ github.event_name == 'release' }}

- name: Upload updated pyproject.toml
uses: actions/upload-artifact@v4
with:
name: pyproject-toml
path: pyproject.toml

publish:
runs-on: ubuntu-latest
needs: [set-version]
steps:
- name: Check out
uses: actions/checkout@v4

- name: Set up the environment
uses: ./.github/actions/setup-python-env

- name: Download updated pyproject.toml
uses: actions/download-artifact@v4
with:
name: pyproject-toml

- name: Build package
run: uvx --from build pyproject-build --installer uv

- name: Publish package
run: uvx twine upload dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}

deploy-docs:
runs-on: ubuntu-latest
needs: publish
steps:
- name: Check out
uses: actions/checkout@v4

- name: Set up the environment
uses: ./.github/actions/setup-python-env

- name: Deploy documentation
run: uv run mkdocs gh-deploy --force
Loading

0 comments on commit 8db6b42

Please sign in to comment.