-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpyproject.toml
More file actions
194 lines (166 loc) · 4.43 KB
/
Copy pathpyproject.toml
File metadata and controls
194 lines (166 loc) · 4.43 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
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
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "tropt"
version = "0.1.1"
description = "A toolbox for optimizing discrete text triggers."
readme = "README.md"
requires-python = ">=3.10"
license = {text = "MIT"}
authors = [
{name = "Matan Ben-Tov"}
]
keywords = [
"adversarial-attacks",
"jailbreak",
"red-teaming",
"trigger-optimization",
"discrete-optimization",
"prompt-optimization",
"llm",
"nlp",
"robustness",
"ai-safety",
]
classifiers = [
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
]
# Core dependencies - minimal for basic HuggingFace model optimization
dependencies = [
# Core ML/numeric libraries
"torch>=2.4.0",
"numpy>=2.0.0",
"jaxtyping",
# HuggingFace models (core use case)
"transformers==5.8.1",
"accelerate>=1.0.0",
"sentence-transformers>=5.5.0",
# Data validation
"pydantic>=2.0.0",
# Configuration & utilities
"tqdm",
"tenacity",
"pandas>=2.3.3",
"datasets>=4.8.3",
# Used directly by tropt/utils/refusal_dir.py (refusal-direction extraction).
"requests",
"scikit-learn",
# Config [deprecated for now]
# "hydra-core>=1.3.0",
# "omegaconf",
]
[project.urls]
Homepage = "https://tropt.dev"
Repository = "https://github.com/matanbt/TROPT"
Issues = "https://github.com/matanbt/TROPT/issues"
[project.optional-dependencies]
# API model integrations (install separately as needed)
openai = [
"openai>=1.0.0",
"tiktoken>=0.5.0",
]
google = [
"google-genai>=1.0.0",
]
voyage = [
"voyageai>=0.3.0",
]
litellm = [
"litellm>=1.0.0",
]
# vision-related integration (e.g., diffusion models)
vision = [
"diffusers>=0.27.0",
]
# Experiment tracking and visualization
tracking = [
"wandb>=0.25.1",
"livelossplot>=0.5.0",
"trackio>=0.3.0",
]
# Jupyter notebook support
notebooks = [
"ipython>=8.0.0",
"jupyter>=1.0.0",
]
# All optional features (convenience installer)
all = [
"tropt[openai,google,voyage,litellm,vision,tracking,notebooks]",
]
# Development tools
dev = [
# Testing
"pytest>=7.0.0",
"pytest-cov>=4.0.0",
# Linting & formatting
"ruff>=0.1.0",
"ty>=0.0.24",
"pre-commit>=3.0.0",
# All optional features for comprehensive testing
"tropt[all]",
"litellm[proxy]",
# Analysis & visualization
"matplotlib>=3.7.0",
"seaborn>=0.13.0",
# Documentation
"sphinx>=5.0.0",
"sphinx_rtd_theme>=1.0.0",
"pydata_sphinx_theme>=0.13.0",
"sphinx-autodoc-typehints>=1.20.0",
"sphinx-copybutton>=0.5.0",
"sphinx-codeautolink>=0.15.0",
"sphinx-design>=0.5.0",
"sphinx-autobuild>=2024.0.0",
"myst-parser>=0.18.0",
# SEO: auto-generates sitemap.xml + Open Graph / Twitter card meta tags.
"sphinx-sitemap>=2.5.0",
"sphinxext-opengraph>=0.9.0",
]
[[tool.uv.index]]
name = "pytorch-cu126"
url = "https://download.pytorch.org/whl/cu126"
explicit = true
[tool.uv.sources]
torch = [{ index = "pytorch-cu126" }]
[tool.hatch.build.targets.wheel]
packages = ["tropt"]
# Explicit allowlist so the sdist ships only the package + metadata.
[tool.hatch.build.targets.sdist]
include = [
"/tropt",
"/README.md",
"/LICENSE",
"/pyproject.toml",
]
[tool.ruff]
include = ["tropt/**/*.py", "tests/**/*.py"]
extend-exclude = ["tests/_legacy"]
[tool.ruff.lint]
# Enable Pyflakes, pycodestyle, and isort rules
select = ["E", "F", "W", "I"]
ignore = [
"E501", # line length (currently ignored, TODO: re-format long lines)
"F722", # Forward annotation false positive from jaxtyping
"F821", # Undefined name false positive from jaxtyping
]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401", "I001"] # custom import order in init files
[tool.ty.src]
include = ["tropt/"]
[tool.ty.rules]
unresolved-attribute = "ignore" # HF/ST models expose attrs dynamically (e.g. .generate, .encode, .config)
invalid-argument-type = "ignore" # jaxtyping annotations (Float[Tensor, ...]) confuse ty's type narrowing
call-non-callable = "ignore" # ST's _first_module(), .encode(), HF's .generate() seen as Tensor|Module union
invalid-method-override = "ignore" # model/loss subclasses intentionally specialize abstract signatures
[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
norecursedirs = ["_legacy"]