Skip to content

Commit

Permalink
feat: py312
Browse files Browse the repository at this point in the history
  • Loading branch information
klen committed Jul 31, 2024
1 parent 639cd96 commit 3ff3d32
Show file tree
Hide file tree
Showing 9 changed files with 1,232 additions and 113 deletions.
36 changes: 36 additions & 0 deletions .git-commits.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---

convention:
commitTypes:
- feat
- fix
- perf
- refactor
- style
- test
- build
- ops
- docs
- merge
commitScopes: []
releaseTagGlobPattern: v[0-9]*.[0-9]*.[0-9]*

changelog:
commitTypes:
- feat
- fix
- perf
- merge
includeInvalidCommits: true
commitScopes: []
commitIgnoreRegexPattern: "^WIP "
headlines:
feat: Features
fix: Bug Fixes
perf: Performance Improvements
merge: Merges
breakingChange: BREAKING CHANGES
commitUrl: https://github.com/klen/muffin-prometheus/commit/%commit%
commitRangeUrl: https://github.com/klen/muffin-prometheus/compare/%from%...%to%?diff=split
issueRegexPattern: "#[0-9]+"
issueUrl: https://github.com/klen/muffin-prometheus/issues/%issue%
39 changes: 6 additions & 33 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,12 @@ jobs:
steps:

- uses: actions/checkout@main
with:
fetch-depth: 2

- uses: actions/setup-python@main
with:
python-version: '3.11'

- name: Build package
run: |
pip install build
python -m build
- uses: actions/upload-artifact@main
with:
name: dist
path: dist

release:
runs-on: ubuntu-latest
needs: [build]
steps:

- name: Download a distribution artifact
uses: actions/download-artifact@main
with:
name: dist
path: dist

- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypy }}
- name: Install poetry
run: pipx install poetry
- name: Setup poetry
run: poetry config pypi-token.pypi ${{ secrets.pypy }}
- name: Build and publish
run: poetry publish --build

notify:
runs-on: ubuntu-latest
Expand Down
20 changes: 9 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,27 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- name: Checkout changes
uses: actions/checkout@main
- uses: actions/checkout@main
- name: install poetry
run: pipx install poetry

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@main
with:
cache: pip
cache: poetry
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install .[tests]
- name: Install requirements
run: poetry install --with tests

- name: Check code
run: |
ruff muffin_prometheus
run: poetry run ruff check muffin_prometheus

- name: Test with pytest
run: |
pytest tests.py
run: poetry run pytest

notify:
runs-on: ubuntu-latest
Expand Down
104 changes: 76 additions & 28 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,35 +1,83 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks

fail_fast: true
default_install_hook_types: [commit-msg, pre-commit, pre-push]

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.253

- repo: https://github.com/qoomon/git-conventional-commits
rev: 'v2.6.5'
hooks:
- id: ruff
name: Check code
args: [--fix, --exit-non-zero-on-fix]
- id: conventional-commits
args: ["-c", ".git-commits.yaml"]
stages: ["commit-msg"]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-case-conflict
stages: ["pre-commit"]
- id: check-merge-conflict
stages: ["pre-commit"]
- id: check-added-large-files
stages: ["pre-commit"]
- id: check-ast
stages: ["pre-commit"]
- id: check-executables-have-shebangs
stages: ["pre-commit"]
- id: check-symlinks
stages: ["pre-commit"]
- id: check-toml
stages: ["pre-commit"]
- id: check-yaml
stages: ["pre-commit"]
- id: debug-statements
stages: ["pre-commit"]
- id: end-of-file-fixer
stages: ["pre-commit"]
- id: trailing-whitespace
stages: ["pre-commit"]

- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black
stages: ["pre-commit"]

- repo: https://github.com/python-poetry/poetry
rev: '1.5.0'
hooks:
- id: poetry-check
files: ^(.*/)?pyproject\.toml$
stages: ["pre-commit"]
- id: poetry-lock
files: ^(.*/)?(poetry\.lock|pyproject\.toml)$
args: ["--no-update"]
stages: ["pre-commit"]

- repo: local
hooks:
- id: check-types
name: Check types
entry: mypy
language: system
pass_filenames: false
- id: check-code
name: Refactor code
entry: refurb muffin_prometheus
language: system
pass_filenames: false
- id: run-tests
name: Run tests
entry: pytest tests.py
language: system
pass_filenames: false
- id: ruff
name: ruff
entry: poetry run ruff check muffin_rest
language: system
pass_filenames: false
files: \.py$
stages: ["pre-commit"]

- id: mypy
name: mypy
entry: poetry run mypy
language: system
pass_filenames: false
files: \.py$
stages: ["pre-push"]

- id: pytest
name: pytest
entry: poetry run pytest
language: system
pass_filenames: false
files: \.py$
stages: ["pre-push"]
9 changes: 0 additions & 9 deletions MANIFEST.in

This file was deleted.

6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ major:
# Development
# =============

$(VIRTUAL_ENV): pyproject.toml
$(VIRTUAL_ENV): poetry.lock .pre-commit-config.yaml
@[ -d $(VIRTUAL_ENV) ] || python -m venv $(VIRTUAL_ENV)
@$(VIRTUAL_ENV)/bin/pip install -e .[tests,dev]
@$(VIRTUAL_ENV)/bin/pre-commit install --hook-type pre-push
@poetry install --with tests,dev
@poetry run pre-commit install
@touch $(VIRTUAL_ENV)

.PHONY: test
Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Muffin-Prometheus
Requirements
=============

- python >= 3.7
- python >= 3.9

.. _installation:

Expand Down Expand Up @@ -64,12 +64,12 @@ Initialize and setup the plugin:
Options
-------

=========================== =========================== ===========================
=========================== =========================== ===========================
Name Default value Desctiption
--------------------------- --------------------------- ---------------------------
**metrics_url** ``"/dev/prometheus"`` HTTP Path to export metrics for Prometheus_
**group_paths** ``[]`` List of path's prefixes to group. A path which starts from the prefix will be grouped
=========================== =========================== ===========================
=========================== =========================== ===========================


You are able to provide the options when you are initiliazing the plugin:
Expand Down
Loading

0 comments on commit 3ff3d32

Please sign in to comment.