fix(deps): make toon_format an optional extra so uv can install current releases#325
Open
Nynir wants to merge 1 commit into
Open
fix(deps): make toon_format an optional extra so uv can install current releases#325Nynir wants to merge 1 commit into
Nynir wants to merge 1 commit into
Conversation
…nt releases Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #324.
Problem
limacharlie5.3.1+ declare a hard dependency ontoon_format>=0.9.0b1,<1.0. On PyPI,toon-formathas published exactly two versions —0.1.0and0.9.0b1— so no stable release satisfies that range.pip honours the pre-release specifier and installs 5.5.4 without complaint. uv does not: it accepts pre-releases only for requirements named directly, never for transitive ones. Faced with a
limacharliethat needs a pre-release it will not take, uv backtracks to the newest release that does not — 5.3.0.The failure is silent. No error, no warning:
uv tool install limacharlieanduvx limacharlieland on the same 5.3.0, anduv tool upgrade limacharliereports "Nothing to upgrade" — so uv users have been pinned to a release predating the dependency, with no signal that anything is wrong. (The docs listuv tool install limacharlieas a supported installation method, so this is a documented path: https://docs.limacharlie.io/6-developer-guide/mcp-server/#installation.) Asking for the version explicitly is the only way to surface the real error:Pinning the requirement to the exact pre-release (
toon_format==0.9.0b1) would not fix this — uv's rule is about direct vs. transitive requirements, not about the shape of the specifier.Fix
Move
toon_formatout of[project.dependencies]into atoonextra. The code already treats it as optional at runtime —limacharlie/output.pyimports it in atry/except ImportErrorwith a_toon_format = Nonefallback, the same pattern used forjmespathandtabulate— and TOON is one of six opt-in--outputformats, not a default. Nothing but--output toontouches it.With the dependency optional, uv installs the current release normally, no flags (shown here resolving a wheel built from this branch):
Behavior change
A default install loses
--output toon. The other five formats (json,yaml,csv,table,jsonl) are unaffected, andtoonstays in the--outputchoice list so it still validates and tab-completes.Requesting TOON without the encoder exits 1 with a message naming both install forms — no traceback, matching how
--filterreports a missingjmespath:The uv-specific form is deliberate.
uv pip install 'limacharlie[toon]'does not work either — the extra's requirement is still transitive, so uv applies the same rule and quietly falls back to 5.3.0, which does not even have atoonextra (it warns, then installs the old version anyway). Namingtoon-formatdirectly makes it a direct requirement, and uv then honours the pre-release specifier. Iftoon_formatever ships a stable release in range, both forms collapse into the obvious one and the extra keeps working unchanged.Tests
CI installs
[dev], and[dev]now pulls intoon_format, so all existing TOON coverage runs unchanged. Added:tests/unit/test_packaging.py—toon_formatabsent from[project.dependencies], present in thetoonextra, and present indevso CI keeps exercising the path.tests/unit/test_output.py::TestFormatToonMissingExtra— with_toon_formatpatched toNone:format_toon()andformat_output(fmt="toon")both name the extra, the message carries the uv form, the CLI exits 1 without a traceback, and the other formats keep working.skipif, sopip install -e .+pytestno longer fails at collection without the extra.Full suite, both ways:
Also verified against a built wheel: fresh venv,
uv pip install <wheel>with no pre-release flags succeeds and does not pulltoon-format;limacharlie --versionworks;--output toongives the friendly error; adding the encoder restores TOON output.Related
refractionPOINT/lc-ai#112 works around this same resolution failure in the lc-essentials plugin's CLI auto-installer (
--prerelease=allow+ a 5.4.0 floor). Withtoon_formatoptional, that workaround becomes unnecessary for future releases — and its noted trade-off (that--prerelease=allowcould also admit a pre-release oflimacharlieitself) goes away.