Compare commits
5 Commits
21eb0c065d
...
master
Author | SHA1 | Date | |
---|---|---|---|
c50cfe88d6
|
|||
1a293563d1
|
|||
acf4c06404
|
|||
1c49c4923f
|
|||
9f89f8cc9d
|
6
.github/workflows/ci.yaml
vendored
6
.github/workflows/ci.yaml
vendored
@ -8,9 +8,9 @@ on:
|
||||
jobs:
|
||||
test:
|
||||
name: Test
|
||||
uses: daniil-berg/reusable-workflows/.github/workflows/python-test.yaml@v0.2.1
|
||||
uses: daniil-berg/reusable-workflows/.github/workflows/python-test.yaml@v0.2.2
|
||||
with:
|
||||
versions: '["3.9", "3.10", "3.11"]'
|
||||
versions: '["3.9", "3.10", "3.11", "3.12"]'
|
||||
unittest-command: 'scripts/test.sh'
|
||||
coverage-command: 'scripts/cov.sh'
|
||||
unittest-requirements: "-e '.[dev]'"
|
||||
@ -24,7 +24,7 @@ jobs:
|
||||
name: Release
|
||||
if: ${{ github.ref_type == 'tag' }}
|
||||
needs: test
|
||||
uses: daniil-berg/reusable-workflows/.github/workflows/python-release.yaml@v0.2.1
|
||||
uses: daniil-berg/reusable-workflows/.github/workflows/python-release.yaml@v0.2.2
|
||||
with:
|
||||
git-ref: ${{ github.ref_name }}
|
||||
secrets:
|
||||
|
7
.gitignore
vendored
7
.gitignore
vendored
@ -18,8 +18,5 @@
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
|
||||
# Testing:
|
||||
/.coverage
|
||||
|
||||
# mypy:
|
||||
.mypy_cache/
|
||||
# Miscellaneous cache:
|
||||
.cache/
|
||||
|
@ -0,0 +1,3 @@
|
||||
.md-typeset code {
|
||||
word-break: keep-all; /* Prevent inline-code from being broken up. */
|
||||
}
|
||||
|
@ -1,15 +1,29 @@
|
||||
# ${REPO_NAME}
|
||||
|
||||
${REPO_DESCRIPTION}
|
||||
**${REPO_DESCRIPTION}**
|
||||
|
||||
## Usage
|
||||
---
|
||||
|
||||
...
|
||||
[📑 Documentation][1] | [🧑💻 Source Code][2] | [🐛 Bug Tracker][3]
|
||||
|
||||
---
|
||||
|
||||
## Installation
|
||||
|
||||
`pip install ${REPO_NAME}`
|
||||
|
||||
## Usage
|
||||
|
||||
...
|
||||
|
||||
## Dependencies
|
||||
|
||||
Python Version ..., OS ...
|
||||
Python `>=3.8`, OS agnostic
|
||||
|
||||
---
|
||||
|
||||
© 2023 ...
|
||||
|
||||
[1]: https://${REPO_OWNER_LOWER}.github.io/${REPO_NAME_LOWER}
|
||||
[2]: https://github.com/${REPO_OWNER_LOWER}/${REPO_NAME_LOWER}
|
||||
[3]: https://github.com/${REPO_OWNER_LOWER}/${REPO_NAME_LOWER}/issues
|
||||
|
@ -1,4 +1,4 @@
|
||||
copyright: "© 2023 ${REPO_OWNER_TITLE}"
|
||||
... copyright: "© 2023 ..."
|
||||
site_name: "${REPO_NAME}"
|
||||
site_description: "${REPO_DESCRIPTION}"
|
||||
site_url: "http://${REPO_OWNER_LOWER}.github.io/${REPO_NAME_LOWER}"
|
||||
|
@ -2,19 +2,22 @@
|
||||
# Python packaging: #
|
||||
|
||||
[build-system]
|
||||
requires = ["setuptools", "setuptools-scm"]
|
||||
requires = [
|
||||
"setuptools",
|
||||
"setuptools-scm",
|
||||
]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "${REPO_NAME}"
|
||||
description = "${REPO_DESCRIPTION}"
|
||||
authors = [
|
||||
{ name = "${REPO_OWNER_TITLE}", email = ... },
|
||||
{ name = ..., email = ... },
|
||||
]
|
||||
maintainers = [
|
||||
{ name = "${REPO_OWNER_TITLE}", email = ... },
|
||||
{ name = ..., email = ... },
|
||||
]
|
||||
requires-python = ">=3.9, <4.0"
|
||||
requires-python = ">=3.8, <4.0"
|
||||
keywords = [
|
||||
...
|
||||
]
|
||||
@ -39,18 +42,17 @@ dynamic = [
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
full = [
|
||||
...
|
||||
]
|
||||
full = []
|
||||
dev = [
|
||||
"black==23.3.0",
|
||||
"build==0.10.0",
|
||||
"coverage[toml]==7.2.7",
|
||||
"black==23.10.1",
|
||||
"build==1.0.3",
|
||||
"coverage[toml]==7.3.2",
|
||||
"isort==5.12.0",
|
||||
"mkdocs-material==9.1.17",
|
||||
"mkdocstrings[python]==0.22.0",
|
||||
"mypy==1.4.0",
|
||||
"ruff==0.0.275",
|
||||
"mkdocs-material==9.4.6",
|
||||
"mkdocstrings[python]==0.23.0",
|
||||
"mypy==1.5.1",
|
||||
"pytest==7.4.3",
|
||||
"ruff==0.1.3",
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
@ -59,7 +61,7 @@ dev = [
|
||||
"Documentation" = "http://${REPO_OWNER_LOWER}.github.io/${REPO_NAME_LOWER}"
|
||||
|
||||
[tool.setuptools.dynamic]
|
||||
dependencies = { file = "requirements/common.txt" }
|
||||
dependencies = { file = "requirements/base.txt" }
|
||||
readme = { file = ["README.md"], content-type = "text/markdown" }
|
||||
version = { attr = ..."${REPO_NAME}.__version__" }
|
||||
|
||||
@ -75,8 +77,16 @@ files = [
|
||||
warn_unused_configs = true
|
||||
strict = true
|
||||
show_error_codes = true
|
||||
plugins = [
|
||||
...
|
||||
plugins = []
|
||||
|
||||
############
|
||||
# Testing: #
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
cache_dir = ".cache/pytest"
|
||||
addopts = "-ra -v"
|
||||
testpaths = [
|
||||
"tests",
|
||||
]
|
||||
|
||||
#######################
|
||||
@ -88,7 +98,7 @@ source = [
|
||||
"src/",
|
||||
]
|
||||
branch = true
|
||||
command_line = "-m tests"
|
||||
command_line = "-m pytest -qq"
|
||||
omit = [
|
||||
".venv*/*",
|
||||
]
|
||||
@ -111,25 +121,45 @@ omit = [
|
||||
[tool.ruff]
|
||||
cache-dir = ".cache/ruff"
|
||||
select = [
|
||||
"F", # pyflakes
|
||||
"E", # pycodestyle errors
|
||||
"W", # pycodestyle warnings
|
||||
"F", # pyflakes
|
||||
"N", # pep8-naming
|
||||
"D", # pydocstyle
|
||||
"C", # flake8-comprehensions
|
||||
"ANN", # flake8-annotations
|
||||
"S", # flake8-bandit
|
||||
"FBT", # flake8-boolean-trap
|
||||
"B", # flake8-bugbear
|
||||
"A", # flake8-builtins
|
||||
"C", # flake8-comprehensions
|
||||
"PIE", # flake8-pie
|
||||
"T20", # flake8-print
|
||||
"RET", # flake8-return
|
||||
"SIM", # flake8-simplify
|
||||
"TD", # flake8-todos
|
||||
"TCH", # flake8-type-checking
|
||||
"ARG", # flake8-unused-arguments
|
||||
"PTH", # flake8-use-pathlib
|
||||
"ERA", # eradicate
|
||||
"PL", # pylint
|
||||
"TRY", # tryceratops
|
||||
"RUF", # ruff-specific
|
||||
]
|
||||
ignore = [
|
||||
"E501", # Line too long -> handled by black
|
||||
"D203", # 1 blank line required before class docstring -> D211 is better
|
||||
"D212", # Multi-line docstring summary should start at the first line -> ugly, D212 is better
|
||||
"D212", # Multi-line docstring summary should start at the first line -> ugly, D213 is better
|
||||
"D401", # First line of docstring should be in imperative mood -> no, it shouldn't
|
||||
"D407", # Missing dashed underline after section -> different docstring style
|
||||
"ANN101", # Missing type annotation for self in method -> unnecessary
|
||||
"ANN102", # Missing type annotation for cls in classmethod -> unnecessary
|
||||
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed -> we'll use it sparingly
|
||||
"N818", # Exception name should be named with an Error suffix -> absolutely not
|
||||
]
|
||||
|
||||
[tool.ruff.per-file-ignores]
|
||||
"src/**/__init__.py" = [
|
||||
"A001", # Variable {name} is shadowing a Python builtin
|
||||
"D104", # Missing docstring in public package
|
||||
"F401", # {...} imported but unused
|
||||
]
|
||||
@ -137,12 +167,23 @@ ignore = [
|
||||
"D100", # Missing docstring in public module
|
||||
"D101", # Missing docstring in public class
|
||||
"D102", # Missing docstring in public method
|
||||
"D103", # Missing docstring in public function
|
||||
"D104", # Missing docstring in public package
|
||||
"S101", # Use of `assert` detected
|
||||
"FBT", # flake8-boolean-trap
|
||||
"TRY", # tryceratops
|
||||
]
|
||||
|
||||
####################
|
||||
# Code formatting: #
|
||||
|
||||
[tool.black]
|
||||
line_length = 80
|
||||
|
||||
###################
|
||||
# Import sorting: #
|
||||
|
||||
[tool.isort]
|
||||
profile = "black"
|
||||
extra_standard_library = ["typing_extensions"]
|
||||
line_length = 80
|
||||
|
@ -1,9 +1,10 @@
|
||||
-r common.txt
|
||||
black==23.3.0
|
||||
build==0.10.0
|
||||
coverage[toml]==7.2.7
|
||||
-r full.txt
|
||||
black==23.10.1
|
||||
build==1.0.3
|
||||
coverage[toml]==7.3.2
|
||||
isort==5.12.0
|
||||
mkdocs-material==9.1.17
|
||||
mkdocstrings[python]==0.22.0
|
||||
mypy==1.4.0
|
||||
ruff==0.0.275
|
||||
mkdocs-material==9.4.6
|
||||
mkdocstrings[python]==0.23.0
|
||||
mypy==1.5.1
|
||||
pytest==7.4.3
|
||||
ruff==0.1.3
|
||||
|
1
requirements/full.txt
Normal file
1
requirements/full.txt
Normal file
@ -0,0 +1 @@
|
||||
-r base.txt
|
@ -5,13 +5,13 @@ source "$(dirname $(realpath $0))/util.sh"
|
||||
|
||||
echo 'Linting source and test files...'
|
||||
|
||||
echo ' isort - consistent imports'
|
||||
isort src/ tests/ --check-only
|
||||
|
||||
echo ' ruff - extensive linting'
|
||||
echo ' ruff - Doing extensive linting'
|
||||
ruff src/ tests/
|
||||
|
||||
echo ' black - consistent style'
|
||||
echo ' black - Ensuring consistent code style'
|
||||
run_and_capture black src/ tests/ --check
|
||||
|
||||
echo ' isort - Ensuring consistent import structure'
|
||||
isort src/ tests/ --check-only
|
||||
|
||||
echo -e "${bold_green}No issues found${color_reset}\n"
|
||||
|
@ -1,4 +1,4 @@
|
||||
__copyright__ = "© 2023 ${REPO_OWNER_TITLE}"
|
||||
... __copyright__ = "© 2023 ..."
|
||||
__license__ = """Apache-2.0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -16,5 +16,5 @@ limitations under the License."""
|
||||
__version__ = "0.0.1"
|
||||
|
||||
__doc__ = """
|
||||
PLACEHOLDER
|
||||
${REPO_DESCRIPTION}
|
||||
"""
|
||||
|
@ -1,13 +0,0 @@
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
pattern = sys.argv[1]
|
||||
except IndexError:
|
||||
pattern = "test*.py"
|
||||
test_suite = unittest.defaultTestLoader.discover(".", pattern=pattern)
|
||||
test_runner = unittest.TextTestRunner(resultclass=unittest.TextTestResult)
|
||||
result = test_runner.run(test_suite)
|
||||
sys.exit(not result.wasSuccessful())
|
Reference in New Issue
Block a user