Skip to content

Switch dependency back from typer-slim to typer#13922

Open
svlandeg wants to merge 2 commits intoexplosion:masterfrom
svlandeg:drop/typer-slim
Open

Switch dependency back from typer-slim to typer#13922
svlandeg wants to merge 2 commits intoexplosion:masterfrom
svlandeg:drop/typer-slim

Conversation

@svlandeg
Copy link
Contributor

Hi, long time no see! 😀
Here with my Typer-maintainer-hat on.

Description

Recently, spaCy switched from using typer to typer-slim. We used to offer typer-slim as a more light-weight package, which didn't depend on rich and shellingham. Unfortuntately, the way it was set up meant that we ran into issues with package managers (e.g. fastapi/typer#1503). We ran a user survey and eventually decided to drop support for typer-slim altogether (since 0.22.0). Going forward, it's better to just use typer as dependency.

What this means for this repo:

  • shellingham and rich will be added as indirect requirement, adding about 12MB extra.
  • With rich present in the environment, any Typer app will automatically set rich_markup_mode to "rich" by default (it was None when Rich wasn't installed). This can be overwritten when creating a Typer() app by setting rich_markup_mode to None. Alternatively, since Typer 0.22.0 there is a new env var TYPER_USE_RICH that you can set to False to disable Rich entirely everywhere and always. I've gone ahead and went for the first option by setting rich_markup_mode=None in the main app. Personally, I do like the Rich formatting better, so you can pick which you like most as spaCy has had different behaviour in the past anyway (before PR Switch to typer-slim #13759 it would be formatted with Rich).

I'll submit a PR to weasel as well.

Let me know if there's any concerns/questions!

Types of change

External dependency change

Checklist

  • I confirm that I have the right to submit this contribution under the project's MIT license.
  • I ran the tests, and all new and existing tests passed.
  • My changes don't require a change to the documentation, or if they do, I've added all required information.

@honnibal
Copy link
Member

honnibal commented Mar 2, 2026

Hey sorry for missing this before! I do prefer the non-rich output, and I haven't been doing much LLM-powered spaCy stuff but I think the less verbose output is probably better there too.

@svlandeg
Copy link
Contributor Author

svlandeg commented Mar 2, 2026

Hey Matt! Gotcha, but if you keep things as is you will in fact pull in Rich-formatted output. From typer-slim version 0.22.0 onwards, it's really just a wrapper around Typer and will install everything, including Rich. That's why I PR'd this and disabled Rich explicitely in the Typer constructor, so you would keep the same behaviour as before 😉 Let me know if you have questions!

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.

2 participants