Skip to content

Commit 44a536f

Browse files
committed
Initial commit
0 parents  commit 44a536f

File tree

17 files changed

+752
-0
lines changed

17 files changed

+752
-0
lines changed

.cruft.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"template": "https://github.com/radix-ai/poetry-cookiecutter",
3+
"commit": "9e5572055a98241f97c4d2ae2bfe45fd7cf5c051",
4+
"checkout": null,
5+
"context": {
6+
"cookiecutter": {
7+
"package_name": "ksef",
8+
"package_description": "Python interface for the KSEF API",
9+
"package_url": "https://github.com/samupl/python-ksef",
10+
"author_name": "Jakub Szafrański",
11+
"author_email": "kontakt@samu.pl",
12+
"python_version": "3.8",
13+
"development_environment": "strict",
14+
"with_conventional_commits": "1",
15+
"with_fastapi_api": "0",
16+
"with_jupyter_lab": "0",
17+
"with_pydantic_typing": "1",
18+
"with_sentry_logging": "0",
19+
"with_streamlit_app": "0",
20+
"with_typer_cli": "0",
21+
"continuous_integration": "GitHub",
22+
"docstring_style": "NumPy",
23+
"private_package_repository_name": "",
24+
"private_package_repository_url": "",
25+
"__package_name_kebab_case": "ksef",
26+
"__package_name_snake_case": "ksef",
27+
"_template": "https://github.com/radix-ai/poetry-cookiecutter"
28+
}
29+
},
30+
"directory": null
31+
}

.devcontainer/devcontainer.json

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"name": "ksef",
3+
"dockerComposeFile": "../docker-compose.yml",
4+
"service": "devcontainer",
5+
"workspaceFolder": "/workspaces/ksef/",
6+
"remoteUser": "user",
7+
"overrideCommand": true,
8+
"initializeCommand": ".devcontainer/init",
9+
"postStartCommand": "cp --update /opt/build/poetry/poetry.lock /workspaces/ksef/ && mkdir -p /workspaces/ksef/.git/hooks/ && cp --update /opt/build/git/* /workspaces/ksef/.git/hooks/",
10+
"customizations": {
11+
"vscode": {
12+
"extensions": [
13+
"charliermarsh.ruff",
14+
"ms-python.python",
15+
"ryanluker.vscode-coverage-gutters",
16+
"tamasfe.even-better-toml",
17+
"visualstudioexptteam.vscodeintellicode"
18+
],
19+
"settings": {
20+
"coverage-gutters.coverageFileNames": [
21+
"reports/coverage.xml"
22+
],
23+
"editor.codeActionsOnSave": {
24+
"source.fixAll": true,
25+
"source.organizeImports": true
26+
},
27+
"editor.formatOnSave": true,
28+
"[toml]": {
29+
"editor.formatOnSave": false
30+
},
31+
"editor.rulers": [
32+
100
33+
],
34+
"files.autoSave": "onFocusChange",
35+
"python.defaultInterpreterPath": "/opt/ksef-env/bin/python",
36+
"python.formatting.provider": "black",
37+
"python.linting.mypyEnabled": true,
38+
"python.terminal.activateEnvironment": false,
39+
"python.testing.pytestEnabled": true,
40+
"ruff.importStrategy": "fromEnvironment",
41+
"ruff.logLevel": "warn",
42+
"terminal.integrated.defaultProfile.linux": "zsh",
43+
"terminal.integrated.profiles.linux": {
44+
"zsh": {
45+
"path": "/usr/bin/zsh"
46+
}
47+
}
48+
}
49+
}
50+
}
51+
}

.devcontainer/init

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
3+
# This script runs on the host before the Dev Container is created to support both bind mount and
4+
# volume mount workspaces [1]. If a volume mount workspace is detected, a .env file is generated
5+
# that tells docker-compose.yml to use the container volume as the workspace source.
6+
#
7+
# [1] https://github.com/microsoft/vscode-remote-release/issues/6561
8+
9+
CONTAINER_ID="$(hostname)"
10+
# shellcheck disable=SC2016
11+
WORKSPACE_MOUNT_SOURCE_FMT='{{- $source := "" }}{{- range .HostConfig.Mounts }}{{- if (and (eq .Type "volume") (eq .Target "/workspaces")) }}{{- $source = .Source }}{{- end }}{{- end }}{{- $source }}'
12+
WORKSPACE_CONTAINER_VOLUME_SOURCE=$(docker container inspect "$CONTAINER_ID" --format="$WORKSPACE_MOUNT_SOURCE_FMT" 2>/dev/null)
13+
14+
if [ -z "$WORKSPACE_CONTAINER_VOLUME_SOURCE" ]; then
15+
exit
16+
fi
17+
18+
cat << EOF > .env
19+
# The following variables are used by docker-compose.yml to mount the workspace from a Docker volume.
20+
WORKSPACE_SOURCE=devcontainer-volume
21+
WORKSPACE_TARGET=/workspaces/
22+
WORKSPACE_CONTAINER_VOLUME_SOURCE=$WORKSPACE_CONTAINER_VOLUME_SOURCE
23+
WORKSPACE_IS_CONTAINER_VOLUME=true
24+
EOF
25+
cat .env

.devcontainer/init.cmd

Whitespace-only changes.

.github/dependabot.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
version: 2
2+
3+
updates:
4+
- package-ecosystem: github-actions
5+
directory: /
6+
schedule:
7+
interval: monthly
8+
commit-message:
9+
prefix: "ci"
10+
prefix-development: "ci"
11+
include: "scope"
12+
- package-ecosystem: pip
13+
directory: /
14+
schedule:
15+
interval: monthly
16+
commit-message:
17+
prefix: "build"
18+
prefix-development: "build"
19+
include: "scope"
20+
versioning-strategy: lockfile-only
21+
allow:
22+
- dependency-type: "all"

.github/workflows/publish.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types:
6+
- created
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: "3.8"
20+
21+
- name: Install Poetry
22+
run: pip install --no-input poetry
23+
24+
- name: Publish package
25+
run: |
26+
poetry config pypi-token.pypi "${{ secrets.POETRY_PYPI_TOKEN_PYPI }}"
27+
poetry publish --build

.github/workflows/test.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
pull_request:
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
python-version: ["3.8"]
18+
19+
name: Python ${{ matrix.python-version }}
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
25+
- name: Set up Node.js
26+
uses: actions/setup-node@v3
27+
with:
28+
node-version: 16
29+
30+
- name: Install @devcontainers/cli
31+
run: npm install --location=global @devcontainers/cli@0.27.1
32+
33+
- name: Start Dev Container
34+
env:
35+
DOCKER_BUILDKIT: 1
36+
run: |
37+
git config --global init.defaultBranch main
38+
PYTHON_VERSION=${{ matrix.python-version }} devcontainer up --workspace-folder .
39+
40+
- name: Lint package
41+
run: devcontainer exec --workspace-folder . poe lint
42+
43+
- name: Test package
44+
run: devcontainer exec --workspace-folder . poe test
45+
46+
- name: Upload coverage
47+
uses: codecov/codecov-action@v3
48+
with:
49+
files: reports/coverage.xml

.gitignore

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Coverage.py
2+
htmlcov/
3+
reports/
4+
5+
# cruft
6+
*.rej
7+
8+
# Data
9+
*.csv*
10+
*.dat*
11+
*.pickle*
12+
*.xls*
13+
*.zip*
14+
data/
15+
16+
# direnv
17+
.envrc
18+
19+
# dotenv
20+
.env
21+
22+
# Hypothesis
23+
.hypothesis/
24+
25+
# Jupyter
26+
*.ipynb
27+
.ipynb_checkpoints/
28+
notebooks/
29+
30+
# macOS
31+
.DS_Store
32+
33+
# mypy
34+
.dmypy.json
35+
.mypy_cache/
36+
37+
# Node.js
38+
node_modules/
39+
40+
# Poetry
41+
.venv/
42+
dist/
43+
44+
# PyCharm
45+
.idea/
46+
47+
# pyenv
48+
.python-version
49+
50+
# pytest
51+
.pytest_cache/
52+
53+
# Python
54+
__pycache__/
55+
*.py[cdo]
56+
57+
# Ruff
58+
.ruff_cache/
59+
60+
# Terraform
61+
.terraform/
62+
63+
# VS Code
64+
.vscode/

.pre-commit-config.yaml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# https://pre-commit.com
2+
default_install_hook_types: [commit-msg, pre-commit]
3+
default_stages: [commit, manual]
4+
fail_fast: true
5+
repos:
6+
- repo: meta
7+
hooks:
8+
- id: check-useless-excludes
9+
- repo: https://github.com/pre-commit/pygrep-hooks
10+
rev: v1.9.0
11+
hooks:
12+
- id: python-check-mock-methods
13+
- id: python-use-type-annotations
14+
- id: rst-backticks
15+
- id: rst-directive-colons
16+
- id: rst-inline-touching-normal
17+
- id: text-unicode-replacement-char
18+
- repo: https://github.com/pre-commit/pre-commit-hooks
19+
rev: v4.3.0
20+
hooks:
21+
- id: check-added-large-files
22+
- id: check-ast
23+
- id: check-builtin-literals
24+
- id: check-case-conflict
25+
- id: check-docstring-first
26+
- id: check-json
27+
- id: check-merge-conflict
28+
- id: check-shebang-scripts-are-executable
29+
- id: check-symlinks
30+
- id: check-toml
31+
- id: check-vcs-permalinks
32+
- id: check-xml
33+
- id: check-yaml
34+
- id: debug-statements
35+
- id: destroyed-symlinks
36+
- id: detect-private-key
37+
- id: end-of-file-fixer
38+
types: [python]
39+
- id: fix-byte-order-marker
40+
- id: mixed-line-ending
41+
- id: name-tests-test
42+
args: [--pytest-test-first]
43+
- id: no-commit-to-branch
44+
- id: trailing-whitespace
45+
types: [python]
46+
- repo: local
47+
hooks:
48+
- id: commitizen
49+
name: commitizen
50+
entry: cz check
51+
args: [--commit-msg-file]
52+
require_serial: true
53+
language: system
54+
stages: [commit-msg]
55+
- id: absolufy-imports
56+
name: absolufy-imports
57+
entry: absolufy-imports
58+
require_serial: true
59+
language: system
60+
types: [python]
61+
- id: ruff
62+
name: ruff
63+
entry: ruff
64+
args: ["--fixable=ERA001,F401,F841,T201,T203"]
65+
require_serial: true
66+
language: system
67+
types: [python]
68+
- id: black
69+
name: black
70+
entry: black
71+
require_serial: true
72+
language: system
73+
types: [python]
74+
- id: shellcheck
75+
name: shellcheck
76+
entry: shellcheck
77+
args: [--check-sourced]
78+
language: system
79+
types: [shell]
80+
- id: poetry-check
81+
name: poetry check
82+
entry: poetry check
83+
language: system
84+
files: pyproject.toml
85+
pass_filenames: false
86+
- id: poetry-lock-check
87+
name: poetry lock check
88+
entry: poetry lock
89+
args: [--check]
90+
language: system
91+
pass_filenames: false
92+
- id: mypy
93+
name: mypy
94+
entry: mypy
95+
language: system
96+
types: [python]

0 commit comments

Comments
 (0)