Added opinionated project config

pull/15/head
Jef Roosens 2021-05-18 08:57:40 +02:00
parent 2dde3cfe05
commit 4e35509619
Signed by: Jef Roosens
GPG Key ID: 955C0660072F691F
10 changed files with 74 additions and 31 deletions

7
.flake8 100644
View File

@ -0,0 +1,7 @@
# vim: ft=cfg
[flake8]
max-complexity = 7
docstring-convention=google
inline-quotes = double
# Required to be compatible with black
extend-ignore = E203,W503

View File

@ -1,41 +1,51 @@
# =====CONFIG===== # =====CONFIG=====
PYTHON := python3.9 PYTHON := python3.9
# This can't contain spaces (I think) # This can't contain spaces (I think)
VENV := venv VENV := .venv
# Minimum % coverage for tests to succeed
MIN_COV := 10
# By default, just create the venv when needed # By default, just create the venv when needed
all: venv all: venv
# Create the venv # =====RECIPES=====
$(VENV)/bin/activate: requirements.txt requirements-dev.txt ## VENV
### Create the venv
$(VENV)/bin/activate: setup.py setup.cfg
@ '$(PYTHON)' -m venv '$(VENV)' @ '$(PYTHON)' -m venv '$(VENV)'
@ '$(VENV)'/bin/pip install -r requirements.txt -r requirements-dev.txt @ '$(VENV)'/bin/pip install -e .[develop]
# Convenient alias for the venv
### Convenient alias for the venv
venv: $(VENV)/bin/activate venv: $(VENV)/bin/activate
.PHONY: venv .PHONY: venv
## Formatting & linting
format: venv
'$(VENV)'/bin/black setup.py app
.PHONY: format
lint: venv
'$(VENV)'/bin/flake8 setup.py app
.PHONY: lint
## Testing
test: venv
'$(VENV)'/bin/pytest --cov=app --cov-fail-under='$(MIN_COV)' tests/
.PHONY: test
## Cleaning
# Remove the venv # Remove the venv
clean: clean:
@ rm -rf '$(VENV)' @ rm -rf '$(VENV)'
.PHONY: clean
# Run the Flask server # Run the Flask server
# TODO # TODO
run: venv run: venv
# Format the codebase using black
format: venv
@ '$(VENV)/bin/python' -m black src
# Lint the codebase using flake8
lint: venv
@ '$(VENV)/bin/python' -m flake8 src
# Run rests using pytest
# TODO
test: venv

0
app/__init__.py 100644
View File

0
app/__main__.py 100644
View File

2
pyproject.toml 100644
View File

@ -0,0 +1,2 @@
[tool.black]
line-length = 79

View File

@ -1,11 +0,0 @@
# Formatter
black~=20.8b1
# Linter
flake8~=3.9.0
# Testing suite
pytest~=6.2.2
# Language server
jedi~=0.18.0

View File

@ -1,2 +0,0 @@
# Web framework
Flask~=1.1.2

25
setup.cfg 100644
View File

@ -0,0 +1,25 @@
[options]
install_requires =
flask==2.0.0
[options.extras_require]
# Used inside Tox for running tests
test =
pytest==6.2.3
pytest-cov==2.11.1
# Used inside tox for linting
lint =
black==20.8b1
flake8==3.9.1
flake8-bugbear==21.4.3
flake8-comprehensions==3.4.0
flake8-docstrings==1.6.0
flake8-print==4.0.0
flake8-quotes==3.2.0
# Required for the developer
develop =
%(test)s
%(lint)s
jedi==0.18.0

12
setup.py 100644
View File

@ -0,0 +1,12 @@
"""Setup file for installing the application."""
from setuptools import setup
setup(
name="jos",
version="0.1.0",
author="Jef Roosens",
description="Simplify downloading music.",
# TODO add license
packages=["app", "tests"],
)

View File