Skip to content

Commit 4893f1c

Browse files
committed
Update packaging to pyproject.toml
1 parent 08f7bfd commit 4893f1c

17 files changed

+220
-163
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ insert_final_newline = true
1010
charset = utf-8
1111
end_of_line = lf
1212

13-
[*.{json,yml,yaml,js,jsx}]
13+
[*.{json,yml,yaml,js,jsx,toml}]
1414
indent_size = 2
1515

1616
[*.{html,htm}]

.github/workflows/ci.yml

Lines changed: 43 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,32 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
lint-command:
16-
- "bandit -r mailauth -x tests"
17-
- "black --check --diff ."
18-
- "flake8 ."
19-
- "isort --check-only --diff ."
20-
- "pydocstyle ."
16+
- bandit -r . -x ./tests
17+
- black --check --diff .
18+
- flake8 .
19+
- isort --check-only --diff .
20+
- pydocstyle .
2121
runs-on: ubuntu-latest
2222
steps:
2323
- uses: actions/checkout@v3
2424
- uses: actions/setup-python@v4
2525
with:
2626
python-version: "3.x"
27-
cache: 'pip'
28-
cache-dependency-path: 'requirements.txt'
29-
- run: python -m pip install -r requirements.txt
27+
cache: pip
28+
cache-dependency-path: linter-requirements.txt
29+
- run: python -m pip install -r linter-requirements.txt
3030
- run: ${{ matrix.lint-command }}
3131

3232
dist:
3333
runs-on: ubuntu-latest
3434
steps:
35-
- run: sudo apt install -y gettext
35+
- uses: actions/checkout@v3
3636
- uses: actions/setup-python@v4
3737
with:
3838
python-version: "3.x"
39-
- uses: actions/checkout@v3
4039
- name: Install Python dependencies
41-
run: python -m pip install --upgrade pip setuptools wheel twine readme-renderer
42-
- run: python setup.py sdist bdist_wheel
40+
run: python -m pip install --upgrade pip build wheel twine readme-renderer
41+
- run: python -m build --sdist --wheel
4342
- run: python -m twine check dist/*
4443
- uses: actions/upload-artifact@v3
4544
with:
@@ -51,16 +50,14 @@ jobs:
5150
- uses: actions/checkout@v3
5251
- uses: actions/setup-python@v4
5352
with:
54-
python-version: "3.x"
55-
cache: 'pip'
56-
cache-dependency-path: 'requirements.txt'
57-
- run: python -m pip install --upgrade pip setuptools wheel
58-
- run: python -m pip install -r requirements.txt
59-
- run: python setup.py develop
60-
- run: python setup.py build_sphinx -W
53+
python-version: "3.11"
54+
- run: sudo apt install -y python3-enchant
55+
- run: python -m pip install sphinxcontrib-spelling
56+
- run: python -m pip install -e '.[docs]'
57+
- run: python -m sphinx -W -b spelling docs docs/_build
6158

6259
SQLite:
63-
needs: [lint, dist, docs]
60+
needs: [ lint, dist, docs ]
6461
runs-on: ubuntu-latest
6562
strategy:
6663
matrix:
@@ -69,50 +66,48 @@ jobs:
6966
- "3.10"
7067
- "3.11"
7168
steps:
72-
- name: Set up Python ${{ matrix.python-version }}
73-
uses: actions/setup-python@v4
69+
- uses: actions/checkout@v3
70+
- uses: actions/setup-python@v4
7471
with:
7572
python-version: ${{ matrix.python-version }}
76-
- run: python -m pip install --upgrade pip setuptools wheel
77-
- uses: actions/checkout@v3
78-
- run: python setup.py test
79-
- name: Codecov
80-
run: |
81-
python -m pip install codecov
82-
codecov
73+
- run: python -m pip install -e '.[test]'
74+
- run: python -m pytest
75+
- uses: codecov/codecov-action@v2
76+
with:
77+
flags: ${{ matrix.python-version }}
8378

84-
extras:
85-
needs: [lint, dist, docs]
79+
contrib:
80+
needs: [ lint, dist, docs ]
8681
runs-on: ubuntu-latest
8782
strategy:
8883
matrix:
8984
extras:
9085
- wagtail
91-
python-version: ["3.x"]
86+
python-version: [ "3.x" ]
9287
steps:
88+
- uses: actions/checkout@v3
9389
- name: Set up Python ${{ matrix.python-version }}
9490
uses: actions/setup-python@v4
9591
with:
9692
python-version: ${{ matrix.python-version }}
97-
- run: python -m pip install --upgrade pip setuptools wheel
98-
- uses: actions/checkout@v3
99-
- run: python -m pip install -e ".[${{ matrix.extras }}]"
100-
- run: python setup.py test
101-
- name: Codecov
102-
run: |
103-
python -m pip install codecov
104-
codecov
93+
- run: python -m pip install -e ".[test,${{ matrix.extras }}]"
94+
- run: python -m pytest
95+
- uses: codecov/codecov-action@v2
96+
with:
97+
flags: ${{ matrix.extras }}
10598

10699

107100
PostgreSQL:
108-
needs: [lint, dist, docs]
101+
needs: [ lint, dist, docs ]
109102
runs-on: ubuntu-latest
110103
strategy:
111104
matrix:
112-
python-version: ["3.10"]
105+
python-version: [ "3.10" ]
113106
django-version:
114107
- "4.0"
115108
- "4.1"
109+
extras:
110+
- postgres
116111
services:
117112
postgres:
118113
image: postgres
@@ -127,21 +122,19 @@ jobs:
127122
uses: actions/setup-python@v4
128123
with:
129124
python-version: ${{ matrix.python-version }}
130-
- run: python -m pip install --upgrade pip setuptools wheel
131125
- uses: actions/checkout@v3
132-
- run: python -m pip install "psycopg2-binary<2.9" Django~=${{ matrix.django-version }}.0
133-
- run: python setup.py test
126+
- run: python -m pip install Django~=${{ matrix.django-version }}.0 -e ".[test,${{ matrix.extras }}]"
127+
- run: python -m pytest
134128
env:
135129
DB_PORT: ${{ job.services.postgres.ports[5432] }}
136130
DB: pg
137-
- name: Codecov
138-
run: |
139-
python -m pip install codecov
140-
codecov
131+
- uses: codecov/codecov-action@v2
132+
with:
133+
flags: ${{ matrix.extras }}
141134

142135
analyze:
143136
name: CodeQL
144-
needs: [SQLite, extras, PostgreSQL]
137+
needs: [ SQLite, contrib, PostgreSQL ]
145138
runs-on: ubuntu-latest
146139
permissions:
147140
actions: read

.github/workflows/release.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,9 @@ jobs:
1313
- uses: actions/setup-python@v4
1414
with:
1515
python-version: "3.x"
16-
- name: Install Python dependencies
17-
run: python -m pip install --upgrade pip setuptools wheel twine
18-
- name: Build dist packages
19-
run: python setup.py sdist bdist_wheel
20-
- name: Upload packages
21-
run: python -m twine upload dist/*
16+
- run: python -m pip install --upgrade pip build wheel twine
17+
- run: python -m build --sdist --wheel
18+
- run: python -m twine upload dist/*
2219
env:
2320
TWINE_USERNAME: __token__
2421
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,4 @@ tests/local.py
6363
docs/_build/
6464
venv
6565
.python-version
66+
_version.py

.readthedocs.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
version: 2
6+
7+
build:
8+
os: ubuntu-20.04
9+
tools:
10+
python: "3.11"
11+
12+
sphinx:
13+
configuration: docs/conf.py
14+
15+
python:
16+
install:
17+
- method: pip
18+
path: .
19+
extra_requirements:
20+
- docs

CONTRIBUTING.rst

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,22 @@ Contributing
44

55
To install the development requirements simply run::
66

7-
python setup.py develop
7+
python -m pip install -e '.[test]'
88

99
To run test suite run::
1010

11-
python setup.py test
12-
13-
... and to run the entire test suite, simply use tox::
14-
15-
pip install --upgrade tox
16-
tox
11+
python -m pytest
1712

1813
To build the documentation run::
1914

20-
python setup.py build_sphinx
21-
open docs/_build/html/index.html
22-
15+
python -m sphinx -W -b spelling docs docs/_build
2316

2417
The sample app
2518
==============
2619

2720
To run a full example — e.g. to debug frontend code – you can run::
2821

29-
python setup.py develop
22+
python -m pip install -e .
3023
python tests/testapp/manage.py migrate
3124
python tests/testapp/manage.py createsuperuser
3225
# You will be asked for the email address of your new superuser

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Next you will need to add the new authentication backend::
8989
Django's ``ModelBackend`` is only needed, if you still want to support
9090
password based authentication. If you don't, simply remove it from the list.
9191

92-
Last but not least, go to your URL root config ``urls.py`` and add the following::
92+
Last but not least, go to your URL root configuration ``urls.py`` and add the following::
9393

9494
from django.urls import path
9595

SECURITY.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Security Policy
2+
3+
## Security contact information
4+
5+
To report a security vulnerability, please use the
6+
[Tidelift security contact](https://tidelift.com/security).
7+
Tidelift will coordinate the fix and disclosure.

docs/conf.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
django.setup()
1111

1212
project = "Django Mail Auth"
13-
copyright = "2019, Johannes Hoppe"
13+
copyright = "2022, Johannes Maron"
1414
release = get_distribution("django-mail-auth").version
1515
version = ".".join(release.split(".")[:2])
1616

@@ -31,6 +31,16 @@
3131
),
3232
}
3333

34+
try:
35+
import sphinxcontrib.spelling # noqa
36+
except ImportError:
37+
pass
38+
else:
39+
extensions.append("sphinxcontrib.spelling")
40+
41+
spelling_word_list_filename = "spelling_wordlist.txt"
42+
spelling_show_suggestions = True
43+
3444

3545
autodoc_default_options = {
3646
"show-inheritance": True,

docs/customizing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Custom login form
1515
Custom login forms need to inherit from :class:`.BaseLoginForm` and override
1616
the :meth:`save<.BaseLoginForm.save>` method.
1717

18-
The following example is for a login SMS via twilio. This will require a
18+
The following example is for a login SMS. This will require a
1919
custom user model with a unique ``phone_number`` field::
2020

2121
from django import forms
@@ -58,7 +58,7 @@ custom user model with a unique ``phone_number`` field::
5858
)
5959

6060

61-
To add the new login form, simply add a new login view to your URL config with
61+
To add the new login form, simply add a new login view to your URL configuration with
6262
the custom form::
6363

6464
from django.urls import path

0 commit comments

Comments
 (0)