Skip to content

Commit 5b5fd0f

Browse files
authored
Merge pull request #255 from saxix/uv
uses uv/ruff and full PEP621
2 parents b915a3c + f3f68fb commit 5b5fd0f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1744
-450
lines changed

.github/file-filters.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# This is used by the action https://github.com/dorny/paths-filter
2+
docker: &docker
3+
- added|modified: './docker/**/*'
4+
- added|modified: './docker/*'
5+
6+
dependencies: &dependencies
7+
- 'pdm.lock'
8+
- 'pyproject.toml'
9+
10+
actions: &actions
11+
- added|modified: './.github/**/*'
12+
13+
python: &python
14+
- added|modified: 'src/**'
15+
- added|modified: 'tests/**'
16+
- 'manage.py'
17+
18+
changelog:
19+
- added|modified: 'changes/**'
20+
- 'CHANGELOG.md'
21+
22+
mypy:
23+
- *python
24+
- 'mypy.ini'
25+
26+
run_tests:
27+
- *actions
28+
- *python
29+
- *docker
30+
- *dependencies
31+
- 'pytest.ini'
32+
33+
migrations:
34+
- added|modified: 'src/**/migrations/*'
35+
36+
lint:
37+
- *python
38+
- '.flake8'
39+
- 'pyproject.toml'
40+
41+
docs:
42+
- added|modified: './docs/**/*'
43+
- modified: './src/birder/config/__init__.py'
44+
- modified: './github/workflows/docs.yml'
45+
- modified: './github/file-filters.yml'

.github/workflows/tests.yaml

+23-11
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@ on:
88
pull_request:
99

1010
jobs:
11+
pkg_meta:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: actions/setup-python@v2
16+
17+
- name: Install dependencies
18+
run: |
19+
python -m pip install --upgrade pip tox
20+
- name: Lint with flake8
21+
run: |
22+
tox -e pkg_meta
1123
lint:
1224
runs-on: ubuntu-latest
1325
steps:
@@ -27,7 +39,7 @@ jobs:
2739
fail-fast: false
2840
matrix:
2941
python-version: [ "3.11", "3.12"]
30-
django-version: [ "4.2", "5.1"]
42+
django-version: [ "3.2", "4.2", "5.1"]
3143
db-engine: ["pg", "mysql"]
3244
env:
3345
PY_VER: ${{ matrix.python-version}}
@@ -47,16 +59,16 @@ jobs:
4759
- 5432:5432
4860
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
4961

50-
# mysql:
51-
# image: mysql:5.7
52-
# env:
53-
# MYSQL_DATABASE: test_db
54-
# MYSQL_USER: user
55-
# MYSQL_PASSWORD: password
56-
# MYSQL_ROOT_PASSWORD: rootpassword
57-
# ports:
58-
# - 33306:3306
59-
# options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
62+
mysql:
63+
image: mysql:5.7
64+
env:
65+
MYSQL_DATABASE: test_db
66+
MYSQL_USER: user
67+
MYSQL_PASSWORD: password
68+
MYSQL_ROOT_PASSWORD: rootpassword
69+
ports:
70+
- 33306:3306
71+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
6072

6173
steps:
6274
- uses: actions/checkout@v2

.gitignore

+1-4
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,5 @@ __pycache__
1919
*.mo
2020
*.sqlite
2121
.testmondata
22-
Pipfile.lock
23-
poetry.lock
24-
!pyproject.toml
2522
.venv/
26-
pdm.lock
23+
src/concurrency/version.py

.pre-commit-config.yaml

+34-36
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,35 @@
1-
exclude: '^$'
2-
fail_fast: false
31
repos:
4-
- repo: local
5-
hooks:
6-
- id: isort
7-
args:
8-
- -rc
9-
- src/
10-
- tests/
11-
name: isort
12-
entry: isort
13-
language: system
14-
types: [python]
15-
16-
17-
- repo: https://github.com/pre-commit/pre-commit-hooks
18-
rev: v1.4.0
19-
hooks:
20-
- id: debug-statements
21-
exclude: manage.py
22-
- id: end-of-file-fixer
23-
- id: flake8
24-
exclude: docs/
25-
args:
26-
- src/
27-
- tests/
28-
- id: check-merge-conflict
29-
- id: check-case-conflict
30-
# - id: name-tests-test
31-
# - id: trailing-whitespace
32-
# - id: requirements-txt-fixer
33-
# files: requirements-dev.txt
34-
#- repo: git://github.com/asottile/reorder_python_imports
35-
# rev: v1.0.1
36-
# hooks:
37-
# - id: reorder-python-imports
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: end-of-file-fixer
6+
- id: trailing-whitespace
7+
- repo: https://github.com/python-jsonschema/check-jsonschema
8+
rev: 0.31.0
9+
hooks:
10+
- id: check-github-workflows
11+
args: [ "--verbose" ]
12+
- repo: https://github.com/tox-dev/tox-ini-fmt
13+
rev: "1.5.0"
14+
hooks:
15+
- id: tox-ini-fmt
16+
args: [ "-p", "lint" ]
17+
- repo: https://github.com/tox-dev/pyproject-fmt
18+
rev: "v2.5.0"
19+
hooks:
20+
- id: pyproject-fmt
21+
- repo: https://github.com/astral-sh/ruff-pre-commit
22+
rev: "v0.9.4"
23+
hooks:
24+
- id: ruff-format
25+
- id: ruff
26+
args: [ "--fix", "--unsafe-fixes", "--exit-non-zero-on-fix" ]
27+
- repo: https://github.com/adamchainz/djade-pre-commit
28+
rev: "1.3.2"
29+
hooks:
30+
- id: djade
31+
args: [ --target-version, "5.1" ] # Replace with Django version
32+
- repo: meta
33+
hooks:
34+
- id: check-hooks-apply
35+
- id: check-useless-excludes

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ travis:
3434

3535

3636
clean:
37-
rm -fr ${BUILDDIR} dist *.egg-info .coverage coverage.xml .eggs
37+
rm -fr ${BUILDDIR} dist *.egg-info .coverage coverage.xml .eggs build
3838
find src -name __pycache__ -o -name "*.py?" -o -name "*.orig" -prune | xargs rm -rf
3939
find tests -name __pycache__ -o -name "*.py?" -o -name "*.orig" -prune | xargs rm -rf
4040
find src/concurrency/locale -name django.mo | xargs rm -f

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Django Concurrency
66
[![coverage](https://codecov.io/github/saxix/django-concurrency/coverage.svg?branch=develop)](https://codecov.io/github/saxix/django-concurrency?branch=develop)
77
[![Test](https://github.com/saxix/django-concurrency/actions/workflows/tests.yaml/badge.svg)](https://github.com/saxix/django-concurrency/actions/workflows/tests.yaml)
88
[![Docs](https://readthedocs.org/projects/django-concurrency/badge/?version=stable)](http://django-concurrency.readthedocs.io/en/stable/)
9+
[![Django](https://img.shields.io/pypi/frameworkversions/django/django-concurrency)](https://pypi.org/project/django-concurrency/)
10+
[![Supported Python versions](https://img.shields.io/pypi/pyversions/django-concurrency.svg)](https://pypi.org/project/django-concurrency/)
911

1012

1113
django-concurrency is an [optimistic lock][1] implementation for Django.
@@ -48,8 +50,8 @@ you will get a ``RecordModifiedError`` on ``b.save()``
4850
Similar projects
4951
----------------
5052

51-
Other projects that handle concurrent editing are [django-optimistic-lock][10]
52-
and [django-locking][11] anyway concurrency is "a batteries included" optimistic
53+
Other projects that handle concurrent editing are [django-optimistic-lock][10]
54+
and [django-locking][11] anyway concurrency is "a batteries included" optimistic
5355
lock management system, here some features not available elsewhere:
5456

5557
* can be applied to any model; not only your code (ie. django.contrib.auth.Group)

compose.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
services:
2+
3+
postgres:
4+
image: postgis/postgis:14-3.4-alpine
5+
platform: linux/amd64
6+
ports:
7+
- "5432:5432"
8+
shm_size: '1gb'
9+
environment:
10+
POSTGRES_PASSWORD: password
11+
POSTGRES_USER: postgres
12+
POSTGRES_HOST_AUTH_METHOD: trust
13+
14+
mysql:
15+
image: mysql
16+
stdin_open: true
17+
tty: true
18+
ports:
19+
- "3306:3306"
20+
environment:
21+
MYSQL_ROOT_PASSWORD: root
22+
MYSQL_DATABASE: concurrency
23+
MYSQL_ALLOW_EMPTY_PASSWORD: true

docs/_ext/version.py

+5-10
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
import re
22

3-
from docutils.parsers.rst import Directive, directives
4-
from sphinx import addnodes, roles
5-
from sphinx.errors import ExtensionError
6-
from sphinx.util.console import bold
3+
74
# RE for option descriptions without a '--' prefix
8-
from sphinx.writers.html import HTMLTranslator
95

10-
simple_option_desc_re = re.compile(
11-
r'([-_a-zA-Z0-9]+)(\s*.*?)(?=,\s+(?:/|-|--)|$)')
6+
simple_option_desc_re = re.compile(r"([-_a-zA-Z0-9]+)(\s*.*?)(?=,\s+(?:/|-|--)|$)")
127

138

149
def setup(app):
@@ -20,19 +15,19 @@ def setup(app):
2015
app.add_crossref_type(
2116
directivename="templatetag",
2217
rolename="ttag",
23-
indextemplate="pair: %s; template tag"
18+
indextemplate="pair: %s; template tag",
2419
)
2520
app.add_crossref_type(
2621
directivename="templatefilter",
2722
rolename="tfilter",
28-
indextemplate="pair: %s; template filter"
23+
indextemplate="pair: %s; template filter",
2924
)
3025
app.add_crossref_type(
3126
directivename="fieldlookup",
3227
rolename="lookup",
3328
indextemplate="pair: %s; field lookup type",
3429
)
35-
app.add_config_value('next_version', '0.0', True)
30+
app.add_config_value("next_version", "0.0", True)
3631
app.add_crossref_type(
3732
directivename="release",
3833
rolename="release",

0 commit comments

Comments
 (0)