Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update hooks, add Django 5.0 and 5.1 to the CI #90

Merged
merged 3 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 19 additions & 18 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Tests
on:
push:
branches:
- main
- main
pull_request:

jobs:
Expand All @@ -14,22 +14,23 @@ jobs:
fail-fast: false
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip tox
- name: Run tox targets for ${{ matrix.python-version }}
run: |
ENV_PREFIX=$(tr -C -d "0-9" <<< "${{ matrix.python-version }}")
TOXENV=$(tox --listenvs | grep "^py$ENV_PREFIX" | tr '\n' ',') python -m tox
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip tox
- name: Run tox targets for ${{ matrix.python-version }}
run: |
ENV_PREFIX=$(tr -C -d "0-9" <<< "${{ matrix.python-version }}")
TOXENV=$(tox --listenvs | grep "^py$ENV_PREFIX" | tr '\n' ',') python -m tox
29 changes: 10 additions & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
exclude: ".yarn/|yarn.lock|\\.min\\.(css|js)$"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-builtin-literals
Expand All @@ -14,35 +14,26 @@ repos:
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/adamchainz/django-upgrade
rev: 1.16.0
rev: 1.21.0
hooks:
- id: django-upgrade
args: [--target-version, "3.2"]
- repo: https://github.com/MarcoGorelli/absolufy-imports
rev: v0.3.1
- repo: https://github.com/adamchainz/djade-pre-commit
rev: "1.0.0"
hooks:
- id: absolufy-imports
- id: djade
args: [--target-version, "3.2"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.3.2"
rev: "v0.6.7"
hooks:
- id: ruff
args: [--unsafe-fixes]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier
args: [--list-different, --no-semi]
exclude: "^conf/|.*\\.html$"
- repo: https://github.com/biomejs/pre-commit
rev: "v0.1.0"
hooks:
- id: biome-check
additional_dependencies: ["@biomejs/biome@1.7.3"]
- repo: https://github.com/tox-dev/pyproject-fmt
rev: 1.7.0
rev: 2.2.4
hooks:
- id: pyproject-fmt
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.16
rev: v0.19
hooks:
- id: validate-pyproject
10 changes: 5 additions & 5 deletions examples/custom/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]

ROOT_URLCONF = "%s.urls" % EXAMPLE
ROOT_URLCONF = f"{EXAMPLE}.urls"


TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": ["%s/templates" % EXAMPLE],
"DIRS": [f"{EXAMPLE}/templates"],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
Expand All @@ -78,7 +78,7 @@
}
]

WSGI_APPLICATION = "%s.wsgi.application" % EXAMPLE
WSGI_APPLICATION = f"{EXAMPLE}.wsgi.application"


# Database
Expand All @@ -87,7 +87,7 @@
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": os.path.join(BASE_DIR, "%s.sqlite3" % EXAMPLE),
"NAME": os.path.join(BASE_DIR, f"{EXAMPLE}.sqlite3"),
}
}

Expand Down Expand Up @@ -139,7 +139,7 @@

PLATA_REPORTING_ADDRESSLINE = "Example Corp. - 3. Example Street - 1234 Example"

PLATA_SHOP_PRODUCT = "%s.Product" % EXAMPLE
PLATA_SHOP_PRODUCT = f"{EXAMPLE}.Product"
CURRENCIES = ("EUR", "CHF", "USD")

TEST_RUNNER = "options.test_utils.test_runner_with_coverage"
Expand Down
12 changes: 6 additions & 6 deletions examples/custom/templates/plata/shop_checkout.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

{% load i18n plata_tags %}

{% block title %}{% trans "Checkout" %} - {{ block.super }}{% endblock %}
{% block title %}{% translate "Checkout" %} - {{ block.super }}{% endblock %}

{% block content %}
<h1>{% trans "Checkout" %}</h1>
<h1>{% translate "Checkout" %}</h1>

{% if loginform %}
<form method="post" action=".">{% csrf_token %}
Expand All @@ -16,7 +16,7 @@ <h1>{% trans "Checkout" %}</h1>
{{ loginform }}
<tr>
<td></td>
<td><button type="submit">{% trans "Submit" %}</button></td>
<td><button type="submit">{% translate "Submit" %}</button></td>
</tr>
</table>
</form>
Expand All @@ -30,7 +30,7 @@ <h1>{% trans "Checkout" %}</h1>

<table>
<tr><td colspan="2">
<h2>{% trans "Address" %}</h2>
<h2>{% translate "Address" %}</h2>
</td></tr>

{% if orderform.create_account %}
Expand All @@ -48,8 +48,8 @@ <h2>{% trans "Address" %}</h2>

<tr>
<td></td>
<td><button type="submit">{% trans "Submit" %}</button></td>
<td><button type="submit">{% translate "Submit" %}</button></td>
</tr>
</table>
</form>
{% endblock %}
{% endblock content %}
4 changes: 2 additions & 2 deletions examples/custom/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class CheckoutForm(shop_forms.BaseCheckoutForm):
class Meta:
fields = ["email"] + ["billing_%s" % f for f in Contact.ADDRESS_FIELDS]
fields = ["email"] + [f"billing_{f}" for f in Contact.ADDRESS_FIELDS]
model = Order

def __init__(self, *args, **kwargs):
Expand All @@ -25,7 +25,7 @@ def __init__(self, *args, **kwargs):
if contact:
initial = {}
for f in contact.ADDRESS_FIELDS:
initial["billing_%s" % f] = getattr(contact, f)
initial[f"billing_{f}"] = getattr(contact, f)
kwargs["initial"] = initial
initial["email"] = contact.user.email

Expand Down
10 changes: 5 additions & 5 deletions examples/generic/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]

ROOT_URLCONF = "%s.urls" % EXAMPLE
ROOT_URLCONF = f"{EXAMPLE}.urls"

TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": ["%s/templates" % EXAMPLE],
"DIRS": [f"{EXAMPLE}/templates"],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
Expand All @@ -78,7 +78,7 @@
}
]

WSGI_APPLICATION = "%s.wsgi.application" % EXAMPLE
WSGI_APPLICATION = f"{EXAMPLE}.wsgi.application"


# Database
Expand All @@ -87,7 +87,7 @@
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": os.path.join(BASE_DIR, "%s.sqlite3" % EXAMPLE),
"NAME": os.path.join(BASE_DIR, f"{EXAMPLE}.sqlite3"),
}
}

Expand Down Expand Up @@ -139,7 +139,7 @@

PLATA_REPORTING_ADDRESSLINE = "Example Inc. - 3. Example Street - 1234 Example"

PLATA_SHOP_PRODUCT = "%s.Product" % EXAMPLE
PLATA_SHOP_PRODUCT = f"{EXAMPLE}.Product"
CURRENCIES = ("EUR", "CHF", "USD")

TEST_RUNNER = "options.test_utils.test_runner_with_coverage"
Expand Down
10 changes: 5 additions & 5 deletions examples/generic/templates/product/product_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

{% load i18n %}

{% block title %}{{ object }} - {% trans "Products" %} - {{ block.super }}{% endblock %}
{% block title %}{{ object }} - {% translate "Products" %} - {{ block.super }}{% endblock %}

{% block content %}
<div class="h-product">
<h1 class="p-name">{{ object }}</h1>

<div class="e-description">{{ object.description|linebreaks }}<br />
{% if object.content_object.weight %}{% trans "Weight:" %} {{ object.content_object.weight }} kg{% endif %}
{% if object.content_type.name == "download" %}({% trans "Download" %}){% endif %}
{% if object.content_object.weight %}{% translate "Weight:" %} {{ object.content_object.weight }} kg{% endif %}
{% if object.content_type.name == "download" %}({% translate "Download" %}){% endif %}
</div>
<div class="p-category" style="display:none;">{{ object.content_type }}</div>

Expand All @@ -25,7 +25,7 @@ <h1 class="p-name">{{ object }}</h1>
<table>
{{ form }}
</table>
<input type="submit" value="{% trans "Add to cart" %}" />
<input type="submit" value="{% translate "Add to cart" %}" />
</form>
</div>
{% endblock %}
{% endblock content %}
6 changes: 3 additions & 3 deletions examples/generic/templates/product/product_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

{% load i18n %}

{% block title %}{% trans "Products" %} - {{ block.super }}{% endblock %}
{% block title %}{% translate "Products" %} - {{ block.super }}{% endblock %}

{% block content %}
<h1>{% trans "Products" %}</h1>
<h1>{% translate "Products" %}</h1>

{% for product in object_list %}
<div class="h-product">
Expand All @@ -16,4 +16,4 @@ <h2><a href="{{ product.get_absolute_url }}">{{ product }}</a></h2>
{% endfor %}

{% include "_pagination.html" %}
{% endblock %}
{% endblock content %}
8 changes: 4 additions & 4 deletions examples/oneprice/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]

ROOT_URLCONF = "%s.urls" % EXAMPLE
ROOT_URLCONF = f"{EXAMPLE}.urls"

TEMPLATES = [
{
Expand All @@ -77,7 +77,7 @@
}
]

WSGI_APPLICATION = "%s.wsgi.application" % EXAMPLE
WSGI_APPLICATION = f"{EXAMPLE}.wsgi.application"


# Database
Expand All @@ -86,7 +86,7 @@
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": os.path.join(BASE_DIR, "%s.sqlite3" % EXAMPLE),
"NAME": os.path.join(BASE_DIR, f"{EXAMPLE}.sqlite3"),
}
}

Expand Down Expand Up @@ -138,7 +138,7 @@

PLATA_REPORTING_ADDRESSLINE = "Example Corp. - 3. Example Street - 1234 Example"

PLATA_SHOP_PRODUCT = "%s.Product" % EXAMPLE
PLATA_SHOP_PRODUCT = f"{EXAMPLE}.Product"
CURRENCIES = ("EUR", "CHF", "USD")

TEST_RUNNER = "options.test_utils.test_runner_with_coverage"
Expand Down
8 changes: 4 additions & 4 deletions examples/simple/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]

ROOT_URLCONF = "%s.urls" % EXAMPLE
ROOT_URLCONF = f"{EXAMPLE}.urls"

TEMPLATES = [
{
Expand All @@ -77,7 +77,7 @@
}
]

WSGI_APPLICATION = "%s.wsgi.application" % EXAMPLE
WSGI_APPLICATION = f"{EXAMPLE}.wsgi.application"


# Database
Expand All @@ -86,7 +86,7 @@
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": os.path.join(BASE_DIR, "%s.sqlite3" % EXAMPLE),
"NAME": os.path.join(BASE_DIR, f"{EXAMPLE}.sqlite3"),
}
}

Expand Down Expand Up @@ -138,7 +138,7 @@

PLATA_REPORTING_ADDRESSLINE = "Example Corp. - 3. Example Street - 1234 Example"

PLATA_SHOP_PRODUCT = "%s.Product" % EXAMPLE
PLATA_SHOP_PRODUCT = f"{EXAMPLE}.Product"
CURRENCIES = ("EUR", "CHF", "USD")

TEST_RUNNER = "options.test_utils.test_runner_with_coverage"
Expand Down
Loading
Loading