Skip to content

Commit

Permalink
Update build system with flit and Makefile (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
mawassk committed Aug 16, 2021
1 parent 0e5b44f commit d7da3c6
Show file tree
Hide file tree
Showing 9 changed files with 124 additions and 128 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: build

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9"]

steps:
- uses: actions/checkout@v2.3.4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2.2.2
with:
python-version: ${{ matrix.python-version }}
- name: Install flit
run: pip install flit
- name: Build
run: make
- name: Upload coverage
uses: codecov/codecov-action@v2.0.2
60 changes: 0 additions & 60 deletions .github/workflows/main.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: publish

on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2.3.4
- name: Setup Python 3.8
uses: actions/setup-python@v2.2.2
with:
python-version: 3.9
- name: Install flit
run: pip install flit
- name: Publish
env:
FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets.PYPY_API_TOKEN }}
run: flit publish
25 changes: 0 additions & 25 deletions .github/workflows/release.yml

This file was deleted.

28 changes: 15 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
# Environments
.env
.env/
.venv/
env/
venv/
.env
*.lock

# Cache
*.pyc
# IDEA
.idea
.vscode

# Setup Tools
build/
dist/
# Python
*.egg
*.egg-info

# PyTest
*.pyc
__pycache__
.pytest_cache
build/
dist/

# VS Code
.vscode

# SQLite
# Generated
*.db
*.sqlite
*.sqlite3
*.sqlite3-shm
*.sqlite3-wal
*.zip
.coverage
coverage.xml
25 changes: 25 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.DEFAULT_GOAL := build

install: # Install dependencies
flit install --deps develop --symlink

fmt format: # Run code formatters
isort --profile black .
black .

lint: # Run code linters
isort --profile black --check --diff .
black --check --diff --color .
flake8 --max-line-length 88 --max-complexity 8 --select C,E,F,W,B,B950,S --ignore E203,E501 ninja_apikey
# TODO: mypy ninja_apikey

test: # Run tests
pytest -v sample_project ninja_apikey

cov test-cov: # Run tests with coverage
pytest --cov=ninja_apikey --cov-report=term-missing --cov-report=xml -v sample_project ninja_apikey

build: # Build project
make install
make lint
make cov
3 changes: 3 additions & 0 deletions ninja_apikey/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""Easy to use API key authentication for Django Ninja REST Framework"""

__version__ = "0.2.0"
1 change: 1 addition & 0 deletions ninja_apikey/tests.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flake8: noqa
from datetime import timedelta

import pytest
Expand Down
58 changes: 28 additions & 30 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
[tool.poetry]
name = "django-ninja-apikey"
version = "0.1.0"
description = "Easy to use API key authentication for Django Ninja REST Framework"
license = "MIT"
[build-system]
requires = ["flit_core >=3.2,<4"]
build-backend = "flit_core.buildapi"

[project]
name = "ninja_apikey"
authors = [{name = "Maximilian Wassink", email="wassink.maximilian@protonmail.com"}]
readme = "README.md"
homepage = "https://github.com/mawassk/django-ninja-apikey"
repository = "https://github.com/mawassk/django-ninja-apikey"
keywords = ["django", "rest", "ninja", "auth", "apikey"]
requires-python = "~=3.6.2"
classifiers = [
"Environment :: Web Environment",
"Framework :: Django",
"Framework :: Django :: 2.0",
"Framework :: Django :: 2.1",
"Framework :: Django :: 2.2",
"Framework :: Django :: 3.0",
"Framework :: Django :: 3.1",
"Framework :: Django :: 3.2",
Expand All @@ -35,24 +32,25 @@ classifiers = [
"Topic :: Software Development :: Libraries :: Application Frameworks",
"Topic :: Software Development :: Libraries :: Python Modules",
]
authors = ["Maximilian Wassink <wassink.maximilian@protonmail.com>"]
packages = [{ include = "ninja_apikey" }]

[tool.poetry.dependencies]
python = "^3.6.2"
Django = ">=2.0.13"
django-ninja = ">=0.13"

[tool.poetry.dev-dependencies]
isort = "^5.9.2"
black = "^21.6b0"
flake8 = "^3.9.2"
pytest = "^6.2.4"
pytest-django = "^4.4.0"
dynamic = ["version", "description"]
keywords = ["django", "rest", "ninja", "auth", "apikey"]
dependencies = [
"django",
"django-ninja"
]

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

[tool.isort]
profile = "black"
[project.optional-dependencies]
test = [
"pytest",
"pytest-cov",
"pytest-django",
"black",
"isort",
"flake8",
"flake8-bugbear",
"flake8-bandit",
"mypy",
]

0 comments on commit d7da3c6

Please sign in to comment.