Skip to content

Commit d7da3c6

Browse files
authored
Update build system with flit and Makefile (#3)
1 parent 0e5b44f commit d7da3c6

File tree

9 files changed

+124
-128
lines changed

9 files changed

+124
-128
lines changed

.github/workflows/build.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
python-version: ["3.6", "3.7", "3.8", "3.9"]
17+
18+
steps:
19+
- uses: actions/[email protected]
20+
- name: Setup Python ${{ matrix.python-version }}
21+
uses: actions/[email protected]
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
- name: Install flit
25+
run: pip install flit
26+
- name: Build
27+
run: make
28+
- name: Upload coverage
29+
uses: codecov/[email protected]

.github/workflows/main.yml

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

.github/workflows/publish.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: publish
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/[email protected]
13+
- name: Setup Python 3.8
14+
uses: actions/[email protected]
15+
with:
16+
python-version: 3.9
17+
- name: Install flit
18+
run: pip install flit
19+
- name: Publish
20+
env:
21+
FLIT_USERNAME: __token__
22+
FLIT_PASSWORD: ${{ secrets.PYPY_API_TOKEN }}
23+
run: flit publish

.github/workflows/release.yml

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

.gitignore

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
# Environments
2+
.env
3+
.env/
24
.venv/
5+
env/
36
venv/
4-
.env
5-
*.lock
67

7-
# Cache
8-
*.pyc
8+
# IDEA
9+
.idea
10+
.vscode
911

10-
# Setup Tools
11-
build/
12-
dist/
12+
# Python
1313
*.egg
1414
*.egg-info
15-
16-
# PyTest
15+
*.pyc
16+
__pycache__
1717
.pytest_cache
18+
build/
19+
dist/
1820

19-
# VS Code
20-
.vscode
21-
22-
# SQLite
21+
# Generated
2322
*.db
2423
*.sqlite
2524
*.sqlite3
2625
*.sqlite3-shm
2726
*.sqlite3-wal
27+
*.zip
28+
.coverage
29+
coverage.xml

Makefile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.DEFAULT_GOAL := build
2+
3+
install: # Install dependencies
4+
flit install --deps develop --symlink
5+
6+
fmt format: # Run code formatters
7+
isort --profile black .
8+
black .
9+
10+
lint: # Run code linters
11+
isort --profile black --check --diff .
12+
black --check --diff --color .
13+
flake8 --max-line-length 88 --max-complexity 8 --select C,E,F,W,B,B950,S --ignore E203,E501 ninja_apikey
14+
# TODO: mypy ninja_apikey
15+
16+
test: # Run tests
17+
pytest -v sample_project ninja_apikey
18+
19+
cov test-cov: # Run tests with coverage
20+
pytest --cov=ninja_apikey --cov-report=term-missing --cov-report=xml -v sample_project ninja_apikey
21+
22+
build: # Build project
23+
make install
24+
make lint
25+
make cov

ninja_apikey/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""Easy to use API key authentication for Django Ninja REST Framework"""
2+
3+
__version__ = "0.2.0"

ninja_apikey/tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# flake8: noqa
12
from datetime import timedelta
23

34
import pytest

pyproject.toml

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
[tool.poetry]
2-
name = "django-ninja-apikey"
3-
version = "0.1.0"
4-
description = "Easy to use API key authentication for Django Ninja REST Framework"
5-
license = "MIT"
1+
[build-system]
2+
requires = ["flit_core >=3.2,<4"]
3+
build-backend = "flit_core.buildapi"
4+
5+
[project]
6+
name = "ninja_apikey"
7+
authors = [{name = "Maximilian Wassink", email="[email protected]"}]
68
readme = "README.md"
7-
homepage = "https://github.com/mawassk/django-ninja-apikey"
8-
repository = "https://github.com/mawassk/django-ninja-apikey"
9-
keywords = ["django", "rest", "ninja", "auth", "apikey"]
9+
requires-python = "~=3.6.2"
1010
classifiers = [
1111
"Environment :: Web Environment",
1212
"Framework :: Django",
13-
"Framework :: Django :: 2.0",
14-
"Framework :: Django :: 2.1",
15-
"Framework :: Django :: 2.2",
1613
"Framework :: Django :: 3.0",
1714
"Framework :: Django :: 3.1",
1815
"Framework :: Django :: 3.2",
@@ -35,24 +32,25 @@ classifiers = [
3532
"Topic :: Software Development :: Libraries :: Application Frameworks",
3633
"Topic :: Software Development :: Libraries :: Python Modules",
3734
]
38-
authors = ["Maximilian Wassink <[email protected]>"]
39-
packages = [{ include = "ninja_apikey" }]
40-
41-
[tool.poetry.dependencies]
42-
python = "^3.6.2"
43-
Django = ">=2.0.13"
44-
django-ninja = ">=0.13"
45-
46-
[tool.poetry.dev-dependencies]
47-
isort = "^5.9.2"
48-
black = "^21.6b0"
49-
flake8 = "^3.9.2"
50-
pytest = "^6.2.4"
51-
pytest-django = "^4.4.0"
35+
dynamic = ["version", "description"]
36+
keywords = ["django", "rest", "ninja", "auth", "apikey"]
37+
dependencies = [
38+
"django",
39+
"django-ninja"
40+
]
5241

53-
[build-system]
54-
requires = ["poetry-core>=1.0.0"]
55-
build-backend = "poetry.core.masonry.api"
42+
[project.urls]
43+
Source = "https://github.com/mawassk/django-ninja-apikey"
5644

57-
[tool.isort]
58-
profile = "black"
45+
[project.optional-dependencies]
46+
test = [
47+
"pytest",
48+
"pytest-cov",
49+
"pytest-django",
50+
"black",
51+
"isort",
52+
"flake8",
53+
"flake8-bugbear",
54+
"flake8-bandit",
55+
"mypy",
56+
]

0 commit comments

Comments
 (0)