typer-cli: Typer-cli (0.0.12) depends on typer (>=0.3.0,<0.4.0), so typer 0.4.0 AND typer-cli 0.0.12 are incompatible

I get this when I poetry update on my system:

$ poetry update
Updating dependencies
Resolving dependencies... (0.0s)

  SolverProblemError

  Because typer-cli (0.0.12) depends on typer (>=0.3.0,<0.4.0)
   and cb depends on typer (0.4.0), typer-cli is forbidden.
  So, because cb depends on typer-cli (0.0.12), version solving failed.

  at ~/.poetry/lib/poetry/puzzle/solver.py:241 in _solve
      237│             packages = result.packages
      238│         except OverrideNeeded as e:
      239│             return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
      240│         except SolveFailure as e:
    → 241│             raise SolverProblemError(e)
      242│ 
      243│         results = dict(
      244│             depth_first_search(
      245│                 PackageNode(self._package, packages), aggregate_package_nodes

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 40
  • Comments: 18 (1 by maintainers)

Commits related to this issue

Most upvoted comments

+1 @tiangolo it would be great to get a fix for this! 🙏

ATM I can’t install typer-cli within my typer project. When installing typer-cli globally, leaving alone the dependencies issues, it’s not possible to generate docs.

@tiangolo ?

+1 Still an ongoing issue after typer 0.6

Thanks for the discussion, everyone! ☕ This should be solved by Typer-CLI 0.0.13, just released. 🎉

Sorry for the long delay! 🙈 I wanted to personally address each issue/PR and they piled up through time, but now I’m checking each one in order.

I’ll try to get the other contributors attention…

@juanmapf97 @ovezovs 🙏

This is just a note that simply changing the version specification in pyproject.toml will not completely solve the problem.

There is an implicit dependency on click 7.x, which is satisfied because it is also a dependency of typer 0.3.x: typer_cli/main.py imports click._bashcomplete.get_choices and click._bashcomplete.resolve_ctx. It also monkey-patches click._bashcomplete.get_choices.

This part will have to be rewritten in typer-cli to support click 8.x as was done for typer (https://github.com/tiangolo/typer/commit/b97298181bd2a932be70ba417b9a712294fa327c).

@tiangolo Hey there! 😃 Still having issue with installing typer and typer-cli with poetry.

This is how my current pyproject.toml looks like:

[tool.poetry] name = “cumana” version = “0.1.0” description = “” authors = [“dpren90 dario@sibill.it”] readme = “README.md”

[tool.poetry.dependencies] python = “^3.11” spacy = “^3.6.1” it-core-news-lg = {url = “https://github.com/explosion/spacy-models/releases/download/it_core_news_lg-3.6.0/it_core_news_lg-3.6.0.tar.gz”} fastapi = “^0.103.1” uvicorn = “^0.23.2” typer = {extras = [“all”], version = “^0.9.0”} pandas = “^2.1.0” pydantic = “^2.3.0”

[tool.poetry.group.dev.dependencies] pytest = “^7.4.2” black = “^23.7.0” mypy = “^1.5.1”

[build-system] requires = [“poetry-core”] build-backend = “poetry.core.masonry.api”

Still - when running poetry add typer-cli, I get the following:

Updating dependencies Resolving dependencies… (0.0s)

Because no versions of typer-cli match >0.0.13,<0.0.14 and typer-cli (0.0.13) depends on typer (>=0.4.0,<=0.7.0), typer-cli (>=0.0.13,<0.0.14) requires typer (>=0.4.0,<=0.7.0). And because typer (0.9.0) depends on typer (0.9.0) and no versions of typer match >0.9.0,<0.10.0, typer-cli (>=0.0.13,<0.0.14) is incompatible with typer (>=0.9.0,<0.10.0). So, because cumana depends on both typer (^0.9.0) and typer-cli (^0.0.13), version solving failed.

Any ide why this could fail? Even poetry add typer-cli@latest doesn’t make the trick.

(Would anyone know how to generate automatic CLI doc for arg and option without Typer-CLI ? eyes)

https://github.com/tiangolo/typer-cli/pull/67#issuecomment-1271983950

Hi @tiangolo ! I have the same issue. typer-cli can’t be installed with an up to date typer version.

TL;DR - don’t try this

A project can run into this problem if it depends on both typer (project libs) and typer-cli (dev libs). One possibility to avoid this conflict is to use the pipx project to install typer-cli as a global utility that is independent of the project dependency tree. This might avoid “contaminating” the project virtual env with too many utility libraries that all have their own dependency tree issues. (This approach also works well for poetry installations.)

$ pipx install typer-cli
  installed package typer-cli 0.0.12, installed using Python 3.8.10
  These apps are now globally available
    - typer
done! ✨ 🌟 ✨

Of course, this makes the project less portable. There are trade-offs to consider for this approach, esp. if any CI/CD systems also depend on the typer-cli as a dev lib.

Also, as I discovered, after a poetry remove -D typer-cli and then using typer to build CLI docs, this approach does not work great. The problem is that typer will import the CLI modules in order to build the CLI docs. When it does so, using a global pipx installation, it is failing to import project libs from the project venv.