Skip to content

fix(deps): make toon_format an optional extra so uv can install current releases#325

Open
Nynir wants to merge 1 commit into
refractionPOINT:masterfrom
Nynir:fix/toon-format-optional-extra
Open

fix(deps): make toon_format an optional extra so uv can install current releases#325
Nynir wants to merge 1 commit into
refractionPOINT:masterfrom
Nynir:fix/toon-format-optional-extra

Conversation

@Nynir

@Nynir Nynir commented Jul 25, 2026

Copy link
Copy Markdown

Closes #324.

Problem

limacharlie 5.3.1+ declare a hard dependency on toon_format>=0.9.0b1,<1.0. On PyPI, toon-format has published exactly two versions — 0.1.0 and 0.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 limacharlie that 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 pip install --no-cache limacharlie
Resolved 21 packages in 424ms
 + limacharlie==5.3.0

uv tool install limacharlie and uvx limacharlie land on the same 5.3.0, and uv tool upgrade limacharlie reports "Nothing to upgrade" — so uv users have been pinned to a release predating the dependency, with no signal that anything is wrong. (The docs list uv tool install limacharlie as 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:

$ uv pip install --no-cache limacharlie==5.5.4
  × No solution found when resolving dependencies:
  ╰─▶ Because only toon-format<0.9.0b1 is available and limacharlie>=5.5.4
      depends on toon-format>=0.9.0b1, we can conclude that limacharlie>=5.5.4
      cannot be used.

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_format out of [project.dependencies] into a toon extra. The code already treats it as optional at runtime — limacharlie/output.py imports it in a try/except ImportError with a _toon_format = None fallback, the same pattern used for jmespath and tabulate — and TOON is one of six opt-in --output formats, not a default. Nothing but --output toon touches it.

With the dependency optional, uv installs the current release normally, no flags (shown here resolving a wheel built from this branch):

$ uv pip install --no-cache limacharlie
Resolved 21 packages in 305ms
 + limacharlie==5.5.5

Behavior change

A default install loses --output toon. The other five formats (json, yaml, csv, table, jsonl) are unaffected, and toon stays in the --output choice 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 --filter reports a missing jmespath:

$ limacharlie --output toon sensor list
Error: toon_format is required for --output toon. Install with: pip install 'limacharlie[toon]'
With uv: uv tool install limacharlie --with 'toon-format>=0.9.0b1'

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 a toon extra (it warns, then installs the old version anyway). Naming toon-format directly makes it a direct requirement, and uv then honours the pre-release specifier. If toon_format ever 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 in toon_format, so all existing TOON coverage runs unchanged. Added:

  • tests/unit/test_packaging.pytoon_format absent from [project.dependencies], present in the toon extra, and present in dev so CI keeps exercising the path.
  • tests/unit/test_output.py::TestFormatToonMissingExtra — with _toon_format patched to None: format_toon() and format_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.
  • TOON tests needing a real encoder are marked skipif, so pip install -e . + pytest no longer fails at collection without the extra.

Full suite, both ways:

# pip install ".[dev]" (CI's install)
3772 passed, 4 skipped

# without the toon extra
3759 passed, 17 skipped

Also verified against a built wheel: fresh venv, uv pip install <wheel> with no pre-release flags succeeds and does not pull toon-format; limacharlie --version works; --output toon gives 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). With toon_format optional, that workaround becomes unnecessary for future releases — and its noted trade-off (that --prerelease=allow could also admit a pre-release of limacharlie itself) goes away.

…nt releases

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

uv installs silently resolve to 5.3.0 because newer releases depend on pre-release-only toon_format

1 participant