diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ab0c4d3..abeb3f7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -39,6 +39,4 @@ jobs: - name: Launch tests run: python -m pytest -n auto - name: Check coding style - run: python -m flake8 - - name: Check imports order - run: python -m isort . --check --diff + run: python -m ruff check diff --git a/flask_weasyprint/__init__.py b/flask_weasyprint/__init__.py index 2851f73..9bb248a 100644 --- a/flask_weasyprint/__init__.py +++ b/flask_weasyprint/__init__.py @@ -146,7 +146,7 @@ def _wrapper(class_, *args, **kwargs): return class_(guess, *args, **kwargs) -def HTML(*args, **kwargs): +def HTML(*args, **kwargs): # noqa: N802 """Like :class:`weasyprint.HTML` but: * :func:`make_url_fetcher` is used to create an ``url_fetcher`` @@ -163,7 +163,7 @@ def HTML(*args, **kwargs): return _wrapper(HTML, *args, **kwargs) -def CSS(*args, **kwargs): +def CSS(*args, **kwargs): # noqa: N802 from weasyprint import CSS # lazy loading return _wrapper(CSS, *args, **kwargs) diff --git a/pyproject.toml b/pyproject.toml index 17a4886..d208a7b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,7 +46,7 @@ Donation = 'https://opencollective.com/courtbouillon' [project.optional-dependencies] doc = ['sphinx', 'sphinx_rtd_theme'] -test = ['pytest', 'isort', 'flake8'] +test = ['pytest', 'ruff'] [tool.flit.sdist] exclude = ['.*'] @@ -59,6 +59,6 @@ include = ['tests/*', 'flask_weasyprint/*'] exclude_lines = ['pragma: no cover', 'def __repr__', 'raise NotImplementedError'] omit = ['.*'] -[tool.isort] -default_section = 'FIRSTPARTY' -multi_line_output = 4 +[tool.ruff.lint] +select = ['E', 'W', 'F', 'I', 'N', 'RUF'] +ignore = ['RUF001', 'RUF002', 'RUF003'] diff --git a/tests/__init__.py b/tests/__init__.py index 2999b96..9d05f57 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -14,7 +14,7 @@ @app.config.from_object class Config: - GRAPH_COLORS = ['#0C3795', '#752641', '#E47F00'] + GRAPH_COLORS = ('#0C3795', '#752641', '#E47F00') @app.route('/') diff --git a/tests/test_flask_weasyprint.py b/tests/test_flask_weasyprint.py index d9afdf7..d8a5a43 100644 --- a/tests/test_flask_weasyprint.py +++ b/tests/test_flask_weasyprint.py @@ -2,10 +2,11 @@ import pytest from flask import Flask, json, jsonify, redirect, request -from flask_weasyprint import CSS, HTML, make_url_fetcher, render_pdf from weasyprint import __version__ as weasyprint_version from werkzeug.test import ClientRedirectError +from flask_weasyprint import CSS, HTML, make_url_fetcher, render_pdf + from . import app, document_html