Skip to content

Commit

Permalink
chore: set up project (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
OLILHR authored Nov 16, 2024
1 parent 1ceee86 commit 8a9ebcc
Show file tree
Hide file tree
Showing 21 changed files with 594 additions and 1 deletion.
24 changes: 24 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
commit-message:
prefix: "build(deps): "
reviewers:
- "OLILHR"
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
commit-message:
prefix: "build(deps): "
reviewers:
- "OLILHR"
21 changes: 21 additions & 0 deletions .github/workflows/conventional_commit_validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: "Commit Message Title Validation"

on:
pull_request:
types: [opened, synchronize, reopened, edited]

permissions:
contents: read
pull-requests: write

jobs:
validate-pr-title:
runs-on: ubuntu-latest
if: github.actor != 'dependabot[bot]' # skip for dependabot (preconfigured commit message)
steps:
- name: Commit Message Title Validation
uses: ytanikin/PRConventionalCommits@1.3.0
with:
task_types: '["feat","fix","docs","style","refactor","perf","test","build","ci","chore","revert"]'
add_label: "true"
custom_labels: '{"feat": "feature", "fix": "fix", "docs": "documentation", "test": "test", "ci": "CI/CD", "refactor": "refactor", "perf": "performance", "chore": "chore", "revert": "revert", "wip": "WIP"}'
26 changes: 26 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "Coverage"

on:
push:
branches: [main]
pull_request: {}
jobs:
coverage:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.13"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Run Tests and Record Coverage
run: |
tox -e coverage
18 changes: 18 additions & 0 deletions .github/workflows/dependabot_automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Dependabot auto-approve / -merge
on: pull_request

jobs:
dependabot:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Approve a PR
run: gh pr review --approve "$PR_URL"
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --squash "$PR_URL"
28 changes: 28 additions & 0 deletions .github/workflows/dev_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "Test Dev Environment"
# Checks that the dev environment (tox -e dev) can be set up.
# This might not work, if different linting/testing envs refer to different versions of the same lib (e.g. typing-extensions).
# Different versions of the same package might work for isolated specific envs (only linting, only testing...) but the dev environment inherits from all of them.
on:
push:
branches: [main]
pull_request: {}
jobs:
check:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Create a Dev Environment
run: |
tox -e dev
27 changes: 27 additions & 0 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "Formatting"

on:
push:
branches: [main]
pull_request: {}
jobs:
black:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.13"]
os: [ubuntu-latest]
tool: ["black", "isort"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[formatting]
- name: ${{ matrix.tool }} Code Formatter
run: |
${{ matrix.tool }} . --check
15 changes: 15 additions & 0 deletions .github/workflows/no_byte_order_mark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Prevent ByteOrderMarks

on:
push:
branches:
- main
pull_request: {}

jobs:
bom-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: arma-actions/bom-check@v1
name: Check for BOM
28 changes: 28 additions & 0 deletions .github/workflows/pythonlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "Linting"

on:
push:
branches: [main]
pull_request: {}
jobs:
pylint:
name: Python Code Quality and Lint
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.13"]
os: [ubuntu-latest]
linter-env: ["linting", "type_check", "spell_check"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Run ${{ matrix.linter-env }} via Tox
run: |
tox -e ${{ matrix.linter-env }}
26 changes: 26 additions & 0 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "Unittests"

on:
push:
branches: [main]
pull_request: {}
jobs:
pytest:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Run the Unit Tests via Tox
run: |
tox -e tests
137 changes: 137 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# 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
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

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

# 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

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# 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/

# system
.DS_Store

.idea/

# vscode settings
.vscode/
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
# ahb-diff
3 changes: 3 additions & 0 deletions ahb_diff/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""
src contains all your business logic
"""
23 changes: 23 additions & 0 deletions ahb_diff/mymodule.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""
This a docstring for the module.
"""


class MyClass: # pylint: disable=too-few-public-methods
"""
This is a docstring for the class.
"""

def __init__(self) -> None:
"""
Initialize for the sake of initializing
"""
self.my_instance_var: str = "abc"

def do_something(self) -> str:
"""
Actually does nothing.
:return: the value of an instance variable
"""
# this is a super long line with: 100 < line length <= 120 to demonstrate the purpose of pyproject.toml
return self.my_instance_var
2 changes: 2 additions & 0 deletions ahb_diff/py.typed
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This file marks mypackage as PEP561 compatible.
# Further reading: https://mypy.readthedocs.io/en/stable/installed_packages.html#creating-pep-561-compatible-packages
Loading

0 comments on commit 8a9ebcc

Please sign in to comment.