Skip to content

Commit d8e6f11

Browse files
committed
Add initial configuration
1 parent 16216dd commit d8e6f11

File tree

20 files changed

+1643
-0
lines changed

20 files changed

+1643
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM python:3.13.7-alpine3.22
2+
3+
RUN apk update && apk add --no-cache \
4+
bash \
5+
bash-completion \
6+
git \
7+
openssh \
8+
pre-commit
9+
10+
RUN pip install --no-cache-dir poetry==2.1.4
11+
12+
RUN addgroup -g 1000 user && adduser -D -u 1000 -G user user

.devcontainer/devcontainer.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"build": {
3+
"dockerfile": "Dockerfile"
4+
},
5+
"customizations": {
6+
"vscode": {
7+
"extensions": [
8+
"charliermarsh.ruff",
9+
"EditorConfig.EditorConfig",
10+
"github.vscode-github-actions",
11+
"ms-python.debugpy",
12+
"ms-python.python",
13+
"ms-python.vscode-pylance",
14+
"redhat.vscode-yaml",
15+
"SanaAjani.taskrunnercode",
16+
"tamasfe.even-better-toml"
17+
]
18+
}
19+
},
20+
"containerEnv": {
21+
"SHELL": "/bin/bash"
22+
},
23+
"remoteUser": "user",
24+
"containerUser": "user",
25+
"mounts": [
26+
{
27+
"source": "${localEnv:HOME}/.gitconfig",
28+
"target": "/home/user/.gitconfig",
29+
"type": "bind"
30+
},
31+
{
32+
"source": "${localEnv:HOME}/.ssh",
33+
"target": "/home/user/.ssh",
34+
"type": "bind"
35+
}
36+
],
37+
"postCreateCommand": "pre-commit install"
38+
}

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
insert_final_newline = true
7+
indent_size = 2
8+
trim_trailing_whitespace = true
9+
10+
[*.py]
11+
indent_size = 4
12+
indent_style = space
13+
14+
[*.md]
15+
trim_trailing_whitespace = false

.github/dependabot.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: pip
4+
directory: /
5+
schedule:
6+
interval: monthly
7+
groups:
8+
all:
9+
patterns: ["*"]
10+
11+
- package-ecosystem: devcontainers
12+
directory: /
13+
schedule:
14+
interval: "monthly"
15+
groups:
16+
all:
17+
patterns: ["*"]
18+
19+
- package-ecosystem: docker
20+
directory: /.devcontainer
21+
schedule:
22+
interval: monthly
23+
groups:
24+
all:
25+
patterns: ["*"]
26+
27+
- package-ecosystem: github-actions
28+
directory: /
29+
schedule:
30+
interval: monthly
31+
groups:
32+
all:
33+
patterns: ["*"]

.github/workflows/check.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: check
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
check:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/[email protected]
17+
18+
- name: Set up Python
19+
uses: actions/[email protected]
20+
with:
21+
python-version: "3.10"
22+
23+
- name: Set up poetry
24+
uses: abatilo/[email protected]
25+
with:
26+
poetry-version: "2.1.4"
27+
28+
- name: Install dependencies
29+
run: poetry install --only main,dev
30+
31+
- name: Run linter
32+
run: poetry run poe lint
33+
34+
- name: Run formatter
35+
run: poetry run poe format
36+
37+
- name: Run version check
38+
run: poetry run poe versioncheck
39+
40+
- name: Run license check
41+
run: poetry run poe licensecheck --requirements-paths=pyproject.toml
42+
43+
- name: Install test dependencies
44+
run: poetry install --only main,dev,test
45+
46+
- name: Run tests
47+
run: poetry run poe test --cov-branch --cov-report=xml --junitxml=junit.xml -o junit_family=legacy
48+
49+
- name: Run type checking
50+
run: poetry run poe typecheck

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
__pycache__
2+
.coverage
3+
.poetry
4+
.pytest_cache
5+
.ruff_cache
6+
.venv
7+
dist

.pre-commit-config.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
default_install_hook_types:
2+
- pre-commit
3+
- post-checkout
4+
- post-merge
5+
6+
fail_fast: true
7+
8+
repos:
9+
- repo: https://github.com/pre-commit/pre-commit-hooks
10+
rev: v5.0.0
11+
hooks:
12+
- id: check-added-large-files
13+
- id: check-case-conflict
14+
- id: check-executables-have-shebangs
15+
- id: check-illegal-windows-names
16+
- id: check-merge-conflict
17+
- id: check-shebang-scripts-are-executable
18+
- id: check-symlinks
19+
- id: check-toml
20+
- id: check-yaml
21+
- id: detect-private-key
22+
- id: end-of-file-fixer
23+
- id: mixed-line-ending
24+
args: ["--fix=lf"]
25+
- id: name-tests-test
26+
args: ["--pytest-test-first"]
27+
- id: trailing-whitespace
28+
- repo: https://github.com/python-poetry/poetry
29+
rev: 2.1.3
30+
hooks:
31+
- id: poetry-check
32+
args: ["--lock"]
33+
- id: poetry-install
34+
- repo: local
35+
hooks:
36+
- id: lint
37+
name: lint
38+
entry: poe lint-fix
39+
language: system
40+
types: [python]
41+
pass_filenames: false
42+
- id: format
43+
name: format
44+
entry: poe format-fix
45+
language: system
46+
types: [python]
47+
pass_filenames: false
48+
- id: versioncheck
49+
name: versioncheck
50+
entry: poe versioncheck
51+
language: system
52+
types: [python]
53+
pass_filenames: false
54+
- id: licensecheck
55+
name: licensecheck
56+
entry: poe licensecheck
57+
language: system
58+
files: ^pyproject\.toml|poetry\.lock$
59+
pass_filenames: false
60+
- id: typecheck
61+
name: typecheck
62+
entry: poe typecheck
63+
language: system
64+
types: [python]
65+
pass_filenames: false
66+
- id: test
67+
name: test
68+
entry: poe test
69+
language: system
70+
types: [python]
71+
pass_filenames: false

.vscode/settings.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"[python]": {
3+
"editor.defaultFormatter": "charliermarsh.ruff"
4+
},
5+
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
6+
"python.terminal.activateEnvironment": true,
7+
"python.terminal.activateEnvInCurrentTerminal": true,
8+
"task.autoDetect": "off",
9+
}

.vscode/tasks.json

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "install",
6+
"type": "shell",
7+
"command": "poetry",
8+
"args": [
9+
"install"
10+
]
11+
},
12+
{
13+
"label": "start",
14+
"type": "shell",
15+
"command": "poe",
16+
"args": [
17+
"start"
18+
],
19+
"isBackground": true
20+
},
21+
{
22+
"label": "test",
23+
"type": "shell",
24+
"command": "poe",
25+
"args": [
26+
"test"
27+
]
28+
},
29+
{
30+
"label": "typecheck",
31+
"type": "shell",
32+
"command": "poe",
33+
"args": [
34+
"typecheck"
35+
]
36+
},
37+
{
38+
"label": "lint",
39+
"type": "shell",
40+
"command": "poe",
41+
"args": [
42+
"lint"
43+
]
44+
},
45+
{
46+
"label": "lint-fix",
47+
"type": "shell",
48+
"command": "poe",
49+
"args": [
50+
"lint-fix"
51+
]
52+
},
53+
{
54+
"label": "format",
55+
"type": "shell",
56+
"command": "poe",
57+
"args": [
58+
"format"
59+
]
60+
},
61+
{
62+
"label": "format-fix",
63+
"type": "shell",
64+
"command": "poe",
65+
"args": [
66+
"format-fix"
67+
]
68+
},
69+
{
70+
"label": "versioncheck",
71+
"type": "shell",
72+
"command": "poe",
73+
"args": [
74+
"versioncheck"
75+
]
76+
},
77+
{
78+
"label": "licensecheck",
79+
"type": "shell",
80+
"command": "poe",
81+
"args": [
82+
"licensecheck"
83+
]
84+
}
85+
]
86+
}

LICENSE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright (c) 2024 Tomáš Režňák
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0 commit comments

Comments
 (0)