-
Notifications
You must be signed in to change notification settings - Fork 31
/
pyproject.toml
227 lines (201 loc) · 5.86 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
[tool.poetry]
name = "pfl"
version = "0.2.0"
description = "Simulation framework for Private Federated Learning"
authors = ["Apple"]
repository = "https://github.com/apple/pfl-research"
#documentation = "TODO"
readme = "README.md"
packages = [
{include = "pfl"}
]
include = [
"VERSION",
"tox.ini"
]
[tool.poetry.dependencies]
python = ">=3.10,<3.12"
multiprocess = "^0.70.15"
numpy = "^1.21"
scipy = "^1.7.3"
dp-accounting = "^0.4"
prv-accountant = "^0.2.0"
#### Will be installed only with "pytorch" install extra
torch = [
{ version = "^2.0.1+cu118", source = "torch_cu118", markers = "sys_platform == 'linux'", optional = true },
{ version = "^2.0.1", source = "PyPI", markers = "sys_platform == 'darwin'", optional = true },
]
#### Will be installed only with "tf" install extra
tensorflow = [
{version = "^2.14", markers = "sys_platform == 'linux'", optional = true},
{version = "^2.14", markers = "sys_platform == 'darwin' and platform_machine == 'x86_64'", optional = true}
]
# Require TF2.14 for M1 because looks like installing Horovod with <TF2.13 on M1 doesn't work.
tensorflow-macos = { version = "^2.14", markers = "sys_platform == 'darwin' and platform_machine == 'arm64'", optional = true}
tensorflow-probability = { version = "^0.22", optional = true }
#### Will be installed only with "trees" install extra
scikit-learn = { version = "^1.0.2", optional = true }
xgboost = { version = "^1.4.2", optional = true }
#### Will be installed only with "mlx" install extra
mlx = { version = "^0.15.2", optional = true }
#### Needed in case you want to install Horovod
cmake = "^3.27.5"
wheel = "^0.41.2"
[tool.poetry.group.dev.dependencies]
pytest = "^7.2.0"
pytest-cov = "^4.0.0"
deptry = "^0.6.4"
pre-commit = "^2.20.0"
tox = "^3.25.1"
yapf = "^0.40.1"
pytest-env = "^1.0.1"
pytest-xdist = "^3.3.1"
bump-my-version = "^0.9.3"
ruff = "0.0.290"
pytest-lazy-fixture = "^0.6.3"
mypy = "1.5"
[tool.poetry.group.docs.dependencies]
sphinx = "^7.1.2"
sphinx-autodoc-typehints = "^1.24.0"
furo = "^2023.8.19"
sphinx-last-updated-by-git = "^0.3.6"
[tool.poetry.extras]
pytorch = [ 'torch', 'cmake']
tf = ['tensorflow', 'tensorflow-macos', 'tensorflow-probability', 'cmake']
mlx = ['mlx']
trees = ['scikit-learn', 'xgboost']
[[tool.poetry.source]]
name = "torch_cu118"
url = "https://download.pytorch.org/whl/cu118"
priority = "supplemental"
[[tool.poetry.source]]
name = "PyPI"
priority = "primary"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.mypy]
files = ["pfl", "tests"]
disable_error_code = "import,union-attr,index,attr-defined,arg-type"
exclude = ['doc']
#disallow_any_unimported = "True"
#no_implicit_optional = "True"
#warn_unused_ignores = "True"
#show_error_codes = "True"
[tool.ruff]
target-version = "py37"
line-length = 120
fix = true
ignore-init-module-imports = true
allowed-confusables = ["α", "𝒩", "γ", "ℓ", "η", "𝛾", "ε", "δ"]
select = [
# flake8-2020
"YTT",
# flake8-bandit
"S",
# flake8-bugbear
"B",
# flake8-builtins
"A",
# flake8-comprehensions
"C4",
# flake8-debugger
"T10",
# flake8-simplify
"SIM",
# isort
"I",
# mccabe
"C90",
# pycodestyle
"E", "W",
# pyflakes
"F",
# pygrep-hooks
"PGH",
# pyupgrade
"UP",
# ruff
"RUF",
# tryceratops
"TRY",
]
ignore = [
# LineTooLong
"E501",
# DoNotAssignLambda
"E731",
# Use specific rule codes when ignoring type issues
"PGH003",
# Do not compare types, use `isinstance()`
"E721",
# Avoid specifying long messages outside the exception class,
"TRY003",
# `pickle` and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue
"S301",
# Use a single `with` statement with multiple contexts instead of nested `with` statements
"SIM117",
# Function is too complex
"C901",
# Do not use bare `except`
"E722",
# `pytest.raises(Exception)` should be considered evil
"B017",
# Combine `if` branches using logical `or` operator
"SIM114",
# `subprocess` call: check for execution of untrusted input
"S603",
# raise-without-from-inside-except
"B904",
# Use a single `if` statement instead of nested `if` statements
"SIM102",
# Use `raise from` to specify exception cause
"TRY200",
# unused-import (to prevent removing imports from __init__)
"F401"
]
[tool.ruff.per-file-ignores]
"tests/*" = ["S101"]
"tests/integration/*" = ["S607"]
"pfl/*" = ["S101", "S607"]
"benchmarks/*" = ["S101", "SIM115", "A002", "B007", "E741", "S310"]
"publications/*" = ["S101", "SIM115", "A002", "B007", "E741", "S310"]
[tool.coverage.report]
skip_empty = true
[tool.coverage.run]
branch = true
source = ["pfl"]
[tool.pytest.ini_options]
testpaths = "test/"
python_files = "test_*.py"
addopts = "-n auto"
faulthandler_timeout = 720
env = [
"TF_CPP_MIN_LOG_LEVEL = 2",
"PYTHONPATH = .",
]
filterwarnings = [
"ignore:numpy.ufunc size changed.*:RuntimeWarning",
"ignore::DeprecationWarning:tensorflow.*:",
"ignore::FutureWarning:tensorflow.*:",
"ignore::FutureWarning:tensorboard.*:",
"ignore::ResourceWarning:tensorflow.*:",
"ignore::ImportWarning:importlib.*:",
]
markers = [
"macos: mark test that should only run on MacOS, enable with --macos",
"disable_horovod: mark test that use Horovod. If you don't have Horovod installed, you can still run tests with --disable_horovod",
"disable_slow: mark test that is slow. We need to speed up these tests for reasonable runtime on CircleCI"
]
# Run with command:
# poetry run bump-my-version bump <major/minor/patch>
[tool.bumpversion]
current_version = "0.2.0"
commit = "True"
tag = "False"
[[tool.bumpversion.files]]
filename = "VERSION"
[[tool.bumpversion.files]]
filename = "pfl/version.py"
search = '__version__ = "{current_version}"'
replace = '__version__ = "{new_version}"'