diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 948d1a7a..7570cead 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index c456be92..55421f7c 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4c680675..2cfe68b7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 44e0cc4a..543e252b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 87d0359b..9401f02a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/django_prometheus/__init__.py b/django_prometheus/__init__.py index 994b3350..0712f633 100644 --- a/django_prometheus/__init__.py +++ b/django_prometheus/__init__.py @@ -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: diff --git a/examples/prometheus/prometheus.yml b/examples/prometheus/prometheus.yml index 2a448884..d4473ed9 100644 --- a/examples/prometheus/prometheus.yml +++ b/examples/prometheus/prometheus.yml @@ -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"]