Modernize Codebase and Enhance CI Workflow (#67)

Updated Type Hints:

Used pyupgrade with --py39-plus and --py310-plus flags to upgrade type hints to Python 3.9+ and 3.10+ syntax.
Enforced Double Quotes:

Removed skip-string-normalization = true from the black configuration in pyproject.toml.
Reran black via pre-commit hooks to enforce double quotes in the codebase.
Refactored Dependency Management:

Split requirements.txt into requirements.txt (runtime dependencies) and requirements-dev.txt (development dependencies).
Enhanced CI Workflow:

Integrated pre-commit hooks into the CI pipeline to enforce code quality checks automatically.
Added pip caching to the CI workflow to speed up dependency installation.
Automated Package Publishing:

Added a publish.yml GitHub Actions workflow to automate publishing to PyPI.
The workflow triggers on release creation or manual dispatch, builds the package, and publishes it to PyPI using twine.
This commit is contained in:
Filip Christiansen 2024-12-29 06:52:24 +01:00 committed by GitHub
parent 3c5e7e95ae
commit 848b9dc1ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 398 additions and 342 deletions

View file

@ -4,39 +4,39 @@ repos:
hooks:
# Files
- id: check-added-large-files
description: 'Prevent large files from being committed.'
args: ['--maxkb=10000']
description: "Prevent large files from being committed."
args: ["--maxkb=10000"]
- id: check-case-conflict
description: 'Check for files that would conflict in case-insensitive filesystems.'
description: "Check for files that would conflict in case-insensitive filesystems."
- id: fix-byte-order-marker
description: 'Remove utf-8 byte order marker.'
description: "Remove utf-8 byte order marker."
- id: mixed-line-ending
description: 'Replace mixed line ending.'
description: "Replace mixed line ending."
# Links
- id: destroyed-symlinks
description: 'Detect symlinks which are changed to regular files with a content of a path which that symlink was pointing to.'
description: "Detect symlinks which are changed to regular files with a content of a path which that symlink was pointing to."
# File files for parseable syntax: python
- id: check-ast
# File and line endings
- id: end-of-file-fixer
description: 'Ensure that a file is either empty, or ends with one newline.'
description: "Ensure that a file is either empty, or ends with one newline."
- id: trailing-whitespace
description: 'Trim trailing whitespace.'
description: "Trim trailing whitespace."
# Python
- id: check-docstring-first
description: 'Check a common error of defining a docstring after code.'
description: "Check a common error of defining a docstring after code."
- id: requirements-txt-fixer
description: 'Sort entries in requirements.txt.'
description: "Sort entries in requirements.txt."
- repo: https://github.com/MarcoGorelli/absolufy-imports
rev: v0.3.1
hooks:
- id: absolufy-imports
description: 'Automatically convert relative imports to absolute. (Use `args: [--never]` to revert.)'
description: "Automatically convert relative imports to absolute. (Use `args: [--never]` to revert.)"
- repo: https://github.com/psf/black
rev: 24.10.0
@ -47,30 +47,30 @@ repos:
rev: v3.19.1
hooks:
- id: pyupgrade
description: 'Automatically upgrade syntax for newer versions.'
args: [--py3-plus, --py36-plus, --py38-plus]
description: "Automatically upgrade syntax for newer versions."
args: [--py3-plus, --py36-plus, --py38-plus, --py39-plus, --py310-plus]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa
description: 'Enforce that `noqa` annotations always occur with specific codes. Sample annotations: `# noqa: F401`, `# noqa: F401,W203`.'
description: "Enforce that `noqa` annotations always occur with specific codes. Sample annotations: `# noqa: F401`, `# noqa: F401,W203`."
- id: python-check-blanket-type-ignore
description: 'Enforce that `# type: ignore` annotations always occur with specific codes. Sample annotations: `# type: ignore[attr-defined]`, `# type: ignore[attr-defined, name-defined]`.'
description: "Enforce that `# type: ignore` annotations always occur with specific codes. Sample annotations: `# type: ignore[attr-defined]`, `# type: ignore[attr-defined, name-defined]`."
- id: python-use-type-annotations
description: 'Enforce that python3.6+ type annotations are used instead of type comments.'
description: "Enforce that python3.6+ type annotations are used instead of type comments."
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
description: 'Sort imports alphabetically, and automatically separated into sections and by type.'
description: "Sort imports alphabetically, and automatically separated into sections and by type."
- repo: https://github.com/hadialqattan/pycln
rev: v2.4.0
hooks:
- id: pycln
description: 'Remove unused import statements.'
description: "Remove unused import statements."
- repo: https://github.com/djlint/djLint
rev: v1.36.4