Skip to content
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
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
branch = true
parallel = true
include =
findreplace/*
findreplace/**
32 changes: 32 additions & 0 deletions .github/matrix.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import fileinput
import json
import re
import sys

PY_VERSIONS_RE = re.compile(r"^py(\d)(\d+)")


def main():
actions_matrix = []

for tox_env in fileinput.input():
tox_env = tox_env.rstrip()

if python_match := PY_VERSIONS_RE.match(tox_env):
version_tuple = python_match.groups()
else:
version_tuple = sys.version_info[0:2]

python_version = "{}.{}".format(*version_tuple)
actions_matrix.append(
{
"python": python_version,
"tox_env": tox_env,
}
)

print(json.dumps(actions_matrix)) # noqa:T201


if __name__ == "__main__":
main()
80 changes: 25 additions & 55 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,83 +1,53 @@
name: CI
on: pull_request
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
check:
name: Check
runs-on: ubuntu-20.04
matrix:
name: Build test matrix
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Python pip cache
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/testing.txt') }}
- name: Run check
run: |
pip install $(grep "^tox==" requirements/local.txt)
tox -e check

lint:
name: Lint
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Python pip cache
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/testing.txt') }}
- name: Run lint
python-version: '3.13'
cache: 'pip'
cache-dependency-path: 'requirements/*.txt'
- name: Run tox
id: matrix
run: |
pip install $(grep "^tox==" requirements/local.txt)
tox -e lint
pip install $(grep -E "^(tox|tox-uv)==" requirements/local.txt)
echo "tox_matrix=$(tox -l | fgrep -v coverage | python .github/matrix.py)" >> $GITHUB_OUTPUT
outputs:
tox_matrix: ${{ steps.matrix.outputs.tox_matrix }}

test:
name: Test -- Python ${{ matrix.python }} - Django ${{ matrix.django }}
runs-on: ubuntu-20.04
name: Test -- ${{ matrix.tox_env }}
runs-on: ubuntu-24.04
needs: matrix
strategy:
matrix:
python:
- '3.6'
- '3.7'
- '3.8'
django:
- '1.11'
- '2.2'
exclude:
- python: '3.8'
django: '1.11'
include: ${{ fromJson(needs.matrix.outputs.tox_matrix) }}
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Python pip cache
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python${{ matrix.python }}-django${{ matrix.django }}-pip-${{ hashFiles('requirements/testing.txt') }}
cache: 'pip'
cache-dependency-path: 'requirements/*.txt'
- name: Run tests
env:
PYTHON_VERSION: ${{ matrix.python }}
run: |
pip install $(grep "^tox==" requirements/local.txt)
tox -e py${PYTHON_VERSION//./}-django${{ matrix.django }}
pip install $(grep -E "^(tox|tox-uv)==" requirements/local.txt)
tox -e ${{ matrix.tox_env }}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2018-2020, Developer Society Limited
Copyright (c) 2018-2024, Developer Society Limited
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
9 changes: 5 additions & 4 deletions requirements/local.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
-r testing.txt

bump2version==1.0.0
Django>=2.2,<3.0
tox==3.20.0
twine==3.2.0
bump2version==1.0.1
Django>=4.2,<5.0
tox==4.21.2
tox-uv==1.16.2
twine==6.0.1
10 changes: 5 additions & 5 deletions requirements/testing.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
black==22.3.0 ; python_version >= '3.6'
coverage==5.3
flake8==3.8.4
isort==4.3.21
pipdeptree==2.2.0
black==24.10.0
coverage==7.6.9
flake8==7.1.1
isort==5.13.2
pipdeptree==2.24.0
15 changes: 8 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,21 @@ def read(filename):
platforms=["any"],
packages=find_packages(exclude=["tests"]),
include_package_data=True,
python_requires=">=3.6",
install_requires=["Django>=1.11"],
python_requires=">=3.9",
install_requires=["Django>=3.2"],
classifiers=[
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"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",
"Framework :: Django",
"Framework :: Django :: 1.11",
"Framework :: Django :: 2.2",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.2",
],
license="BSD",
)
1 change: 1 addition & 0 deletions tests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


class Author(models.Model):
id = models.BigAutoField(primary_key=True)
name = models.CharField(max_length=100)
slug = models.SlugField(max_length=100)
url = models.URLField("URL")
Expand Down
2 changes: 2 additions & 0 deletions tests/settings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:"}}

USE_TZ = True

SECRET_KEY = "findreplace"

INSTALLED_APPS = ["findreplace", "tests"]
23 changes: 10 additions & 13 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,30 @@
envlist =
check
lint
{py36,py37}-django1.11
{py36,py37,py38}-django2.2
py{39,310}-django3.2
py{39,310,311,312}-django4.2
coverage
skipsdist = true
no_package = true

[testenv]
deps =
-rrequirements/testing.txt
django1.11: Django>=1.11,<2.0
django2.2: Django>=2.2,<3.0
whitelist_externals = make
django3.2: Django>=3.2,<4.0
django4.2: Django>=4.2,<5.0
allowlist_externals = make
commands = make test
usedevelop = true
package = editable
setenv =
PYTHONWARNINGS = all

[testenv:check]
basepython = python3.8
basepython = python3.13
commands = make check
skip_install = true

[testenv:lint]
basepython = python3.8
basepython = python3.13
commands = make lint
skip_install = true

[testenv:coverage]
basepython = python3.8
basepython = python3.13
commands = make coverage-report
skip_install = true