Skip to content

Prep release + more pre-commit hooks #467

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 37 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,40 +41,40 @@ jobs:
ports:
- 5432:5432
steps:
- name: Install OS Packages
run: |
sudo apt-get update
sudo apt-get install binutils libproj-dev gdal-bin libmemcached-dev libsqlite3-mod-spatialite
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -U "pip>=23.1.1"
pip install -U "tox-gh-actions==3.3.0" coverage
- name: Log versions
run: |
python --version
pip --version
psql -V
mysql -V
- name: prep DB
env:
MYSQL_TCP_PORT: 3306
MYSQL_HOST: localhost
PGHOST: localhost
PGPORT: 5432
run: |
psql -U postgres -c 'CREATE DATABASE postgis'
psql -U postgres postgis -c 'CREATE EXTENSION IF NOT EXISTS postgis;'
mysql --protocol=TCP --user=root -e 'create database django_prometheus_1;'
- name: Run test and linters via Tox
run: tox
- name: Process code coverage
run: |
coverage combine .coverage django_prometheus/tests/end2end/.coverage
coverage xml
- name: Install OS Packages
run: |
sudo apt-get update
sudo apt-get install binutils libproj-dev gdal-bin libmemcached-dev libsqlite3-mod-spatialite
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -U "pip>=23.1.1"
pip install -U "tox-gh-actions==3.3.0" coverage
- name: Log versions
run: |
python --version
pip --version
psql -V
mysql -V
- name: prep DB
env:
MYSQL_TCP_PORT: 3306
MYSQL_HOST: localhost
PGHOST: localhost
PGPORT: 5432
run: |
psql -U postgres -c 'CREATE DATABASE postgis'
psql -U postgres postgis -c 'CREATE EXTENSION IF NOT EXISTS postgis;'
mysql --protocol=TCP --user=root -e 'create database django_prometheus_1;'
- name: Run test and linters via Tox
run: tox
- name: Process code coverage
run: |
coverage combine .coverage django_prometheus/tests/end2end/.coverage
coverage xml
42 changes: 21 additions & 21 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@ jobs:
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install wheel setuptools packaging twine build --upgrade
- name: Set version number
run: python update_version_from_git.py
- name: Build
run: python -m build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@v1.12.4
with:
skip-existing: true
verbose: true
print-hash: true
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install wheel setuptools packaging twine build --upgrade
- name: Set version number
run: python update_version_from_git.py
- name: Build
run: python -m build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@v1.12.4
with:
skip-existing: true
verbose: true
print-hash: true
40 changes: 20 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,23 @@ jobs:
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.determine-tag.outputs.release-tag }}
fetch-depth: 0
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install wheel setuptools packaging twine build --upgrade
- name: Build
run: python -m build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@v1.12.4
with:
skip-existing: true
verbose: true
print-hash: true
- uses: actions/checkout@v4
with:
ref: ${{ needs.determine-tag.outputs.release-tag }}
fetch-depth: 0
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install wheel setuptools packaging twine build --upgrade
- name: Build
run: python -m build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@v1.12.4
with:
skip-existing: true
verbose: true
print-hash: true
39 changes: 22 additions & 17 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-case-conflict
- id: check-merge-conflict
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/adamchainz/django-upgrade
rev: "1.25.0"
- id: check-case-conflict
- id: check-merge-conflict
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/adamchainz/django-upgrade
rev: '1.25.0'
hooks:
- id: django-upgrade
args: [--target-version, "4.2"]

- repo: https://github.com/astral-sh/ruff-pre-commit
- id: django-upgrade
args: [--target-version, '4.2']
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.13
hooks:
- id: ruff-check
- id: ruff-check
name: ruff check
args: ["--fix"]
- id: ruff-format
args: ['--fix']
- id: ruff-format
name: ruff format
- repo: https://github.com/asottile/pyupgrade
rev: v3.20.0
hooks:
- id: pyupgrade
- repo: https://github.com/google/yamlfmt
rev: v0.17.0
hooks:
- id: yamlfmt
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Changelog

## v2.4.0 - UNPUBLISHED
## v2.4.0 - January 8th, 2025

* Add support for Django 5.0 and Python 3.12.
* Replace black, flake8 and isort with Ruff
* Drop support for Django 3.2 (Python 3.7), 4.0 and 4.1
* Project moved to the [Django Commons](https://github.com/django-commons) GitHub organization.
* Add pyupgrade and yamlfmt pre-commit hooks

## v2.3.1 - May 2nd, 2023

Expand Down
2 changes: 1 addition & 1 deletion django_prometheus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

__all__ = ["middleware", "models", "pip_prometheus"]

__version__ = "2.4.0.dev0"
__version__ = "2.4.0"

# Import pip_prometheus to export the pip metrics automatically.
try:
Expand Down
11 changes: 4 additions & 7 deletions examples/prometheus/prometheus.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
global:
scrape_interval: 10s
evaluation_interval: 10s

external_labels:
monitor: django-monitor

rule_files:
- "django.rules"

- "django.rules"
scrape_configs:
- job_name: "django"
static_configs:
- targets: ["localhost:8000"]
- job_name: "django"
static_configs:
- targets: ["localhost:8000"]