diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 0000000..d006d44 --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,29 @@ +pipeline: + # =====TESTING===== + test: + # Alpine version doesn't have make + image: python:3.9 + pull: true + commands: + - make test + when: + event: push + + + # =====LINTING===== + lint: + image: python:3.9 + commands: + - make lint + when: + event: push + + + # =====PUBLISHING===== + publish: + image: python:3.9 + commands: + - make publish + when: + event: tag + branch: master diff --git a/LICENSE b/LICENSE index 2071b23..682801b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) +Copyright (c) 2021 Jef Roosens Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f59c731 --- /dev/null +++ b/Makefile @@ -0,0 +1,49 @@ +# =====CONFIG===== +PYTHON := python3 +# This can't contain spaces (I think) +VENV := .venv +# Minimum % coverage for tests to succeed +MIN_COV := 50 + + +# =====GENERAL===== +## By default, create the venv +all: venv +.PHONY: all + +## Remove any temporary files +clean: + @ rm -rf '$(VENV)' +.PHONY: clean + + +# =====BACKEND===== +## VENV +### Create the venv +$(VENV)/bin/activate: setup.cfg + @ '$(PYTHON)' -m venv '$(VENV)' + @ '$(VENV)'/bin/pip install -e .[develop] + + +### Convenient alias for the venv +venv: $(VENV)/bin/activate +.PHONY: venv + + +## Formatting & linting +### Format the codebase using black +format: venv + @ '$(VENV)'/bin/black setup.py app +.PHONY: format + +### Lint using black & flake8 +lint: venv + @ '$(VENV)'/bin/flake8 setup.py app + @ '$(VENV)'/bin/black --check setup.py app +.PHONY: lint + + +## Testing +test: venv + @ '$(VENV)'/bin/pytest --cov=app --cov-fail-under='$(MIN_COV)' tests/ +.PHONY: test diff --git a/app/__init__.py b/app/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..9787c3b --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..83fa01d --- /dev/null +++ b/setup.cfg @@ -0,0 +1,30 @@ +[metadata] +name = config-skeleton +version = 0.0.1 + +[options] +packages = app +install_requires = + +[options.extras_require] +test = + pytest==6.2.4 + pytest-cov==2.12.0 + # Worth testing out + pytest-tldr==0.2.4 + +# Used inside tox for linting +lint = + black==20.8b1 + flake8==3.9.2 + flake8-bugbear==21.4.3 + flake8-comprehensions==3.5.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 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..056ba45 --- /dev/null +++ b/setup.py @@ -0,0 +1,4 @@ +import setuptools + + +setuptools.setup() diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29