mirror of
https://github.com/enpaul/peewee-plus.git
synced 2024-11-21 22:16:54 +00:00
Initial commit
This commit is contained in:
commit
5499d282eb
7
.coveragerc
Normal file
7
.coveragerc
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[run]
|
||||||
|
branch = True
|
||||||
|
|
||||||
|
[report]
|
||||||
|
exclude_lines =
|
||||||
|
\.\.\.
|
||||||
|
pass
|
18
.gitignore
vendored
Normal file
18
.gitignore
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
__pycache__/
|
||||||
|
|
||||||
|
build/
|
||||||
|
dist/
|
||||||
|
*.egg-info/
|
||||||
|
*.pyc
|
||||||
|
|
||||||
|
*.swp
|
||||||
|
|
||||||
|
.coverage
|
||||||
|
*_cache/
|
||||||
|
.tox/
|
||||||
|
.cache/
|
||||||
|
.venv/
|
||||||
|
.mypy_cache/
|
||||||
|
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
59
.pre-commit-config.yaml
Normal file
59
.pre-commit-config.yaml
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
---
|
||||||
|
repos:
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: end-of-file-fixer
|
||||||
|
name: end-of-file-fixer
|
||||||
|
entry: end-of-file-fixer
|
||||||
|
language: system
|
||||||
|
types: [text]
|
||||||
|
|
||||||
|
- id: fix-encoding-pragma
|
||||||
|
name: fix-encoding-pragma
|
||||||
|
entry: fix-encoding-pragma
|
||||||
|
args:
|
||||||
|
- "--remove"
|
||||||
|
language: system
|
||||||
|
types: [python]
|
||||||
|
|
||||||
|
- id: trailing-whitespace-fixer
|
||||||
|
name: trailing-whitespace-fixer
|
||||||
|
entry: trailing-whitespace-fixer
|
||||||
|
language: system
|
||||||
|
types: [text]
|
||||||
|
|
||||||
|
- id: check-merge-conflict
|
||||||
|
name: check-merge-conflict
|
||||||
|
entry: check-merge-conflict
|
||||||
|
language: system
|
||||||
|
types: [text]
|
||||||
|
|
||||||
|
- id: reorder-python-imports
|
||||||
|
name: reorder-python-imports
|
||||||
|
entry: reorder-python-imports
|
||||||
|
args:
|
||||||
|
- "--unclassifiable-application-module=peewee_plus"
|
||||||
|
language: system
|
||||||
|
types: [python]
|
||||||
|
|
||||||
|
- id: black
|
||||||
|
name: black
|
||||||
|
entry: black
|
||||||
|
language: system
|
||||||
|
types: [python]
|
||||||
|
|
||||||
|
- id: blacken-docs
|
||||||
|
name: blacken-docs
|
||||||
|
entry: blacken-docs
|
||||||
|
language: system
|
||||||
|
types: [text]
|
||||||
|
|
||||||
|
- id: mdformat
|
||||||
|
name: mdformat
|
||||||
|
entry: mdformat
|
||||||
|
language: system
|
||||||
|
args:
|
||||||
|
- "--number"
|
||||||
|
- "--wrap=90"
|
||||||
|
types:
|
||||||
|
- markdown
|
53
.pylintrc
Normal file
53
.pylintrc
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
[MESSAGES CONTROL]
|
||||||
|
|
||||||
|
# Disable the message, report, category or checker with the given id(s). You
|
||||||
|
# can either give multiple identifiers separated by comma (,) or put this
|
||||||
|
# option multiple times (only on the command line, not in the configuration
|
||||||
|
# file where it should appear only once).You can also use "--disable=all" to
|
||||||
|
# disable everything first and then reenable specific checks. For example, if
|
||||||
|
# you want to run only the similarities checker, you can use "--disable=all
|
||||||
|
# --enable=similarities". If you want to run only the classes checker, but have
|
||||||
|
# no Warning level messages displayed, use"--disable=all --enable=classes
|
||||||
|
# --disable=W"
|
||||||
|
disable=logging-fstring-interpolation
|
||||||
|
,logging-format-interpolation
|
||||||
|
,bad-continuation
|
||||||
|
,line-too-long
|
||||||
|
,ungrouped-imports
|
||||||
|
,typecheck
|
||||||
|
,wrong-import-order
|
||||||
|
,wrong-import-position
|
||||||
|
,missing-module-docstring
|
||||||
|
,fixme
|
||||||
|
|
||||||
|
|
||||||
|
[REPORTS]
|
||||||
|
|
||||||
|
# Set the output format. Available formats are text, parseable, colorized, json
|
||||||
|
# and msvs (visual studio).You can also give a reporter class, eg
|
||||||
|
# mypackage.mymodule.MyReporterClass.
|
||||||
|
output-format=colorized
|
||||||
|
|
||||||
|
|
||||||
|
[BASIC]
|
||||||
|
|
||||||
|
# Good variable names which should always be accepted, separated by a comma
|
||||||
|
good-names=_,ip,T
|
||||||
|
|
||||||
|
|
||||||
|
[SIMILARITIES]
|
||||||
|
|
||||||
|
# Ignore imports when computing similarities.
|
||||||
|
ignore-imports=yes
|
||||||
|
|
||||||
|
# Ignore function signatures when computing similarities.
|
||||||
|
ignore-signatures=yes
|
||||||
|
|
||||||
|
# Minimum lines number of a similarity.
|
||||||
|
min-similarity-lines=10
|
||||||
|
|
||||||
|
|
||||||
|
[DESIGN]
|
||||||
|
|
||||||
|
# Maximum number of arguments for function / method
|
||||||
|
max-args=7
|
17
LICENSE.md
Normal file
17
LICENSE.md
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
## Copyright 2021 Ethan Paul
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||||
|
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
42
Makefile
Normal file
42
Makefile
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# kodak makefile
|
||||||
|
|
||||||
|
PROJECT = peewee_plus
|
||||||
|
|
||||||
|
.PHONY: help
|
||||||
|
# Put it first so that "make" without argument is like "make help"
|
||||||
|
# Adapted from:
|
||||||
|
# https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
|
||||||
|
help: ## List Makefile targets
|
||||||
|
$(info Makefile documentation)
|
||||||
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-10s\033[0m %s\n", $$1, $$2}'
|
||||||
|
|
||||||
|
clean-tox:
|
||||||
|
rm --recursive --force ./.mypy_cache
|
||||||
|
rm --recursive --force ./.tox
|
||||||
|
rm --force .coverage
|
||||||
|
find ./tests -type d -name __pycache__ -prune -exec rm --recursive --force {} \;
|
||||||
|
|
||||||
|
clean-py:
|
||||||
|
rm --recursive --force ./dist
|
||||||
|
rm --recursive --force ./build
|
||||||
|
rm --recursive --force ./*.egg-info
|
||||||
|
|
||||||
|
clean: clean-tox clean-py; ## Clean temp build/cache files and directories
|
||||||
|
|
||||||
|
wheel: ## Build Python binary distribution wheel package
|
||||||
|
poetry build --format wheel
|
||||||
|
|
||||||
|
source: ## Build Python source distribution package
|
||||||
|
poetry build --format sdist
|
||||||
|
|
||||||
|
build: clean wheel source; ## Build all distribution packages
|
||||||
|
|
||||||
|
test: clean-tox ## Run the project testsuite(s)
|
||||||
|
poetry run tox
|
||||||
|
|
||||||
|
publish: clean test build ## Build and upload to pypi (requires $PYPI_API_KEY be set)
|
||||||
|
@poetry publish --username __token__ --password $(PYPI_API_KEY)
|
||||||
|
|
||||||
|
dev: ## Create local dev environment
|
||||||
|
poetry install --remove-untracked
|
||||||
|
poetry run pre-commit install
|
3
README.md
Normal file
3
README.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# peewee+
|
||||||
|
|
||||||
|
Various extensions, helpers, and utilities for [Peewee](http://peewee-orm.com)
|
6
peewee_plus.py
Normal file
6
peewee_plus.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
__title__ = "peewee-plus"
|
||||||
|
__version__ = "0.1.0"
|
||||||
|
__license__ = "MIT"
|
||||||
|
__summary__ = "Various extensions, helpers, and utilities for Peewee"
|
||||||
|
__url__ = "https://github.com/enpaul/peewee-plus/"
|
||||||
|
__authors__ = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"]
|
2099
poetry.lock
generated
Normal file
2099
poetry.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
40
pyproject.toml
Normal file
40
pyproject.toml
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
[tool.poetry]
|
||||||
|
name = "peewee-plus"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "Various extensions, helpers, and utilities for Peewee"
|
||||||
|
authors = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"]
|
||||||
|
repository = "https://github.com/enpaul/peewee-plus/"
|
||||||
|
license = "MIT"
|
||||||
|
readme = "README.md"
|
||||||
|
packages = [
|
||||||
|
{include = "peewee_plus.py"},
|
||||||
|
{include = "tests", format = "sdist"}
|
||||||
|
]
|
||||||
|
|
||||||
|
[tool.poetry.dependencies]
|
||||||
|
python = "^3.6.1"
|
||||||
|
peewee = "^3.14.8"
|
||||||
|
|
||||||
|
[tool.poetry.dev-dependencies]
|
||||||
|
bandit = "^1.7.1"
|
||||||
|
black = {version = "^21.11b1", python = "^3.7"}
|
||||||
|
blacken-docs = {version = "^1.12.0", python = "^3.7"}
|
||||||
|
ipython = {version = "^7.29.0", python = "^3.7"}
|
||||||
|
mdformat = "^0.6.4"
|
||||||
|
mdformat-gfm = "^0.2"
|
||||||
|
mypy = "^0.910"
|
||||||
|
pre-commit = "^2.15.0"
|
||||||
|
pre-commit-hooks = "^4.0.1"
|
||||||
|
pylint = "^2.11.1"
|
||||||
|
pytest = "^6.2.5"
|
||||||
|
pytest-cov = "^3.0.0"
|
||||||
|
reorder-python-imports = "^2.6.0"
|
||||||
|
safety = "^1.10.3"
|
||||||
|
toml = "^0.10.2"
|
||||||
|
tox = "^3.24.4"
|
||||||
|
tox-poetry-installer = {extras = ["poetry"], version = "^0.8.2"}
|
||||||
|
types-toml = "^0.10.1"
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["poetry-core>=1.0.0"]
|
||||||
|
build-backend = "poetry.core.masonry.api"
|
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
33
tests/test_about.py
Normal file
33
tests/test_about.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
"""Test that metadata module matches pyproject"""
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import toml
|
||||||
|
|
||||||
|
import peewee_plus
|
||||||
|
|
||||||
|
|
||||||
|
def test_about():
|
||||||
|
"""Test metadata values"""
|
||||||
|
|
||||||
|
with (Path(__file__).resolve().parent.parent / "pyproject.toml").open() as infile:
|
||||||
|
pyproject = toml.load(infile)
|
||||||
|
|
||||||
|
assert pyproject["tool"]["poetry"]["name"] == peewee_plus.__title__
|
||||||
|
assert pyproject["tool"]["poetry"]["version"] == peewee_plus.__version__
|
||||||
|
assert pyproject["tool"]["poetry"]["license"] == peewee_plus.__license__
|
||||||
|
assert pyproject["tool"]["poetry"]["description"] == peewee_plus.__summary__
|
||||||
|
assert pyproject["tool"]["poetry"]["repository"] == peewee_plus.__url__
|
||||||
|
assert (
|
||||||
|
all(
|
||||||
|
item in peewee_plus.__authors__
|
||||||
|
for item in pyproject["tool"]["poetry"]["authors"]
|
||||||
|
)
|
||||||
|
is True
|
||||||
|
)
|
||||||
|
assert (
|
||||||
|
all(
|
||||||
|
item in pyproject["tool"]["poetry"]["authors"]
|
||||||
|
for item in peewee_plus.__authors__
|
||||||
|
)
|
||||||
|
is True
|
||||||
|
)
|
88
tox.ini
Normal file
88
tox.ini
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
[tox]
|
||||||
|
envlist =
|
||||||
|
py{36,37,38,39,310}
|
||||||
|
static
|
||||||
|
static-tests
|
||||||
|
security
|
||||||
|
isolated_build = true
|
||||||
|
skip_missing_interpreters = true
|
||||||
|
|
||||||
|
[testenv]
|
||||||
|
description = Run the tests
|
||||||
|
require_locked_deps = true
|
||||||
|
require_poetry = true
|
||||||
|
locked_deps =
|
||||||
|
pytest
|
||||||
|
pytest-cov
|
||||||
|
ruamel.yaml
|
||||||
|
toml
|
||||||
|
commands =
|
||||||
|
pytest {toxinidir}/tests/ \
|
||||||
|
--cov peewee_plus \
|
||||||
|
--cov-config {toxinidir}/.coveragerc \
|
||||||
|
--cov-report term-missing
|
||||||
|
|
||||||
|
[testenv:static]
|
||||||
|
description = Static formatting and quality enforcement
|
||||||
|
basepython = python3.8
|
||||||
|
ignore_errors = true
|
||||||
|
locked_deps =
|
||||||
|
black
|
||||||
|
blacken-docs
|
||||||
|
mdformat
|
||||||
|
mdformat-gfm
|
||||||
|
mypy
|
||||||
|
reorder-python-imports
|
||||||
|
pre-commit
|
||||||
|
pre-commit-hooks
|
||||||
|
pylint
|
||||||
|
commands =
|
||||||
|
pre-commit run \
|
||||||
|
--all-files
|
||||||
|
pylint {toxinidir}/peewee_plus.py \
|
||||||
|
--rcfile {toxinidir}/.pylintrc
|
||||||
|
mypy {toxinidir}/peewee_plus.py \
|
||||||
|
--ignore-missing-imports \
|
||||||
|
--no-strict-optional
|
||||||
|
|
||||||
|
[testenv:static-tests]
|
||||||
|
description = Static formatting and quality enforcement for the tests
|
||||||
|
basepython = python3.8
|
||||||
|
ignore_errors = true
|
||||||
|
locked_deps =
|
||||||
|
mypy
|
||||||
|
pylint
|
||||||
|
pytest
|
||||||
|
types-toml
|
||||||
|
commands =
|
||||||
|
pylint {toxinidir}/tests/ \
|
||||||
|
--rcfile {toxinidir}/.pylintrc
|
||||||
|
mypy {toxinidir}/tests/ \
|
||||||
|
--ignore-missing-imports \
|
||||||
|
--no-strict-optional
|
||||||
|
|
||||||
|
[testenv:security]
|
||||||
|
description = Security checks
|
||||||
|
basepython = python3.8
|
||||||
|
skip_install = true
|
||||||
|
ignore_errors = true
|
||||||
|
locked_deps =
|
||||||
|
bandit
|
||||||
|
safety
|
||||||
|
poetry
|
||||||
|
commands =
|
||||||
|
bandit {toxinidir}/peewee_plus.py \
|
||||||
|
--recursive \
|
||||||
|
--quiet
|
||||||
|
bandit {toxinidir}/tests/ \
|
||||||
|
--recursive \
|
||||||
|
--quiet \
|
||||||
|
--skip B101
|
||||||
|
poetry export \
|
||||||
|
--format requirements.txt \
|
||||||
|
--output {envtmpdir}/requirements.txt \
|
||||||
|
--without-hashes \
|
||||||
|
--dev
|
||||||
|
safety check \
|
||||||
|
--json \
|
||||||
|
--file {envtmpdir}/requirements.txt
|
Loading…
Reference in New Issue
Block a user