Skip to content

Commit 1e10591

Browse files
author
Dominik Falkner
committed
Merge branch 'dfalkner/add-liccheck-tasks' into 'main'
Add liccheck tasks to poe See merge request common/python-package-template!2
2 parents 1759891 + 4f2aec5 commit 1e10591

1 file changed

Lines changed: 23 additions & 11 deletions

File tree

‎{{ cookiecutter.__package_name_kebab_case }}/pyproject.toml‎

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# https://python-poetry.org/docs/pyproject/#poetry-and-pep-517
21
[build-system]
2+
# https://python-poetry.org/docs/pyproject/#poetry-and-pep-517
33
requires = ["poetry-core>=1.0.0"]
44
build-backend = "poetry.core.masonry.api"
55

6-
# https://python-poetry.org/docs/pyproject/
76
[tool.poetry]
7+
# https://python-poetry.org/docs/pyproject/
88
name = "{{ cookiecutter.__package_name_kebab_case }}"
99
version = "0.0.1"
1010
description = "{{ cookiecutter.package_description }}"
@@ -20,18 +20,18 @@ classifiers = [
2020
"Programming Language :: Python :: 3",
2121
]
2222

23-
# https://python-poetry.org/docs/repositories/#using-a-private-repository
2423
[[tool.poetry.source]]
24+
# https://python-poetry.org/docs/repositories/#using-a-private-repository
2525
name = "risc-pypi"
2626
url = "https://pypiserver.risc-software.at/simple/"
2727
priority = "explicit"
2828

29-
# https://python-poetry.org/docs/dependency-specification/
3029
[tool.poetry.dependencies]
30+
# https://python-poetry.org/docs/dependency-specification/
3131
python = "^{{ cookiecutter.python_version }}"
3232

33-
# https://python-poetry.org/docs/master/managing-dependencies/
3433
[tool.poetry.group.dev.dependencies]
34+
# https://python-poetry.org/docs/master/managing-dependencies/
3535
poethepoet = "^0.20.0"
3636
black = { version = "^23.3.0", extras = ["jupyter"] }
3737
ruff = "^0.0.272"
@@ -44,9 +44,10 @@ mkdocs = "^1.4.3"
4444
mkdocs-material = "^9.1.15"
4545
mkdocstrings = {extras = ["python"], version = "^0.22.0"}
4646
liccheck = "^0.9.2"
47+
setuptools = "^69.0.3"
4748

48-
# https://github.com/nat-n/poethepoet
4949
[tool.poe.tasks]
50+
# https://github.com/nat-n/poethepoet
5051
_format = "black ."
5152
_sort_imports = "isort ."
5253
_lint = "ruff check --fix ."
@@ -55,30 +56,41 @@ _check_format = "black --check ."
5556
_check_sort_imports = "isort --check ."
5657
_check_lint = "ruff check ."
5758

59+
# if you are using poetry for dependency management, you have to generate a requirements.txt first
60+
_convert_to_req_txt = { shell = "poetry export --without-hashes --format=requirements.txt > requirements.txt" }
61+
# check authorization of the licenses of dependencies as defined in [tool.liccheck] section
62+
# (or a separate liccheck.ini-file)
63+
_check_licenses = "liccheck -s liccheck.ini -r requirements.txt"
64+
65+
check_licenses = [
66+
"_convert_to_req_txt",
67+
"_check_licenses",
68+
]
69+
5870
docs = "mkdocs serve"
5971
precommit = ["_format", "_sort_imports", "_lint"]
60-
check = ["_check_format", "_check_sort_imports", "_check_lint"]
72+
check = ["_check_format", "_check_sort_imports", "_check_lint", "check_licenses"]
6173
test = "pytest"
6274

63-
# https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html#configuration-via-a-file
6475
[tool.black]
76+
# https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html#configuration-via-a-file
6577
line-length = 120
6678

67-
# https://pycqa.github.io/isort/docs/configuration/config_files
6879
[tool.isort]
80+
# https://pycqa.github.io/isort/docs/configuration/config_files
6981
profile = "black"
7082

71-
# https://docs.pytest.org/en/7.1.x/reference/customize.html
7283
[tool.pytest.ini_options]
84+
# https://docs.pytest.org/en/7.1.x/reference/customize.html
7385
addopts = "--color=yes --doctest-modules -ra --cov --cov-report=html --cov-report term --exitfirst --failed-first --strict-config --strict-markers --verbosity=2 --junitxml=python-junit.xml"
7486
xfail_strict = true
7587
pythonpath = ["{{ cookiecutter.__package_name_snake_case }}"]
7688
testpaths = ["{{ cookiecutter.__package_name_snake_case }}", "tests"]
7789
# ignore any of these paths
7890
norecursedirs = [ ]
7991

80-
# https://github.com/charliermarsh/ruff
8192
[tool.ruff]
93+
# https://github.com/charliermarsh/ruff
8294
fix = true
8395
ignore-init-module-imports = true
8496
line-length = 120

0 commit comments

Comments
 (0)