From c37b1385578906f1b70e7f1eff78931c0083c5a8 Mon Sep 17 00:00:00 2001 From: Rob Hudson Date: Thu, 25 Apr 2024 09:14:20 -0700 Subject: [PATCH] Update pre-commit, add pyproject-fmt, run on all files --- .pre-commit-config.yaml | 10 +++-- .readthedocs.yaml | 2 +- CHANGES | 2 +- README.rst | 2 +- docs/conf.py | 4 +- docs/configuration.rst | 2 +- docs/requirements.txt | 2 +- pyproject.toml | 82 +++++++++++++++++++++-------------------- 8 files changed, 56 insertions(+), 50 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 41be4c1..e396597 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,16 +12,20 @@ repos: # Note: hooks that add content must run before ones which check formatting, lint, etc - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 # Use the ref you want to point at + rev: v4.6.0 hooks: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace - - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.1.14 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.4.1 hooks: # Run the linter - id: ruff args: [--fix, --exit-non-zero-on-fix] # Run the formatter - id: ruff-format + - repo: https://github.com/tox-dev/pyproject-fmt + rev: 1.8.0 + hooks: + - id: pyproject-fmt diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 24bff09..0af7e18 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -22,4 +22,4 @@ python: install: - method: pip path: . - - requirements: docs/requirements.txt \ No newline at end of file + - requirements: docs/requirements.txt diff --git a/CHANGES b/CHANGES index bb2ab49..4a45f50 100644 --- a/CHANGES +++ b/CHANGES @@ -5,7 +5,7 @@ CHANGES Unreleased ========== -- Nothing, currently +- Add pyproject-fmt to pre-commit, and update pre-commit versions. 3.8 === diff --git a/README.rst b/README.rst index 91cc2a5..1fd486d 100644 --- a/README.rst +++ b/README.rst @@ -10,7 +10,7 @@ Django-CSP Django-CSP adds Content-Security-Policy_ headers to Django. -The code lives on GitHub_, where you can report Issues_. +The code lives on GitHub_, where you can report Issues_. The full documentation is available on ReadTheDocs_. diff --git a/docs/conf.py b/docs/conf.py index 0bb8fd7..dc1ebe9 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -217,9 +217,7 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [ - ("index", "django-csp", "Django-CSP Documentation", ["James Socol, Mozilla"], 1) -] +man_pages = [("index", "django-csp", "Django-CSP Documentation", ["James Socol, Mozilla"], 1)] # If true, show URL addresses after external links. # man_show_urls = False diff --git a/docs/configuration.rst b/docs/configuration.rst index ba9a422..7126391 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -220,4 +220,4 @@ These settings control the behavior of django-csp. Defaults are in .. _block-all-mixed-content: https://w3c.github.io/webappsec-mixed-content/ .. _block-all-mixed-content_mdn: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/block-all-mixed-content .. _plugin_types_mdn: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/plugin-types -.. _prefetch_src_mdn: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/prefetch-src \ No newline at end of file +.. _prefetch_src_mdn: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/prefetch-src diff --git a/docs/requirements.txt b/docs/requirements.txt index 52b04f2..483a4e9 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1 +1 @@ -sphinx_rtd_theme \ No newline at end of file +sphinx_rtd_theme diff --git a/pyproject.toml b/pyproject.toml index 9520651..6091739 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,55 +1,59 @@ [build-system] -requires = ["setuptools>=61.2"] build-backend = "setuptools.build_meta" +requires = [ + "setuptools>=61.2", +] [project] -name = "django_csp" +name = "django-csp" version = "3.8" description = "Django Content Security Policy support." readme = "README.rst" -authors = [{name = "James Socol", email = "me@jamessocol.com"}] -maintainers = [{name = "Mozilla MEAO team", email = "meao-backend@mozilla.com"}] license = {text = "BSD"} +maintainers = [{name = "Mozilla MEAO team", email = "meao-backend@mozilla.com"}] +authors = [{name = "James Socol", email = "me@jamessocol.com"}] classifiers = [ - "Development Status :: 5 - Production/Stable", - "Environment :: Web Environment", - "Environment :: Web Environment :: Mozilla", - "Programming Language :: Python", - "License :: OSI Approved :: BSD License", - "Operating System :: OS Independent", - "Intended Audience :: Developers", - "Topic :: Software Development :: Libraries :: Python Modules", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: Implementation :: PyPy", - "Programming Language :: Python :: Implementation :: CPython", - "Framework :: Django :: 3.2", - "Framework :: Django :: 4.2", - "Framework :: Django :: 5.0", + "Development Status :: 5 - Production/Stable", + "Environment :: Web Environment", + "Environment :: Web Environment :: Mozilla", + "Framework :: Django :: 3.2", + "Framework :: Django :: 4.2", + "Framework :: Django :: 5.0", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Software Development :: Libraries :: Python Modules", +] +dependencies = [ + "Django>=3.2", ] -dependencies = ["Django>=3.2"] - -[project.urls] -Homepage = "http://github.com/mozilla/django-csp" -Documentation = "http://django-csp.readthedocs.org/" -Changelog = "https://github.com/mozilla/django-csp/blob/main/CHANGES" -"Bug Tracker" = "https://github.com/mozilla/django-csp/issues" -"Source Code" = "https://github.com/mozilla/django-csp" - [project.optional-dependencies] +jinja2 = [ + "jinja2>=2.9.6", +] tests = [ - "pytest", - "pytest-cov", - "pytest-django", - "pytest-ruff", - "jinja2>=2.9.6", + "jinja2>=2.9.6", + "pytest", + "pytest-cov", + "pytest-django", + "pytest-ruff", ] -jinja2 = ["jinja2>=2.9.6"] +[project.urls] +"Bug Tracker" = "https://github.com/mozilla/django-csp/issues" +Changelog = "https://github.com/mozilla/django-csp/blob/main/CHANGES" +Documentation = "http://django-csp.readthedocs.org/" +Homepage = "http://github.com/mozilla/django-csp" +"Source Code" = "https://github.com/mozilla/django-csp" [tool.setuptools] zip-safe = false