Skip to content

Commit

Permalink
feat: add initial content
Browse files Browse the repository at this point in the history
  • Loading branch information
sisp committed May 17, 2023
0 parents commit 7d0a1b1
Show file tree
Hide file tree
Showing 25 changed files with 2,481 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
indent_style = space
indent_size = 2

[*.py]
indent_size = 4
11 changes: 11 additions & 0 deletions .github/.dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
56 changes: 56 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
on:
release:
types:
- published

name: release

jobs:
build:
name: Build project for distribution
runs-on: ubuntu-latest
environment: release

steps:
- uses: actions/checkout@v3

- name: Update PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Bootstrap Poetry
run: curl -sSL https://install.python-poetry.org | python - -y

- name: Build project for distribution
run: poetry build

- name: Upload artifact containing distribution files
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
if-no-files-found: error

pypi:
name: Publish package distributions to PyPI
runs-on: ubuntu-latest
environment: release

permissions:
id-token: write

steps:
- name: Download artifact containing distribution files
uses: actions/download-artifact@v3
with:
name: dist
path: dist/

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
70 changes: 70 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
on:
push:
branches:
- main
pull_request:
branches:
- main

name: tests

jobs:
tests:
name: ${{ matrix.os }} / ${{ matrix.python-version }}
runs-on: ${{ matrix.image }}
strategy:
matrix:
os: [Ubuntu, macOS, Windows]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
include:
- os: Ubuntu
image: ubuntu-latest
- os: Windows
image: windows-latest
- os: macOS
image: macos-latest
fail-fast: false
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3

- name: Update PATH for Linux/macOS
if: ${{ matrix.os != 'Windows' }}
run: echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Update PATH for Windows
if: ${{ matrix.os == 'Windows' }}
run: echo "$APPDATA\Python\Scripts" >> $GITHUB_PATH

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Get full Python version
id: full-python-version
run: echo version=$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") >> $GITHUB_OUTPUT

- name: Bootstrap Poetry
run: curl -sSL https://install.python-poetry.org | python - -y

- name: Configure Poetry
run: poetry config virtualenvs.in-project true

- name: Set up cache
uses: actions/cache@v3
id: cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
run: poetry install

- name: Run pre-commit hooks
run: poetry run pre-commit run --all-files --show-diff-on-failure

- name: Run pytest
run: poetry run pytest
129 changes: 129 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
.pytest-junit-report.xml

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don’t work, or not
# install all needed dependencies.
#Pipfile.lock

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

.idea/
.vscode/*
!.vscode/extensions.json
!.vscode/settings.json
68 changes: 68 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
repos:
- repo: local
hooks:
- id: black
name: black
entry: black
language: system
require_serial: true
types: [python]

- id: isort
name: isort
entry: isort
args: [--filter-files]
language: system
require_serial: true
types: [python]

- id: ruff
name: ruff
entry: ruff check
args: [--force-exclude]
language: system
require_serial: true
types_or: [python, pyi]
minimum_pre_commit_version: "2.9.2"

- id: mypy
name: mypy
entry: mypy
language: system
require_serial: true
types: [python]

- id: poetry-check
name: poetry-check
entry: poetry check
language: system
pass_filenames: false
files: ^pyproject.toml$

- id: poetry-check-lock
name: poetry-check-lock
entry: poetry lock --check
language: system
pass_filenames: false
files: ^pyproject.toml|poetry.lock$

- id: trailing-whitespace
name: trim trailing whitespace
entry: trailing-whitespace-fixer
language: system
types: [text]
stages: [commit, push, manual]

- id: end-of-file-fixer
name: fix end of files
entry: end-of-file-fixer
language: system
types: [text]
stages: [commit, push, manual]

- id: check-merge-conflict
name: check for merge conflicts
entry: check-merge-conflict
args: [--assume-in-merge]
language: system
types: [text]
8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"editorconfig.editorconfig",
"charliermarsh.ruff",
"ms-python.black-formatter",
"ms-python.python"
]
}
14 changes: 14 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"editor.formatOnSave": true,
"python.formatting.provider": "none",
"python.linting.flake8Enabled": false,
"python.linting.mypyEnabled": true,
"python.linting.pydocstyleEnabled": false,
"python.linting.pylintEnabled": false,
"python.testing.pytestEnabled": true,
"[python]": {
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "file",
"editor.defaultFormatter": "ms-python.black-formatter"
}
}
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog][keepachangelog], and this project adheres to [Semantic Versioning]().

## [Unreleased]

### Added

- A [Jinja2 extension][jinja-extensions] providing a [Jinja2 filter][jinja-filter] for validating data against a JSON/YAML schema within [Jinja2][jinja] templates.

[jinja]: https://jinja.palletsprojects.com
[jinja-extensions]: https://jinja.palletsprojects.com/en/latest/extensions
[jinja-filter]: https://jinja.palletsprojects.com/en/latest/templates/#filters
[keepachangelog]: https://keepachangelog.com/en/1.0.0
[semver]: https://semver.org/spec/v2.0.0.html
Loading

0 comments on commit 7d0a1b1

Please sign in to comment.