Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
160 lines (141 loc) · 4.2 KB
/
Copy pathpyproject.toml
File metadata and controls
160 lines (141 loc) · 4.2 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
[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.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3.15",
"Topic :: Security",
"Topic :: Software Development :: Testing",
"Topic :: Utilities",
]
requires-python = ">=3.11"
dependencies = [
"typing-extensions >= 4.6.0; python_version < '3.12'",
]
[project.optional-dependencies]
torch = [
"torch >= 2.1.0",
"torchvision >= 0.24.1",
"numpy >= 2.3.5",
]
lint = [
"ruff >= 0.16.0",
"ty >= 0.0.60",
]
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"
[tool.uv.sources]
torch = { index = "pytorch-cpu" }
torchvision = { index = "pytorch-cpu" }
[[tool.uv.index]]
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true
[tool.uv]
exclude-newer = "1 week"
# 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.ty.environment]
python-version = "3.11"
[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 = "py311"
[tool.ruff.lint]
# Only prefixes whose rules the defaults do not already cover in full are listed.
extend-select = [
"E", # pycodestyle errors
"F", # pyflakes
"W", # pycodestyle warnings
"I", # isort
"N", # pep8-naming
"UP", # pyupgrade
"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)
# builtin open() is fine; Path.open() is a style preference with no behavioral gain
"PTH123",
# several call sites intentionally manage the handle themselves: the temporary files in
# polyglot.py must be closed before their path is reopened by the recursive scan, and cli.py
# binds either a stdio stream or an opened file to the same variable
"SIM115",
]
[tool.ruff.lint.per-file-ignores]
"fickling/fickle.py" = ["TRY004"]
"pickle_scanning_benchmark/*.py" = ["BLE", "LOG015", "T20", "TRY002"]
"example/*.py" = ["T20"]
"test/*.py" = ["T20"]
"test/test_pickle.py" = ["S102"]
"fickling/hook.py" = ["N816"]
[tool.ruff.lint.isort]
known-first-party = ["fickling"]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false