Skip to content
This repository has been archived by the owner on Apr 6, 2024. It is now read-only.

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 #50

Closed
stratosgear opened this issue Aug 31, 2021 · 18 comments

Comments

@stratosgear
Copy link

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
@musicinmybrain
Copy link

musicinmybrain commented Aug 31, 2021

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 (tiangolo/typer@b972981).

@ssbarnea
Copy link
Sponsor

Basically anyone that happened to used typer-cli is creating weaves of incompatibilities with click, which reached v8 long time ago, likely 9 soon.

Luckly typer was updated but not typer-cli.

@lucinvitae
Copy link

Our team recently had to upgrade to typer 0.4.1 in order to fix tiangolo/typer#377 and are now waiting for this issue to be fixed. It would be great to have this issue resolved so that we can continue to auto-generate our typer CLI docs. Adding this comment in order to link the two issues in case others arrive here via the same issue.

@dazza-codes
Copy link

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.

@usrme
Copy link

usrme commented Jul 7, 2022

@tiangolo, this still persists even after releasing 0.5.0 of Typer: https://github.com/tiangolo/typer/releases/tag/0.5.0. Any comments? 🤔

@jony89
Copy link

jony89 commented Jul 27, 2022

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 ?

@danielgafni
Copy link

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

@ghost
Copy link

ghost commented Aug 10, 2022

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

@danielgafni
Copy link

I’ll try to get the other contributors attention…

@juanmapf97 @ovezovs 🙏

@mpurdon
Copy link

mpurdon commented Sep 20, 2022

+1 Still an ongoing issue after typer 0.6

@miska-ship-it
Copy link

Still an issue here too, all I want from typer-cli is autocomplete so I'll gladly take suggestions.

@kurtabersold
Copy link

$ poetry add typer typer-cli
Using version ^0.6.1 for typer
Using version ^0.0.12 for typer-cli

Updating dependencies
Resolving dependencies... (0.0s)

Because typer-cli (0.0.12) depends on typer (>=0.3.0,<0.4.0)
 and no versions of typer-cli match >0.0.12,<0.0.13, typer-cli (>=0.0.12,<0.0.13) requires typer (>=0.3.0,<0.4.0).
So, because testapp depends on both typer (^0.6.1) and typer-cli (^0.0.12), version solving failed.

@lambda-science
Copy link

Yep same issue, I wanted to use Typer-CLI to generate documentation :)

@lambda-science
Copy link

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

@maxb2
Copy link

maxb2 commented Nov 19, 2022

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

#67 (comment)

Patarimi added a commit to Patarimi/pyWAS that referenced this issue Jan 13, 2023
waiting for tiangolo/typer-cli#50 to be solved.
change the em solver for gds support
@tiangolo
Copy link
Owner

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.

@github-actions
Copy link

Assuming the original need was handled, this will be automatically closed now. But feel free to add more comments or create new issues or PRs.

@darioprencipe
Copy link

darioprencipe commented Sep 8, 2023

@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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.