Skip to content

Commit 9951f8e

Browse files
committed
Merge remote-tracking branch 'origin/main' into django-41-reverse-fk
* origin/main: (210 commits) Fix `baker.prepare()` with `GenericForeignKey` to work without database access (#501) Ref #61 -- Introduce generators for each integer field (#528) Add type hints to `seq()`'s `increment_by` argument (#560) Update seq import from model_bakery.recipe to model_bakery.utils in basic usage docs (#559) Remove mentions of the old project (#558) Bump 1.21.0 Only select valid choices from model field choices (#556) Improve numeric generators and drop internal `gen_integer` usage (#557) Fix link to Django supported versions document Drop Python 3.9 support (reached end of file) (#548) Bump actions/checkout from 5 to 6 (#549) Bump actions/upload-artifact from 5 to 6 (#553) Bump actions/download-artifact from 6 to 7 (#554) Standardize licenses to Apache License 2.0 (#552) Configure generic foreign key relations respecting Django internals (#544) Bump actions/upload-artifact from 4 to 5 (#546) Bump actions/download-artifact from 5 to 6 (#545) Add Django 6.0 support (#540) Add Python 3.14 support (#539) Modernize superseded typing features ...
2 parents 1bff034 + 9a9a0a6 commit 9951f8e

Some content is hidden

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

59 files changed

+3168
-2744
lines changed

.github/FUNDING.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github: amureki
2+
tidelift: pypi/model-bakery

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ A clear and concise description of what the change is.
33

44
**PR Checklist**
55
- [ ] Change is covered with tests
6-
- [ ] [CHANGELOG.md](CHANGELOG.md) is updated
6+
- [ ] [CHANGELOG.md](CHANGELOG.md) is updated if needed

.github/dependabot.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
version: 2
22
updates:
3-
- package-ecosystem: "pip"
4-
directory: "/"
5-
schedule:
6-
interval: "monthly"
7-
rebase-strategy: "auto"
3+
- package-ecosystem: "pip"
4+
directory: "/"
5+
schedule:
6+
interval: "monthly"
7+
rebase-strategy: "auto"
88

9-
- package-ecosystem: "github-actions"
10-
directory: "/"
11-
schedule:
12-
interval: "weekly"
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
11+
schedule:
12+
interval: "weekly"

.github/workflows/changelog.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
concurrency:
10+
group: ${{ github.head_ref || github.run_id }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
linters:
15+
runs-on: ubuntu-22.04
16+
strategy:
17+
matrix:
18+
lint-command:
19+
- ruff check --output-format=github .
20+
- black --check --diff .
21+
- mypy model_bakery
22+
steps:
23+
- uses: actions/checkout@v6
24+
- uses: actions/setup-python@v6
25+
with:
26+
python-version: "3.13"
27+
cache: pip
28+
- run: python -m pip install .[test]
29+
- run: ${{ matrix.lint-command }}
30+
31+
sqlite-tests:
32+
name: SQLite - Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }}
33+
runs-on: ubuntu-22.04
34+
strategy:
35+
fail-fast: false
36+
matrix:
37+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
38+
django-version: ["4.2", "5.0", "5.1", "5.2", "6.0"]
39+
exclude:
40+
# Django 6.0 supports Python 3.12+
41+
- python-version: "3.10"
42+
django-version: "6.0"
43+
- python-version: "3.11"
44+
django-version: "6.0"
45+
46+
steps:
47+
- uses: actions/checkout@v6
48+
- name: Set TOX_ENV
49+
run: echo "TOX_ENV=py$(echo ${{ matrix.python-version }} | tr -d .)-django$(echo ${{ matrix.django-version }} | tr -d .)-sqlite" >> $GITHUB_ENV
50+
51+
- name: Set up Python ${{ matrix.python-version }}
52+
uses: actions/setup-python@v6
53+
with:
54+
python-version: ${{ matrix.python-version }}
55+
allow-prereleases: true
56+
cache: pip
57+
58+
- name: Install dependencies
59+
run: |
60+
python -m pip install --upgrade pip setuptools wheel tox
61+
62+
- name: Run tox targets for ${{ matrix.python-version }}
63+
run: tox run -e ${{ env.TOX_ENV }}
64+
65+
- name: Upload coverage data
66+
uses: actions/upload-artifact@v6
67+
with:
68+
name: coverage-data-${{ env.TOX_ENV }}
69+
include-hidden-files: true
70+
path: '.coverage.*'
71+
if-no-files-found: ignore
72+
73+
postgresql-tests:
74+
name: PostgreSQL - Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }}, ${{ matrix.variant }}
75+
runs-on: ubuntu-22.04
76+
strategy:
77+
fail-fast: false
78+
matrix:
79+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
80+
django-version: ["4.2", "5.0", "5.1", "5.2", "6.0"]
81+
variant: ["postgresql", "postgresql-psycopg3"]
82+
exclude:
83+
# Django 6.0 supports Python 3.12+
84+
- python-version: "3.10"
85+
django-version: "6.0"
86+
- python-version: "3.11"
87+
django-version: "6.0"
88+
include:
89+
# Latest Python/Django with contenttypes disabled
90+
- python-version: "3.14"
91+
django-version: "6.0"
92+
variant: "postgresql-no-contenttypes"
93+
94+
env:
95+
PGUSER: postgres
96+
PGPASSWORD: postgres
97+
98+
services:
99+
postgis:
100+
image: postgis/postgis
101+
env:
102+
POSTGRES_DB: postgres
103+
POSTGRES_PASSWORD: postgres
104+
POSTGRES_USER: postgres
105+
ports:
106+
- 5432:5432
107+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
108+
109+
steps:
110+
- uses: actions/checkout@v6
111+
- name: Set TOX_ENV
112+
run: echo "TOX_ENV=py$(echo ${{ matrix.python-version }} | tr -d .)-django$(echo ${{ matrix.django-version }} | tr -d .)-${{ matrix.variant }}" >> $GITHUB_ENV
113+
114+
- name: Set up PostgreSQL
115+
run: |
116+
sudo apt-get update
117+
sudo apt-get install -y gdal-bin
118+
psql template1 -c "CREATE EXTENSION citext;" -U postgres -h localhost -p 5432
119+
psql template1 -c "CREATE EXTENSION hstore;" -U postgres -h localhost -p 5432
120+
psql template1 -c "CREATE EXTENSION postgis;" -U postgres -h localhost -p 5432
121+
122+
- name: Set up Python ${{ matrix.python-version }}
123+
uses: actions/setup-python@v6
124+
with:
125+
python-version: ${{ matrix.python-version }}
126+
allow-prereleases: true
127+
cache: pip
128+
129+
- name: Install dependencies
130+
run: |
131+
python -m pip install --upgrade pip setuptools wheel tox
132+
133+
- name: Run tox targets for ${{ matrix.python-version }}
134+
run: tox run -e ${{ env.TOX_ENV }}
135+
136+
- name: Upload coverage data
137+
uses: actions/upload-artifact@v6
138+
with:
139+
name: coverage-data-${{ env.TOX_ENV }}
140+
include-hidden-files: true
141+
path: '.coverage.*'
142+
if-no-files-found: ignore
143+
144+
coverage:
145+
name: Coverage
146+
runs-on: ubuntu-22.04
147+
needs: [sqlite-tests, postgresql-tests]
148+
steps:
149+
- uses: actions/checkout@v6
150+
151+
- uses: actions/setup-python@v6
152+
with:
153+
python-version: '3.12'
154+
155+
- name: Install dependencies
156+
run: python -m pip install --upgrade coverage[toml]
157+
158+
- name: Download data
159+
uses: actions/download-artifact@v7
160+
with:
161+
pattern: coverage-data-*
162+
merge-multiple: true
163+
164+
- name: Combine coverage and fail if it's <95%
165+
run: |
166+
python -m coverage combine
167+
python -m coverage html --skip-covered --skip-empty
168+
python -m coverage report --fail-under=95
169+
170+
- name: Upload HTML report
171+
if: ${{ failure() }}
172+
uses: actions/upload-artifact@v6
173+
with:
174+
name: html-report
175+
path: htmlcov

.github/workflows/linter.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
11
name: PyPI release
22

3-
on: [release]
3+
on:
4+
release:
5+
types: [ published ]
46

57
jobs:
68
package:
79
name: Build & verify package
8-
runs-on: ubuntu-latest
10+
runs-on: ubuntu-22.04
911

1012
steps:
11-
- uses: actions/checkout@v3
12-
- uses: actions/setup-python@v4
13+
- uses: actions/checkout@v6
14+
- uses: actions/setup-python@v6
1315
with:
14-
python-version: "3.10"
16+
python-version: "3.13"
1517
cache: pip
1618

17-
- name: Install Python dependencies
18-
run: python -m pip install --upgrade pip setuptools wheel twine
19-
- name: Build dist packages
20-
run: python setup.py sdist bdist_wheel
21-
- name: Upload packages
22-
run: python -m twine upload dist/*
23-
env:
24-
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
25-
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
19+
- name: Build package
20+
run: |
21+
python -m pip install -U build twine wheel
22+
python -m build
23+
twine check --strict dist/*
24+
25+
- name: Publish package
26+
uses: pypa/gh-action-pypi-publish@release/v1
27+
with:
28+
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/tests.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ build/
1414
lib64
1515
pyvenv.cfg
1616
dist/
17+
/.coverage
18+
/.coverage.*
19+
.envrc

.pre-commit-config.yaml

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,21 @@
11
repos:
2-
- repo: git@github.com:pre-commit/pre-commit-hooks
3-
rev: v3.2.0
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.6.0
44
hooks:
55
- id: check-added-large-files
66
- id: debug-statements
77
- id: end-of-file-fixer
88
- id: requirements-txt-fixer
99
- id: trailing-whitespace
10+
- id: check-merge-conflict
11+
- id: check-yaml
1012
- repo: local
1113
hooks:
12-
- id: flake8
13-
name: flake8
14-
entry: flake8
15-
language: system
16-
types:
17-
- python
18-
- id: isort
19-
name: isort
20-
entry: isort
21-
language: system
22-
types:
23-
- python
24-
- id: pydocstyle
25-
name: pydocstyle
26-
entry: pydocstyle
14+
- id: ruff
15+
name: ruff
16+
entry: ruff check
2717
language: system
18+
args: [ --fix, --exit-non-zero-on-fix ]
2819
types:
2920
- python
3021
- id: black

0 commit comments

Comments
 (0)