-
Notifications
You must be signed in to change notification settings - Fork 5
/
pyproject.toml
233 lines (219 loc) · 6.68 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
[build-system]
requires = ["setuptools >= 64.0.0", "wheel"]
build-backend = "setuptools.build_meta"
[tool.setuptools.packages.find]
include = ["cirkit*"]
[project]
name = "libcirkit"
version = "0.1.0"
description = "a python framework to build, learn and reason about probabilistic circuits and tensor networks"
readme = "README.md"
requires-python = ">=3.10"
license = { text="GPLv3" }
keywords = [
"probabilistic-modeling",
"tractable-models",
"probabilistic-inference",
"probabilistic-circuits",
"probabilistic-machine-learning",
"probabilistic-reasoning",
"tensor-network-decompositions",
"tractable-inference",
"tensor-net"
]
authors = [
{ name="The APRIL Lab." }
]
classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Operating System :: OS Independent",
]
dependencies = [
"torch~=2.3.0",
"numpy>=1.23.0,<2.0.0",
"einops~=0.8.0",
"scipy~=1.14.0"
]
[project.urls]
"Homepage" = "https://github.com/april-tools/cirkit"
"Bug Tracker" = "https://github.com/april-tools/cirkit/issues"
"Coverage" = "https://app.codecov.io/gh/april-tools/cirkit"
"Documentation" = "https://cirkit-docs.readthedocs.io"
[project.optional-dependencies]
dev = [
"black[jupyter]~=23.0",
"mypy==1.7.1", # should be specific version for stable typing
"pylint~=3.0.0",
"pydocstyle[toml]~=6.3.0",
"pytest", # this is required to lint the test files
"pytest-cov",
"pylint-per-file-ignores", # TODO: wait for native support in pylint
]
docs = [
"mkdocs",
"mkdocs-material",
"mkdocstrings-python",
"mkdocs-gen-files",
"mkdocs-literate-nav",
"mkdocs-section-index",
]
notebooks = [
"notebook",
"torchvision~=0.18.0",
"matplotlib",
"scikit-learn",
"pandas",
"h5py"
]
################################################################################
# Anything below this line does count to the "hash of pyproject" in workflows,
# as they are for development tools but not project release.
# Configs for testing. Rules for coverage may be changed to reflect unreachable-by-design.
# unit test
[tool.pytest.ini_options]
pythonpath = "."
testpaths = ["tests"]
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')"
]
# code coverage
[tool.coverage.run]
branch = true
source = ["cirkit"]
[tool.coverage.report]
show_missing = true
exclude_also = [ # regex for exclusion
'@overload',
]
# Configs for linting. Rules may be changed/lifted with a good reason.
# code style
[tool.black]
line-length = 100
target-version = ["py310"]
required-version = "23"
# import style
[tool.isort]
py_version = 310
profile = "black"
line_length = 100
extra_standard_library = [ # we treat these as stdlib
"typing_extensions",
]
# doc style
[tool.pydocstyle]
convention = "google"
add_select = "D204,D400,D401,D404"
add_ignore = "D100,D104"
# general linting
[tool.pylint.main]
py-version = "3.10"
evaluation = """
10 - 10 * min(
1, fatal + (5 * error + warning + refactor + convention + 0.1 * info) / statement
)
""" # take into account `info`
fail-under = 9
load-plugins = [ # as available in pylint/extensions
"pylint.extensions.bad_builtin",
"pylint.extensions.broad_try_clause",
"pylint.extensions.check_elif",
"pylint.extensions.code_style",
"pylint.extensions.comparison_placement",
"pylint.extensions.confusing_elif",
"pylint.extensions.consider_refactoring_into_while_condition",
"pylint.extensions.consider_ternary_expression",
"pylint.extensions.dict_init_mutate",
"pylint.extensions.docparams",
"pylint.extensions.docstyle",
"pylint.extensions.dunder",
"pylint.extensions.empty_comment",
"pylint.extensions.eq_without_hash",
"pylint.extensions.for_any_all",
# "pylint.extensions.magic_value", # too strict
"pylint.extensions.mccabe",
"pylint.extensions.no_self_use",
"pylint.extensions.overlapping_exceptions",
"pylint.extensions.private_import",
"pylint.extensions.redefined_loop_name",
"pylint.extensions.redefined_variable_type",
"pylint.extensions.set_membership",
"pylint.extensions.typing",
"pylint.extensions.while_used",
"pylint_per_file_ignores", # TODO: wait for native support in pylint
]
[tool.pylint."messages control"]
enable= [
"use-implicit-booleaness-not-comparison-to-string",
"use-implicit-booleaness-not-comparison-to-zero",
# "consider-using-augmented-assign", # inplace operators are not always applicable
"prefer-typing-namedtuple",
"bad-inline-option",
"deprecated-pragma",
"use-symbolic-message-instead",
"useless-suppression",
]
disable = [
"too-many-arguments",
"too-few-public-methods",
"missing-module-docstring",
"no-member",
"fixme",
"duplicate-code"
]
per-file-ignores = [ # TODO: wait for native support in pylint
"/tests/:missing-function-docstring,missing-return-doc",
]
[tool.pylint.dunder]
good-dunder-names = ["_default_initializer_"] # intended to be named this way
[tool.pylint.import]
allow-reexport-from-package = true
[tool.pylint.parameter_documentation]
accept-no-param-doc = false
accept-no-raise-doc = false
accept-no-return-doc = false
accept-no-yields-doc = false
default-docstring-type = "google"
# type checking
[tool.mypy]
python_version = "3.10"
follow_imports = "silent"
# https://mypy.readthedocs.io/en/stable/config_file.html#miscellaneous
warn_unused_configs = true
# https://mypy.readthedocs.io/en/stable/config_file.html#disallow-dynamic-typing
disallow_any_unimported = true
disallow_any_expr = true
disallow_any_decorated = true
disallow_any_explicit = false
disallow_any_generics = true
disallow_subclassing_any = true
# https://mypy.readthedocs.io/en/stable/config_file.html#untyped-definitions-and-calls
disallow_untyped_calls = true
# untyped_calls_exclude = comma-sep-str
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = true
# https://mypy.readthedocs.io/en/stable/config_file.html#configuring-warnings
warn_redundant_casts = true
warn_unused_ignores = true
warn_return_any = true
warn_unreachable = true
# https://mypy.readthedocs.io/en/stable/config_file.html#miscellaneous-strictness-flags
# implicit_reexport = false # this breaks torch, from mypy 1.7.0
strict_equality = true
# https://mypy.readthedocs.io/en/stable/command_line.html#miscellaneous-strictness-flags
extra_checks = true
# https://mypy.readthedocs.io/en/stable/error_code_list2.html#error-codes-for-optional-checks
enable_error_code = [
"redundant-self",
"redundant-expr",
"possibly-undefined",
"truthy-bool",
"truthy-iterable",
"ignore-without-code",
# "explicit-override", # can be useful, introduced in py3.12 and typing_extensions
]