Skip to content

Commit

Permalink
replace black, flake8 and isort with ruff (#447)
Browse files Browse the repository at this point in the history
* replace black and isort with ruff

* replace flake8

* flake8 changelog

* update readme
  • Loading branch information
dulmandakh authored Dec 7, 2024
1 parent ed6b108 commit b1d30cd
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 34 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## v2.4.0 - UNPUBLISHED

* 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

## v2.3.1 - May 2nd, 2023
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Export Django monitoring metrics for Prometheus.io
[![Build Status](https://github.com/korfuri/django-prometheus/actions/workflows/ci.yml/badge.svg)](https://github.com/korfuri/django-prometheus/actions/workflows/ci.yml)
[![Coverage Status](https://coveralls.io/repos/github/korfuri/django-prometheus/badge.svg?branch=master)](https://coveralls.io/github/korfuri/django-prometheus?branch=master)
[![PyPi page link -- Python versions](https://img.shields.io/pypi/pyversions/django-prometheus.svg)](https://pypi.python.org/pypi/django-prometheus)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)


## Features

Expand Down
1 change: 1 addition & 0 deletions django_prometheus/tests/end2end/testapp/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import tempfile

from django import VERSION as DJANGO_VERSION

from testapp.helpers import get_middleware

# SECURITY WARNING: keep the secret key used in production secret!
Expand Down
2 changes: 1 addition & 1 deletion django_prometheus/tests/end2end/testapp/test_middleware.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import pytest
from testapp.views import ObjectionException

from django_prometheus.testutils import (
assert_metric_diff,
assert_metric_equal,
save_registry,
)
from testapp.views import ObjectionException


def M(metric_name):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import pytest
from prometheus_client import REGISTRY
from prometheus_client.metrics import MetricWrapperBase
from testapp.helpers import get_middleware
from testapp.test_middleware import M, T

from django_prometheus.middleware import (
Metrics,
PrometheusAfterMiddleware,
PrometheusBeforeMiddleware,
)
from django_prometheus.testutils import assert_metric_diff, save_registry
from testapp.helpers import get_middleware
from testapp.test_middleware import M, T

EXTENDED_METRICS = [
M("requests_latency_seconds_by_view_method"),
Expand Down
2 changes: 1 addition & 1 deletion django_prometheus/tests/end2end/testapp/test_models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
from testapp.models import Dog, Lawn

from django_prometheus.testutils import assert_metric_diff, save_registry
from testapp.models import Dog, Lawn


def M(metric_name):
Expand Down
1 change: 1 addition & 0 deletions django_prometheus/tests/end2end/testapp/urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.contrib import admin
from django.urls import include, path, re_path

from testapp import views

urlpatterns = [
Expand Down
1 change: 1 addition & 0 deletions django_prometheus/tests/end2end/testapp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from django.http import FileResponse
from django.shortcuts import render
from django.template.response import TemplateResponse

from testapp.models import Lawn


Expand Down
26 changes: 5 additions & 21 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,12 @@ build-backend = "setuptools.build_meta"
[tool.pytest.ini_options]
addopts = " --ignore django_prometheus/tests/end2end"

[tool.isort]
multi_line_output = 3
line_length = 88
force_grid_wrap = 0
include_trailing_comma = true

[tool.black]
line-length = 120

[tool.ruff]
line-length = 120
target-version = "py38"

[tool.ruff.lint]
select = ["B", "C4", "E", "F", "I", "T10", "YTT", "W"]

[tool.tox]
legacy_tox_ini = """
Expand Down Expand Up @@ -56,18 +50,8 @@ commands =
[testenv:py39-lint]
deps =
black==23.3.0
flake8
ruff==0.0.262
isort>=5.12.0,<6
flake8-debugger
flake8-2020
flake8-comprehensions
flake8-bugbear
ruff==0.8.2
commands =
black --check django_prometheus/
flake8 django_prometheus
isort --check-only django_prometheus/
ruff format --check django_prometheus/
ruff check django_prometheus/
"""
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
django-redis>=4.12.1
black
flake8
prometheus-client>=0.12.0
pip-prometheus>=1.2.1
mysqlclient
Expand Down
6 changes: 0 additions & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
[aliases]
test=pytest

[pycodestyle]
max-line-length = 110

[flake8]
ignore = E501,W503

0 comments on commit b1d30cd

Please sign in to comment.