-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathpyproject.toml
More file actions
139 lines (127 loc) · 5.32 KB
/
Copy pathpyproject.toml
File metadata and controls
139 lines (127 loc) · 5.32 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
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"
[project]
name = "renderers"
# Derived from git tags by hatch-vcs (see [tool.hatch.version] below).
# Untagged commits get PEP 440 dev versions like ``0.1.8.dev3+g4c877be4``
# so any commit is uniquely installable; tagged commits get clean
# release versions like ``0.1.8``.
dynamic = ["version"]
description = "Chat template renderers — deterministic message-to-token conversion for LLM training"
readme = "README.md"
license = "Apache-2.0"
license-files = ["LICENSE"]
requires-python = ">=3.10,<3.14"
dependencies = [
"numpy",
"openai>=1.108.1",
"tiktoken",
"jinja2",
# Used by GptOssRenderer to render and parse harmony tokens. Vendoring
# OpenAI's reference implementation keeps us byte-identical with vLLM
# (which also uses it) and saves us mirroring a 330-line Jinja template.
#
# Floor is ``>=0.0.4`` (not the latest 0.0.8) on purpose: every SGLang
# release through 0.5.12.post1 hard-pins ``openai-harmony==0.0.4``, so a
# higher floor makes ``renderers`` uninstallable alongside SGLang. The
# GptOssRenderer renders byte-identically on 0.0.4 (verified token-for-token
# against 0.0.8) and the Harmony cells in ``tests/test_parity.py`` pass,
# so the older harmony is safe.
"openai-harmony>=0.0.4",
# ``BaseRendererConfig`` inherits from ``pydantic_config.BaseConfig`` so
# the typed-config surface stays uniform with prime-rl / verifiers config
# bases. Transitively brings pydantic, which ``renderers.configs`` also
# imports directly.
"prime-pydantic-config>=0.3.0.dev83",
]
[project.optional-dependencies]
# Tokenizer loading uses Hugging Face. Text-only renderers can instead be
# constructed with a compatible BYO tokenizer and do not import this
# dependency. Character offsets are optional.
transformers = [
# Keep this floor compatible with prime-rl's transformers pin. Inkling's
# tokenizer and text-only renderer work on older releases; image/audio
# processing fails lazily with an upgrade message when InklingProcessor is
# unavailable (native support starts in transformers 5.14).
"transformers>=4.50.0",
]
# Image/audio renderers also need Pillow to resolve media inputs. Keep this as
# a separate convenience extra so tokenizer-only users do not pull it in.
multimodal = [
"pillow>=12.2.0",
"transformers>=4.50.0",
]
[tool.hatch.version]
source = "vcs"
# Tags look like ``renderers-v0.1.8`` (prefix matches the publish.yml
# release contract); strip the prefix to get a PEP 440 version. The
# regex accepts any PEP 440-valid suffix after the prefix so we can
# tag pre-releases like ``renderers-v0.2.0rc1`` later if needed.
tag-pattern = '^renderers-v(?P<version>.+)$'
# Used when building from a context without VCS metadata (e.g. an
# sdist consumed by a downstream that doesn't ship .git). Real
# builds from a checkout get the resolved version; this fallback
# only fires when the resolver has nothing to go on.
fallback-version = "0.0.0"
[tool.hatch.version.raw-options]
# Only stable ``renderers-v<MAJOR>.<MINOR>.<PATCH>`` tags participate in
# version resolution; legacy per-commit ``.devN`` tags are excluded.
# Untagged commits get a clean PEP 440 dev version derived from distance
# to the latest stable tag (e.g. ``0.1.8.dev46``), with no ``+gHASH``
# local segment so PyPI accepts the wheel directly. setuptools-scm
# refuses to bump a pre-existing ``.devN`` tag, so matching only stable
# tags also unblocks local ``uv lock`` / ``uv build`` on untagged
# branches. Mirrors verifiers' setup.
local_scheme = "no-local-version"
git_describe_command = [
"git", "describe", "--tags", "--long",
"--match", "renderers-v[0-9]*.[0-9]*.[0-9]*",
"--exclude", "*dev*",
]
[tool.hatch.build.hooks.vcs]
# Write the resolved version to a Python file so it can be inspected
# at runtime via ``renderers.__version__`` without re-parsing the
# wheel metadata.
version-file = "renderers/_version.py"
[tool.hatch.build.targets.wheel]
packages = ["renderers"]
[dependency-groups]
dev = [
"pillow>=12.2.0",
"pre-commit",
"pytest>=7.0.0",
"pytest-asyncio>=0.21.0",
"ruff",
"torch>=2.11.0",
"torchvision>=0.26.0",
"ty>=0.0.1a29,<0.0.22",
# Optional for consumers, but required by tokenizer/parity/VLM tests.
"transformers>=4.50.0",
]
[tool.uv]
# Enforce a uv version that supports the friendly-duration form
# (`"7 days"`) in the static pyproject parser. Older uvs silently parse
# the value as an RFC 3339 date, emit a TOML parse warning, and proceed
# *without* the cooldown — bypassing this security policy.
required-version = ">=0.11.1"
exclude-newer = "7 days"
[tool.uv.exclude-newer-package]
# PrimeIntellect-published packages in this project's dependency closure —
# fast-track so first-party releases can land same-day. Only packages that
# appear in `uv tree` are listed.
prime-pydantic-config = false
[tool.ty.environment]
python-version = "3.13"
[tool.ty.rules]
# Pre-existing diagnostics in v0.1.5 source — downgrade to advisory so CI
# surfaces them without blocking. Tighten back to error as we clean up.
unknown-argument = "warn"
redundant-cast = "ignore"
unresolved-import = "warn"
invalid-argument-type = "warn"
unresolved-attribute = "warn"
invalid-key = "warn"
unsupported-operator = "warn"
invalid-return-type = "warn"
invalid-assignment = "warn"