forked from alliander-opensource/pycgmes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
141 lines (121 loc) · 4.96 KB
/
pyproject.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# SPDX-FileCopyrightText: 2023 Alliander
#
# SPDX-License-Identifier: Apache-2.0
[tool.poetry]
name = "pycgmes"
version = "1.1.0"
description = "Python dataclasses for CGMES 3.0.0"
authors = ["pycgmes <[email protected]>"]
readme = "README.md"
repository = "https://github.com/alliander-opensource/pycgmes"
license = "Apache 2.0"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Framework :: Pydantic",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Software Development :: Libraries :: Python Modules",
"Typing :: Typed",
"License :: OSI Approved :: Apache Software License",
]
# This will be added to pycgmes-shacl (see directory shacl).
exclude = ["./pycgmes/shacl"]
# Because the standard structure (packagename) is used, it is not needed to give
# a package configuration entry.
[tool.poetry.dependencies]
python = "^3.10"
poetry = ">=1.5.0" # key 'priority' in source
pydantic = "<2" # Used for dataclasses, v2 is quite new and needs more stability before migration
[tool.poetry.group.dev.dependencies]
bandit = { extras = ["toml"], version = "*" } # Security checks
black = "*" # Formatter
coverage = { extras = ["toml"], version = "*" } # unit test coverage
mypy = "*" # Type checker
reuse = "*" # Check licence headers
ruff = "*" # Linter/fixer. Replaces isort and autoflake, eventually probably pylint as well.
pylint = "*" # Linter
pytest = "*"
SCons = "*" # Command runner
[tool.poetry.group.notebook.dependencies]
matplotlib = "*"
networkx = "*"
pandas = "*"
pyshacl = "*"
rdflib = "*"
rdfpandas = "*"
# yes, the double [[]] is required
[[tool.poetry.source]]
# Pypi is the default destination on publish.
name = "pypi"
priority = "primary" # Means it is the first source tried.
[tool.black]
line-length = 120
[tool.coverage.run]
# I would love to only cover Bay (this is the one used by the tests) and still load all the others
# to check that there is no syntax error. But not sure how to do it cleanly, so not done.
include = ["pycgmes/*"]
omit = []
[tool.coverage.report]
fail_under = 85
exclude_also = [ # Regexp of lines (or first line of block) which do not count for coverage.
# __main__ block is never tested.
"if __name__ == .__main__.:",
]
[tool.mypy]
# ignore_missing_imports = true
no_implicit_optional = true # Need an explicit None to be optional
show_error_codes = true
show_column_numbers = true
pretty = true
non_interactive = true # Do not ask for confirmations to install stubs
install_types = true # Install stubs if required
check_untyped_defs = true # Checks what it can even in files without annotation
plugins = ["pydantic.mypy"]
[tool.bandit]
targets = ["pycgmes"]
exclude_dirs = ["tests", "SConstruct.py"]
skips = [
"B101" # assert_used
]
[tool.pylint.messages_control]
max-line-length = 120
disable = [
"duplicate-code", # pylint is too sensitive and got it wrong more often than not
"logging-fstring-interpolation", # Let's keep fstrings for consistency
"method-cache-max-size-none", # I want to be able to use @cache
"missing-function-docstring",
"missing-module-docstring",
"no-else-continue", # if ... continue else something should be accepted
"no-else-raise", # if ... raise else something should be accepted
"no-else-return", # if ... return else return should be accepted.
"too-many-instance-attributes", # Not relevant for dataclasses.
"unsubscriptable-object", # https://github.com/PyCQA/pylint/issues/3637,
# Above are generic stuff.
# Below are cimgen specific stuff.
"invalid-name", # We follow the CIM naming convention, not python.
"similarities", # Most dataclasses are the same, ignore similarities.
"too-many-ancestors", # The tree of parent can be big but we have no control over it.
"too-many-instance-attributes", # Dataclasses can have a lot of attributes.
]
[tool.pylint.similarities]
# Ignore imports when computing similarities. They create a lot of false positives because of
# typing, were the imports look a lot like each other across many files.
ignore-imports = "yes"
[tool.pylint.miscellaneous]
# Notes which will generate a warning from pylint. TODO for instance will not.
notes = "FIXME"
[tool.pylint.master]
# Tell pylint to add the directory where this file is as pythonpath. Not ideal, but it seems to work nicely, on cli and vscode.
init-hook = "from pylint.config import find_default_config_files; import os, sys; sys.path.append(os.path.dirname(list(find_default_config_files())[-1])); sys.path.append('./pycgmes/lambdas')"
[tool.ruff]
line-length = 120
# Group violations by containing file.
format = "grouped"
[tool.pytest.ini_options]
addopts = ["--import-mode=importlib",] # modern way to import tests
pythonpath = ["."] # Allows from pycgmes import in the tests, which is easier for the IDE.
[build-system]
# Used for building package from poetry. Present by default, not actually used.
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"