tiangolo/typer

๐Ÿ› Upgrading from `typer<0.12.0` to `typer==0.12.0` breaks the install by partially removing the package/module files

tiangolo opened this issue ยท 4 comments

This is reproduced and being worked on right now. ๐Ÿค“

Discussed in #784

Originally posted by brianmedigate March 31, 2024

First Check

  • I added a very descriptive title here.
  • I used the GitHub search to find a similar question and didn't find it.
  • I searched the Typer documentation, with the integrated search.
  • I already searched in Google "How to X in Typer" and didn't find any information.
  • I already read and followed all the tutorial in the docs and didn't find an answer.
  • I already checked if it is not related to Typer but to Click.

Commit to Help

  • I commit to help with one of those options ๐Ÿ‘†

Example Code

$ python3.8 -m virtualenv venv
$ . venv/bin/activate
$ pip install typer==0.9.0
$ pip install typer==0.12.0
$ ll venv/lib/python3.8/site-packages/typer/
total 36
drwxrwxr-x  3 brianm brianm 4096 Mar 31 17:52 ./
drwxrwxr-x 28 brianm brianm 4096 Mar 31 17:52 ../
-rw-rw-r--  1 brianm brianm 9149 Mar 31 17:52 cli.py
-rw-rw-r--  1 brianm brianm 6689 Mar 31 17:52 _completion_classes.py
-rw-rw-r--  1 brianm brianm   30 Mar 31 17:52 __main__.py
drwxrwxr-x  2 brianm brianm 4096 Mar 31 17:52 __pycache__/

Description

After upgrading typer 0.9.0 to 0.12.0 in an existing virtual environment, the typer directory in site packages doesn't contain the expected code of typer. It looks like it only contains typer-cli or something like that. I'm guessing it has something to do with the recent packaging changes in #780.

Operating System

Linux

Operating System Details

Ubuntu 22.04.3

Typer Version

0.12.0

Python Version

3.8.18

Additional Context

No response

Minor typo in the title: should be typer<0.12.0 ๐Ÿ˜„

Yes - I ran into this problem here: bckohan/django-typer#47

I think its a bug in pip. I would expect this to work.

In my case, since my downstream users did not need the cli, changing the dependency from typer to typer-slim allowed the updates to work. I tested this using normal pip upgrades and poetry updates

This was fixed in #791, released in Typer 0.12.1 ๐Ÿš€ ๐ŸŽ‰

Is this really solved?

$ pip3 list | grep typer
typer                    0.12.1
$ python3
Python 3.11.6 (main, Nov 30 2023, 18:14:11) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import typer
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'typer'

I have typer installed via pipenv as a dependency of safety.