-
Notifications
You must be signed in to change notification settings - Fork 4
/
pyproject.toml
146 lines (126 loc) · 4.58 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
142
143
144
145
146
# SPDX-FileCopyrightText: 2023 Alliander
#
# SPDX-License-Identifier: Apache-2.0
[tool.poetry]
name = "pycgmes"
version = "2.0.3"
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
[tool.poetry.group.dev.dependencies]
coverage = { extras = ["toml"], version = "*" } # unit test coverage
pyright = "*" # replaces mypy
reuse = "*" # Check licence headers
ruff = "*" # Linter/fixer. Replaces isort autoflake and pylint
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.pyright]
include = ["pycgmes"]
exclude = ["tests"]
# Simulate mypy - these vars will always have the value defined here during type checks
defineConstant = { TYPE_CHECKING = true }
# This is the default, but FYI.
# Pyright in strict mode need to check everything, ie. all code branches. In Basic mode, it will be happy
# enough with partially know types.
# Specially for boto3, which has a massively overloaded boto3.client() method, all stubs are required to
# have a happy strict mode, and they take about 5mintes to install (there are a lot of them!)
# Long story short: basic is fine.
typeCheckingMode = "basic"
[tool.ruff]
line-length = 120
# Group violations by containing file.
output-format = "grouped"
[tool.ruff.lint]
select = [
# See https://docs.astral.sh/ruff/rules/
"E", # Default, pyflake
"F", # Default, pyflake
"I", # isort
"W", # warning
"C90", # McCabe
"PL", # Pylint (a subset thereof)
"RUF", # RUF rules
"UP", # upgrade python rules
"B", # catch common bugs
"A", # catch builtin shadowing
"C4", # unnecessary things in/with comprehensions
"DTZ", # datetime good practice
"PIE", # unnecessary args/code for some well known code
"PT", # pytest linting
"SIM", # simplify code
"ARG", # unused arguments
"PTH", # use pathlib instead of os & co
"PD", # pandas things
"PERF", # performance things
"N", # pep8
"BLE", # catch too broad exception
]
ignore = [
"A003", # when an attributes shadows a builtin. Id in a dataclass is OK, ruff.
# revisit when https://github.com/astral-sh/ruff/issues/7806 is done
"N999", "N815", # Formatting due to CamelCase coming from CGMES.
]
[tool.ruff.lint.isort]
known-first-party = ["pycgmes", "tests"] # Useful if ruff does not run from the actual root of the project and to import from tests
[tool.ruff.lint.pep8-naming]
# extend= use the default ignored names and add those
extend-ignore-names = [
"G", # makes sense in the context of graph
"mRID", "lineColor", # cim notation
"create_*", # some functions are named after CIM nomenclatures, not python
"N", # shortcut in stack
]
[tool.ruff.format]
docstring-code-format = true
[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"