-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathpyproject.toml
More file actions
161 lines (146 loc) · 4.76 KB
/
pyproject.toml
File metadata and controls
161 lines (146 loc) · 4.76 KB
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
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "fickling"
dynamic = ["version"]
description = "A static analyzer and interpreter for Python pickle data"
readme = "README.md"
license = { file = "LICENSE" }
authors = [{ name = "Trail of Bits", email = "opensource@trailofbits.com" }]
maintainers = [{ name = "Trail of Bits", email = "opensource@trailofbits.com" }]
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Security",
"Topic :: Software Development :: Testing",
"Topic :: Utilities",
]
requires-python = ">=3.10"
[project.optional-dependencies]
torch = [
"torch >= 2.1.0",
"torchvision >= 0.24.1",
"numpy >= 2.2.6, < 2.3; python_version == '3.10'",
"numpy >= 2.3.5; python_version >= '3.11'",
]
lint = [
"ruff >= 0.8.0",
"ty >= 0.0.12",
# for the Buffer ABC before Python 3.12
"typing-extensions; python_version < '3.12'",
]
test = [
"pytest >= 8.0.0",
"pytest-cov >= 5.0.0",
"coverage[toml] >= 7.0.0",
"fickling[torch,archive]",
]
archive = [
"py7zr >= 1.1.0, != 1.1.2", # For 7z archive support (1.1.2 yanked)
]
huggingface = [
"huggingface_hub >= 0.20.0",
"fickling[torch]",
]
dev = [
"fickling[lint,test,torch,archive,huggingface]",
# For git hooks: install prek (brew install prek / pipx install prek), then run: prek install
]
examples = ["numpy", "pytorchfi"]
[project.scripts]
"fickling" = "fickling.__main__:main"
[project.urls]
Homepage = "https://pypi.org/project/fickling"
Issues = "https://github.com/trailofbits/fickling/issues"
Source = "https://github.com/trailofbits/fickling"
# Black configuration removed - using ruff format instead
[tool.coverage.run]
# don't attempt code coverage for the CLI entrypoints
omit = ["fickling/__main__.py", "fickling/cli.py"]
[tool.ty]
# ty uses src layout detection automatically
# Most mypy options don't have direct equivalents yet
# See: https://docs.astral.sh/ty/configuration/
[tool.hatch.version]
path = "fickling/__init__.py"
[tool.hatch.build.targets.sdist]
exclude = [
"/.github",
"/test",
"/example",
"/pickle_scanning_benchmark",
"/.gitignore",
"/Makefile",
"/.pre-commit-config.yaml",
]
[tool.hatch.build.targets.wheel]
packages = ["fickling"]
[tool.ruff]
line-length = 100
target-version = "py310"
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"F", # pyflakes
"W", # pycodestyle warnings
"I", # isort
"N", # pep8-naming
"UP", # pyupgrade
"YTT", # flake8-2020
"BLE", # flake8-blind-except
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"T20", # flake8-print
"RET", # flake8-return
"SIM", # flake8-simplify
"PTH", # flake8-use-pathlib
"PERF", # perflint
"RUF", # ruff-specific rules
]
ignore = [
"E501", # line too long (handled by formatter)
"T201", # print statements (needed for CLI)
"T203", # pprint statements
# Pre-existing issues to fix in future PRs
"PTH123", # open() should be replaced by Path.open()
"PTH107", # os.remove should be replaced by Path.unlink
"PTH118", # os.path.join should be replaced by Path
"PTH119", # os.path.basename should be replaced by Path.name
"RUF012", # Mutable class attributes should use ClassVar
"RUF013", # PEP 484 prohibits implicit Optional
"B028", # No explicit stacklevel in warnings
"B904", # Use raise ... from within except blocks
"SIM102", # Use single if instead of nested if
"SIM108", # Use ternary operator instead of if-else
"SIM114", # Combine if branches with same body
"SIM115", # Use context handler for opening files
"SIM117", # Use single with statement for multiple contexts
"SIM118", # Use `key in dict` instead of `key in dict.keys()`
"SIM201", # Use `!=` instead of `not ==`
"PERF203", # try-except in loop could be moved outside
"RET503", # Missing explicit return
"RET504", # Unnecessary assignment before return
"RUF015", # Prefer next() over list indexing
]
[tool.ruff.lint.per-file-ignores]
# Ignore various checks for benchmark and example code
"pickle_scanning_benchmark/*.py" = ["BLE", "T20", "N806"]
"example/*.py" = ["T20"]
"test/*.py" = ["T20"]
"fickling/hook.py" = ["N816"]
"fickling/fickle.py" = ["N802"] # AST visitor methods must be named visit_*
[tool.ruff.lint.isort]
known-first-party = ["fickling"]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false