diff --git a/.github/workflows/dependabot-auto-approve-and-merge.yml b/.github/workflows/dependabot-auto-approve-and-merge.yml
index c5b79c57..27e494a7 100644
--- a/.github/workflows/dependabot-auto-approve-and-merge.yml
+++ b/.github/workflows/dependabot-auto-approve-and-merge.yml
@@ -17,7 +17,7 @@ jobs:
# This step will fail (without approval) if there's no metadata.
- name: Dependabot metadata
id: dependabot-metadata
- uses: dependabot/fetch-metadata@v1.6.0
+ uses: dependabot/fetch-metadata@v2.0.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
# Approve the PR.
diff --git a/Makefile b/Makefile
index 30d11ee4..5fdc9a70 100644
--- a/Makefile
+++ b/Makefile
@@ -12,11 +12,11 @@ tests:
.PHONY: reformat
reformat:
ruff format .
- ruff --fix .
+ ruff check . --fix
.PHONY: lint
lint:
- ruff .
+ ruff check .
.PHONY: docs
docs: clean
diff --git a/example/app/forms.py b/example/app/forms.py
index cdfa0cb8..86146933 100644
--- a/example/app/forms.py
+++ b/example/app/forms.py
@@ -41,7 +41,7 @@ class TestForm(forms.Form):
message = forms.CharField(required=False, help_text="my_help_text")
sender = forms.EmailField(label="Sender © unicode", help_text='E.g., "me@example.com"')
secret = forms.CharField(initial=42, widget=forms.HiddenInput)
- weird = forms.CharField(help_text="strings are now utf-8 \u03BCnico\u0394é!")
+ weird = forms.CharField(help_text="strings are now utf-8 \u03bcnico\u0394é!")
cc_myself = forms.BooleanField(
required=False, help_text='cc stands for "carbon copy." You will get a copy in your mailbox.'
)
diff --git a/example/app/wsgi.py b/example/app/wsgi.py
index 7cac8d32..f96fcc08 100644
--- a/example/app/wsgi.py
+++ b/example/app/wsgi.py
@@ -12,6 +12,7 @@
middleware here, or combine a Django application with an application of another
framework.
"""
+
import os
from django.core.wsgi import get_wsgi_application
diff --git a/pyproject.toml b/pyproject.toml
index 2fa44c7f..ff33898d 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -45,33 +45,33 @@ Source = "https://github.com/zostera/django-bootstrap3"
[tool.ruff]
fix = false
-fixable = [
+line-length = 120
+lint.fixable = [
"I001", # isort (sorting)
"F", # flake8
"D", # docformatter
"UP", # pyupgrade
]
-ignore = [
+lint.ignore = [
"D1", # D1: Missing docstring error codes (because not every function and class has a docstring)
"D203", # D203: 1 blank line required before class docstring (conflicts with D211 and should be disabled, see https://github.com/PyCQA/pydocstyle/pull/91)
"D212", # D212: Multi-line docstring summary should start at the first line
"D301", # D301: Use r”“” if any backslashes in a docstring (unclear how else to handle backslashes in docstrings)
]
-line-length = 120
-select = [
+lint.select = [
"D", # pydocstyle
"E", # pycodestyle
"F", # flake8
"I", # isort
"UP", # pyupgrade
]
-src = ["src"]
-target-version = "py38"
-unfixable = [
+lint.unfixable = [
"F8", # names in flake8, such as defined but unused variables
]
+src = ["src"]
+target-version = "py38"
-[tool.ruff.isort]
+[tool.ruff.lint.isort]
known-first-party = ["bootstrap3", "app"]
known-third-party = ["django"]
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 7c44a400..1ae6abea 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -1,5 +1,6 @@
-r requirements-test.txt
-r docs/requirements.txt
twine==5.0.0
+build==1.2.1
setuptools==69.5.1
setuptools_scm==8.0.4
diff --git a/src/bootstrap3/__about__.py b/src/bootstrap3/__about__.py
index b3a30601..3cba128a 100644
--- a/src/bootstrap3/__about__.py
+++ b/src/bootstrap3/__about__.py
@@ -1,3 +1,3 @@
import importlib.metadata
-__version__ = importlib.metadata.version('django-bootstrap3')
+__version__ = importlib.metadata.version("django-bootstrap3")
diff --git a/src/bootstrap3/forms.py b/src/bootstrap3/forms.py
index 8050d2fd..6f336f84 100644
--- a/src/bootstrap3/forms.py
+++ b/src/bootstrap3/forms.py
@@ -13,7 +13,12 @@
from django.forms.widgets import CheckboxInput
from django.utils.safestring import mark_safe
-from .bootstrap import get_bootstrap_setting, get_field_renderer, get_form_renderer, get_formset_renderer
+from .bootstrap import (
+ get_bootstrap_setting,
+ get_field_renderer,
+ get_form_renderer,
+ get_formset_renderer,
+)
from .components import render_icon
from .exceptions import BootstrapError
from .text import text_concat, text_value
@@ -21,7 +26,13 @@
FORM_GROUP_CLASS = "form-group"
-WIDGETS_NO_REQUIRED = (AdminFileWidget, HiddenInput, FileInput, CheckboxInput, CheckboxSelectMultiple)
+WIDGETS_NO_REQUIRED = (
+ AdminFileWidget,
+ HiddenInput,
+ FileInput,
+ CheckboxInput,
+ CheckboxSelectMultiple,
+)
def render_formset(formset, **kwargs):
@@ -96,9 +107,8 @@ def render_button(
if button_type:
if button_type not in ("submit", "reset", "button", "link"):
raise BootstrapError(
- 'Parameter "button_type" should be "submit", "reset", "button", "link" or empty ("{}" given).'.format(
- button_type
- )
+ 'Parameter "button_type" should be "submit", "reset", "button", "link" or empty '
+ + f'("{button_type}" given).'
)
attrs["type"] = button_type
classes = add_css_class(classes, extra_classes)
@@ -117,7 +127,11 @@ def render_button(
attrs["value"] = value
if title:
attrs["title"] = title
- return render_tag(tag, attrs=attrs, content=mark_safe(text_concat(icon_content, content, separator=" ")))
+ return render_tag(
+ tag,
+ attrs=attrs,
+ content=mark_safe(text_concat(icon_content, content, separator=" ")),
+ )
def render_field_and_label(field, label, field_class="", label_for=None, label_class="", layout="", **kwargs):
diff --git a/tests/app/forms.py b/tests/app/forms.py
index 3ab53627..c0eeb3b8 100644
--- a/tests/app/forms.py
+++ b/tests/app/forms.py
@@ -47,7 +47,7 @@ class TestForm(forms.Form):
message = forms.CharField(required=False, help_text="my_help_text")
sender = forms.EmailField(label="Sender © unicode", help_text='E.g., "me@example.com"')
secret = forms.CharField(initial=42, widget=forms.HiddenInput)
- weird = forms.CharField(help_text="strings are now utf-8 \u03BCnico\u0394é!")
+ weird = forms.CharField(help_text="strings are now utf-8 \u03bcnico\u0394é!")
cc_myself = forms.BooleanField(
required=False, help_text='cc stands for "carbon copy." You will get a copy in your mailbox.'
)