Skip to content

Commit 88b318f

Browse files
authoredMar 12, 2022
Switch to make-based tooling (#198)
* Switch to make-based tooling * Fix Makefile for Windows * Drop windows
1 parent bc29248 commit 88b318f

13 files changed

+66
-133
lines changed
 

‎CONTRIBUTING.md

+17-17
Original file line numberDiff line numberDiff line change
@@ -16,52 +16,52 @@ Here are a few ways in which you can help:
1616
1. Clone it on your machine.
1717
1. Install dependencies:
1818

19-
```bash
20-
scripts/install
19+
```
20+
make install
2121
```
2222

2323
### Tests
2424

2525
Run the tests using:
2626

27-
```bash
28-
scripts/test
27+
```
28+
make test
2929
```
3030

3131
### Code style
3232

3333
Run code auto-formatting with:
3434

35-
```bash
36-
scripts/lint
35+
```
36+
make format
3737
```
3838

3939
Run code style checks using:
4040

41-
```bash
42-
scripts/check
41+
```
42+
make check
4343
```
4444

4545
### Generating migrations
4646

4747
This package includes migrations. To update them in case of changes without setting up a Django project, run:
4848

49-
```bash
50-
scripts/makemigrations
49+
```
50+
make migrations
5151
```
5252

5353
### Documentation
5454

55-
Serve the docs site locally (with hot-reload) using:
55+
Build the documentation using:
5656

57-
```bash
58-
scripts/serve
57+
```
58+
make docs
5959
```
6060

61-
Build the documentation using:
61+
Serve the docs site locally (with hot-reload) using:
6262

63-
```bash
64-
scripts/docs build
63+
```
64+
make docs-serve
6565
```
6666

6767
## Notes to maintainers
@@ -76,4 +76,4 @@ scripts/docs build
7676
- Release title, `Version 2.1.0`.
7777
- Description copied from the changelog.
7878
- Once created, this release will be automatically uploaded to PyPI via a publish job on Azure Pipelines.
79-
- Deploy the docs using: `scripts/docs gh-deploy`
79+
- Deploy the docs using: `make docs-deploy`

‎Makefile

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
venv = venv
2+
bin = ${venv}/bin/
3+
pysources = src/ test_project/ tests/
4+
pysources_mypy = src/ test_project/ tests/conftest.py
5+
6+
build:
7+
${python} setup.py sdist bdist_wheel
8+
${bin}twine check dist/*
9+
rm -r build
10+
11+
check:
12+
${bin}black --check --diff --target-version=py36 ${pysources}
13+
${bin}flake8 ${pysources}
14+
${bin}mypy ${pysources_mypy}
15+
${bin}isort --check --diff ${pysources}
16+
make migrations-check
17+
18+
docs:
19+
${bin}mkdocs build
20+
21+
docs-serve:
22+
${bin}mkdocs serve
23+
24+
docs-deploy:
25+
${bin}mkdocs gh-deploy
26+
27+
install:
28+
python3 -m venv ${venv}
29+
${bin}pip install -U pip wheel
30+
${bin}pip install -r requirements.txt
31+
32+
format:
33+
${bin}autoflake --in-place --recursive ${pysources}
34+
${bin}isort ${pysources}
35+
${bin}black --target-version=py36 ${pysources}
36+
37+
migrations:
38+
${bin}python -m tools.makemigrations
39+
40+
migrations-check:
41+
${bin}python -m tools.makemigrations --check
42+
43+
publish:
44+
${bin}twine upload dist/*
45+
46+
test:
47+
${bin}pytest

‎ci/azure-pipelines.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ resources:
44
type: github
55
endpoint: github
66
name: florimondmanca/azure-pipelines-templates
7-
ref: refs/tags/4.0
7+
ref: refs/tags/5.0
88
containers:
99
- container: pg11
1010
image: postgres:11
@@ -56,9 +56,6 @@ stages:
5656
variables:
5757
DJANGO_VERSION: "3.2.*"
5858

59-
py38_windows:
60-
os: windows
61-
6259
py38_postgres:
6360
services:
6461
postgres: pg11

‎scripts/build

-12
This file was deleted.

‎scripts/check

-13
This file was deleted.

‎scripts/docs

-7
This file was deleted.

‎scripts/env

-20
This file was deleted.

‎scripts/install

-27
This file was deleted.

‎scripts/lint

-12
This file was deleted.

‎scripts/publish

-7
This file was deleted.

‎scripts/test

-11
This file was deleted.

‎setup.cfg

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ ignore_missing_imports = True
88

99
[tool:isort]
1010
profile = black
11-
known_first_party = rest_framework_api_key,tests
12-
known_third_party = dj_database_url,django,dotenv,pytest,rest_framework,setuptools,test_project
11+
known_third_party = test_project
1312

1413
[tool:pytest]
1514
testpaths = tests

‎scripts/makemigrations ‎tools/makemigrations.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python
21
"""A stand-alone equivalent of `python manage.py makemigrations`."""
32
import pathlib
43
import sys

0 commit comments

Comments
 (0)
Please sign in to comment.