Skip to content

Commit 251e723

Browse files
authored
Initial commit
0 parents  commit 251e723

File tree

12 files changed

+711
-0
lines changed

12 files changed

+711
-0
lines changed

.github/dependabot.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
# GitHub Actions
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
11+
schedule:
12+
interval: "weekly"
13+
# Python
14+
- package-ecosystem: "pip" # See documentation for possible values
15+
directory: "/" # Location of package manifests
16+
schedule:
17+
interval: "weekly"

.github/workflows/ci.yaml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- develop
8+
pull_request:
9+
branches:
10+
- master
11+
- develop
12+
13+
jobs:
14+
lint:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: 3.12
24+
25+
- name: Load cached Pre-Commit Dependencies
26+
id: cached-pre-commit-dependencies
27+
uses: actions/cache@v4
28+
with:
29+
path: ~/.cache/pre-commit/
30+
key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
31+
32+
- name: Set up PDM
33+
uses: pdm-project/setup-pdm@v4
34+
with:
35+
python-version: 3.12
36+
allow-python-prereleases: false
37+
cache: true
38+
cache-dependency-path: |
39+
./pdm.lock
40+
41+
- name: Install dependencies
42+
run: pdm install -G:all
43+
44+
- name: Set PYTHONPATH
45+
run: echo "PYTHONPATH=$PWD" >> $GITHUB_ENV
46+
47+
- name: Execute Pre-Commit
48+
run: pdm run pre-commit run --show-diff-on-failure --color=always --all-files
49+
50+
test:
51+
runs-on: ubuntu-latest
52+
steps:
53+
- name: Checkout
54+
uses: actions/checkout@v4
55+
56+
- name: Setup Python
57+
uses: actions/setup-python@v5
58+
with:
59+
python-version: 3.12
60+
61+
- name: Set up PDM
62+
uses: pdm-project/setup-pdm@v4
63+
with:
64+
python-version: 3.12
65+
allow-python-prereleases: false
66+
cache: true
67+
cache-dependency-path: |
68+
./pdm.lock
69+
70+
- name: Install dependencies
71+
run: pdm install -G:all
72+
73+
- name: Set PYTHONPATH
74+
run: echo "PYTHONPATH=$PWD" >> $GITHUB_ENV
75+
76+
- name: Run tests
77+
run: pdm run pytest tests --cov=pyproject --junitxml=junitxml.xml --cov-report "xml:coverage.xml"; exit ${PIPESTATUS[0]}
78+
79+
- name: Test coverage comment
80+
uses: MishaKav/pytest-coverage-comment@main
81+
with:
82+
pytest-xml-coverage-path: ./coverage.xml
83+
junitxml-path: ./junitxml.xml
84+
report-only-changed-files: true

.gitignore

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# Unit test / coverage reports
30+
htmlcov/
31+
.tox/
32+
.nox/
33+
.coverage
34+
.coverage.*
35+
.cache
36+
nosetests.xml
37+
coverage.xml
38+
junitxml.xml
39+
*.cover
40+
*.py,cover
41+
.hypothesis/
42+
.pytest_cache/
43+
cover/
44+
45+
# Sphinx documentation
46+
docs/_build/
47+
/docs/build/
48+
/docs-build/
49+
50+
# pdm
51+
.pdm.toml
52+
.pdm-python
53+
.pdm-build/
54+
55+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
56+
__pypackages__/
57+
58+
# Environments
59+
.env
60+
.venv
61+
env/
62+
venv/
63+
ENV/
64+
env.bak/
65+
venv.bak/
66+
67+
# mypy
68+
.mypy_cache/
69+
.dmypy.json
70+
dmypy.json
71+
72+
# ruff
73+
/.ruff_cache/
74+
75+
# IDE
76+
.idea/
77+
.vscode/

.pre-commit-config.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
default_language_version:
2+
python: python3.12
3+
4+
repos:
5+
- repo: https://github.com/compilerla/conventional-pre-commit
6+
rev: v3.2.0
7+
hooks:
8+
- id: conventional-pre-commit
9+
stages: [commit-msg]
10+
11+
- repo: https://github.com/pre-commit/pre-commit-hooks
12+
rev: v4.5.0
13+
hooks:
14+
- id: check-ast
15+
- id: check-added-large-files
16+
- id: check-case-conflict
17+
- id: check-merge-conflict
18+
- id: detect-private-key
19+
- id: check-toml
20+
- id: check-yaml
21+
- id: debug-statements
22+
- id: end-of-file-fixer
23+
- id: mixed-line-ending
24+
- id: trailing-whitespace
25+
26+
- repo: https://github.com/python-formate/flake8-dunder-all
27+
rev: v0.4.0
28+
hooks:
29+
- id: ensure-dunder-all
30+
exclude: "tests*"
31+
args: ["--use-tuple"]
32+
33+
- repo: https://github.com/astral-sh/ruff-pre-commit
34+
rev: v0.3.4
35+
hooks:
36+
- id: ruff
37+
args: ["--fix"]
38+
- id: ruff-format
39+
40+
- repo: local
41+
hooks:
42+
- id: mypy
43+
name: mypy
44+
entry: mypy src tests --config-file ./pyproject.toml
45+
language: python
46+
types: [python]
47+
require_serial: true
48+
pass_filenames: false

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<div align="center">
2+
3+
# PyProject
4+
5+
[![python](https://img.shields.io/badge/python-3.12-blue)](https://www.python.org/)
6+
[![pdm-managed](https://img.shields.io/badge/pdm-managed-blueviolet)](https://pdm-project.org)
7+
[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)
8+
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
9+
[![Test](https://github.com/draincoder/pyproject/actions/workflows/ci.yaml/badge.svg)](https://github.com/draincoder/pyproject/actions/workflows/ci.yaml)
10+
11+
</div>
12+
13+
## Minimal infrastructure settings for a quick start of a Python project.
14+
15+
## Highlights of features
16+
17+
- [PDM](https://pdm-project.org/en/latest/) `package` manager
18+
- Configured `CI` with `tests` and `lints`
19+
- [Just](https://github.com/casey/just) for project `commands`
20+
- Configured `pre-commit`

justfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Show help message
2+
[private]
3+
@default:
4+
just --list
5+
6+
# Install all depends for developing
7+
@install:
8+
pdm install -G:all
9+
pre-commit install
10+
11+
# Run tests
12+
@test:
13+
pytest tests --cov=pyproject --cov-append --cov-report term-missing -v
14+
15+
# Run pre-commit
16+
@lint:
17+
pre-commit run --all-files

0 commit comments

Comments
 (0)