Skip to content

Commit

Permalink
Merge pull request #5 from cryptk/pydantic
Browse files Browse the repository at this point in the history
Pydantic models and a big cleanup
  • Loading branch information
cryptk committed May 25, 2023
2 parents ddafeb1 + 7dd0ab2 commit 11b32cb
Show file tree
Hide file tree
Showing 16 changed files with 1,853 additions and 469 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: CI

on:
push:
branches:
- main
pull_request:

concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
# Make sure commit messages follow the conventional commits convention:
# https://www.conventionalcommits.org
commitlint:
name: Lint Commit Messages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v5.3.0
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- uses: abatilo/actions-poetry@v2.3.0
- uses: pre-commit/action@v3.0.0

test:
strategy:
fail-fast: false
matrix:
python-version:
- "3.10"
- "3.11"
os:
- ubuntu-latest
- windows-latest
- macOS-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: abatilo/actions-poetry@v2.3.0
- name: Install Dependencies
run: poetry install
shell: bash
# - name: Test with Pytest
# run: poetry run pytest
# shell: bash
# release:
# runs-on: ubuntu-latest
# environment: release
# if: github.ref == 'refs/heads/main'
# needs:
# - test

# steps:
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0
# persist-credentials: false

# # Run semantic release:
# # - Update CHANGELOG.md
# # - Update version in code
# # - Create git tag
# # - Create GitHub release
# # - Publish to PyPI
# - name: Python Semantic Release
# uses: relekang/python-semantic-release@v7.33.2
# with:
# github_token: ${{ secrets.GH_TOKEN }}
# repository_username: __token__
# repository_password: ${{ secrets.PYPI_TOKEN }}
54 changes: 54 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
exclude: "CHANGELOG.md"
default_stages: [ commit ]

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: debug-statements
- id: check-builtin-literals
- id: check-case-conflict
- id: check-docstring-first
- id: check-json
exclude: ^.vscode/
- id: check-toml
- id: detect-private-key
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/python-poetry/poetry
rev: 1.3.2
hooks:
- id: poetry-check
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
- id: black
- repo: https://github.com/codespell-project/codespell
rev: v2.2.2
hooks:
- id: codespell
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.260
hooks:
- id: ruff
args:
- --fix
# - repo: local
# hooks:
# - id: pylint
# name: pylint
# entry: poetry run -- pylint
# language: system
# types: [python]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.2.0
hooks:
- id: mypy
exclude: cli.py
additional_dependencies: [ "pydantic" ]
7 changes: 6 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{
"files.trimTrailingWhitespace": true,
"editor.rulers": [140]
"editor.rulers": [140],
"python.formatting.provider": "black",
// https://code.visualstudio.com/docs/python/testing#_pytest-configuration-settings
"python.testing.pytestEnabled": false,
"python.linting.mypyEnabled": true,
"python.analysis.typeCheckingMode": "basic"
}
692 changes: 689 additions & 3 deletions poetry.lock

Large diffs are not rendered by default.

Loading

0 comments on commit 11b32cb

Please sign in to comment.