@@ -44,41 +44,36 @@ cd ./rick-portal-gun
4444
4545## Dependencies and environment
4646
47- Add ` typer[all] ` to your dependencies:
47+ Add ` typer ` to your dependencies:
4848
4949<div class =" termy " >
5050
5151``` console
52- $ poetry add " typer[all] "
52+ $ poetry add typer
5353
5454// It creates a virtual environment for your project
5555Creating virtualenv rick-portal-gun-w31dJa0b-py3.10 in /home/rick/.cache/pypoetry/virtualenvs
56- Using version ^0.1 .0 for typer
56+ Using version ^0.12 .0 for typer
5757
5858Updating dependencies
5959Resolving dependencies... (1.2s)
6060
61- Writing lock file
62-
6361---> 100%
6462
65- Package operations: 15 installs, 0 updates, 0 removals
66-
67- - Installing zipp (3.1.0)
68- - Installing importlib-metadata (1.5.0)
69- - Installing pyparsing (2.4.6)
70- - Installing six (1.14.0)
71- - Installing attrs (19.3.0)
72- - Installing click (7.1.1)
73- - Installing colorama (0.4.3)
74- - Installing more-itertools (8.2.0)
75- - Installing packaging (20.3)
76- - Installing pluggy (0.13.1)
77- - Installing py (1.8.1)
78- - Installing shellingham (1.3.2)
79- - Installing wcwidth (0.1.8)
80- - Installing pytest (5.4.1)
81- - Installing typer (0.0.11)
63+ Package operations: 10 installs, 0 updates, 0 removals
64+
65+ - Installing mdurl (0.1.2)
66+ - Installing markdown-it-py (3.0.0)
67+ - Installing pygments (2.17.2)
68+ - Installing click (8.1.7)
69+ - Installing rich (13.7.1)
70+ - Installing shellingham (1.5.4)
71+ - Installing typing-extensions (4.10.0)
72+ - Installing typer-slim (0.12.0)
73+ - Installing typer-cli (0.12.0)
74+ - Installing typer (0.12.0)
75+
76+ Writing lock file
8277
8378// Activate that new virtual environment
8479$ poetry shell
@@ -101,8 +96,7 @@ You can see that you have a generated project structure that looks like:
10196├── rick_portal_gun
10297│ └── __init__.py
10398└── tests
104- ├── __init__.py
105- └── test_rick_portal_gun.py
99+ └── __init__.py
106100```
107101
108102## Create your app
@@ -175,14 +169,11 @@ rick-portal-gun = "rick_portal_gun.main:app"
175169
176170[tool .poetry .dependencies ]
177171python = " ^3.10"
178- typer = {extras = [" all" ], version = " ^0.1.0" }
179-
180- [tool .poetry .dev-dependencies ]
181- pytest = " ^5.2"
172+ typer = " ^0.12.0"
182173
183174[build-system ]
184- requires = [" poetry>=0.12 " ]
185- build-backend = " poetry.masonry.api"
175+ requires = [" poetry-core " ]
176+ build-backend = " poetry.core. masonry.api"
186177```
187178
188179Here's what that line means:
@@ -231,7 +222,7 @@ Installing dependencies from lock file
231222
232223No dependencies to install or update
233224
234- - Installing rick-portal-gun (0.1.0)
225+ - Installing the current project: rick-portal-gun (0.1.0)
235226```
236227
237228</div >
@@ -250,7 +241,7 @@ $ which rick-portal-gun
250241/home/rick/.cache/pypoetry/virtualenvs/rick-portal-gun-w31dJa0b-py3.10/bin/rick-portal-gun
251242
252243// Try it
253- $ rick-portal-gun
244+ $ rick-portal-gun --help
254245
255246// You get all the standard help
256247Usage: rick-portal-gun [OPTIONS] COMMAND [ARGS]...
@@ -284,7 +275,6 @@ $ poetry build
284275Building rick-portal-gun (0.1.0)
285276 - Building sdist
286277 - Built rick-portal-gun-0.1.0.tar.gz
287-
288278 - Building wheel
289279 - Built rick_portal_gun-0.1.0-py3-none-any.whl
290280```
@@ -312,7 +302,7 @@ Now you can open another terminal and install that package from the file for you
312302<div class =" termy " >
313303
314304``` console
315- $ pip install --user /home/rock/code /rick-portal-gun/dist/rick_portal_gun-0.1.0-py3-none-any.whl
305+ $ pip install --user /home/rick /rick-portal-gun/dist/rick_portal_gun-0.1.0-py3-none-any.whl
316306
317307---> 100%
318308```
@@ -347,7 +337,7 @@ Having it installed globally (and not in a single environment), you can now inst
347337``` console
348338$ rick-portal-gun --install-completion
349339
350- zsh completion installed in /home/user /.zshrc.
340+ zsh completion installed in /home/rick /.zshrc.
351341Completion will take effect once you restart the terminal.
352342```
353343
@@ -419,8 +409,7 @@ The file would live right beside `__init__.py`:
419409│ ├── __main__.py
420410│ └── main.py
421411└── tests
422- ├── __init__.py
423- └── test_rick_portal_gun.py
412+ └── __init__.py
424413```
425414
426415No other file has to import it, you don't have to reference it in your ` pyproject.toml ` or anything else, it just works by default, as it is standard Python behavior.
@@ -437,7 +426,7 @@ Now, after installing your package, if you call it with `python -m` it will work
437426<div class =" termy " >
438427
439428``` console
440- $ python -m rick_portal_gun
429+ $ python -m rick_portal_gun --help
441430
442431Usage: __main__.py [OPTIONS] COMMAND [ARGS]...
443432
@@ -487,7 +476,7 @@ app(prog_name="rick-portal-gun")
487476<div class =" termy " >
488477
489478``` console
490- $ python -m rick_portal_gun
479+ $ python -m rick_portal_gun --help
491480
492481Usage: rick-portal-gun [OPTIONS] COMMAND [ARGS]...
493482
@@ -577,7 +566,6 @@ $ poetry publish --build
577566Building rick-portal-gun (0.1.0)
578567 - Building sdist
579568 - Built rick-portal-gun-0.1.0.tar.gz
580-
581569 - Building wheel
582570 - Built rick_portal_gun-0.1.0-py3-none-any.whl
583571
@@ -604,9 +592,9 @@ $ pip uninstall rick-portal-gun
604592Found existing installation: rick-portal-gun 0.1.0
605593Uninstalling rick-portal-gun-0.1.0:
606594 Would remove:
607- /home/user /.local/bin/rick-portal-gun
608- /home/user /.local/lib/python3.10/site-packages/rick_portal_gun-0.1.0.dist-info/*
609- /home/user /.local/lib/python3.10/site-packages/rick_portal_gun/*
595+ /home/rick /.local/bin/rick-portal-gun
596+ /home/rick /.local/lib/python3.10/site-packages/rick_portal_gun-0.1.0.dist-info/*
597+ /home/rick /.local/lib/python3.10/site-packages/rick_portal_gun/*
610598# Proceed (y/n)? $ y
611599 Successfully uninstalled rick-portal-gun-0.1.0
612600```
@@ -622,11 +610,18 @@ $ pip install --user rick-portal-gun
622610
623611// Notice that it says "Downloading" 🚀
624612Collecting rick-portal-gun
625- Downloading rick_portal_gun-0.1.0-py3-none-any.whl (1.8 kB)
626- Requirement already satisfied: typer[all]<0.0.12,>=0.0.11 in ./.local/lib/python3.10/site-packages (from rick-portal-gun) (0.0.11)
627- Requirement already satisfied: click<7.2.0,>=7.1.1 in ./anaconda3/lib/python3.10/site-packages (from typer[all]<0.0.12,>=0.0.11->rick-portal-gun) (7.1.1)
628- Requirement already satisfied: colorama; extra == "all" in ./anaconda3/lib/python3.10/site-packages (from typer[all]<0.0.12,>=0.0.11->rick-portal-gun) (0.4.3)
629- Requirement already satisfied: shellingham; extra == "all" in ./anaconda3/lib/python3.10/site-packages (from typer[all]<0.0.12,>=0.0.11->rick-portal-gun) (1.3.1)
613+ Downloading rick_portal_gun-0.1.0-py3-none-any.whl.metadata (435 bytes)
614+ Requirement already satisfied: typer<0.13.0,>=0.12.0 in ./.local/lib/python3.10/site-packages (from rick-portal-gun==0.1.0) (0.12.0)
615+ Requirement already satisfied: typer-cli==0.12.0 in ./.local/lib/python3.10/site-packages (from typer<0.13.0,>=0.12.0->rick-portal-gun==0.1.0) (0.12.0)
616+ Requirement already satisfied: typer-slim[standard]==0.12.0 in ./.local/lib/python3.10/site-packages (from typer<0.13.0,>=0.12.0->rick-portal-gun==0.1.0) (0.12.0)
617+ Requirement already satisfied: typing-extensions>=3.7.4.3 in ./.local/lib/python3.10/site-packages (from typer-slim[standard]==0.12.0->typer<0.13.0,>=0.12.0->rick-portal-gun==0.1.0) (4.10.0)
618+ Requirement already satisfied: click>=8.0.0 in ./.local/lib/python3.10/site-packages (from typer-slim[standard]==0.12.0->typer<0.13.0,>=0.12.0->rick-portal-gun==0.1.0) (8.1.7)
619+ Requirement already satisfied: shellingham>=1.3.0 in ./.local/lib/python3.10/site-packages (from typer-slim[standard]==0.12.0->typer<0.13.0,>=0.12.0->rick-portal-gun==0.1.0) (1.5.4)
620+ Requirement already satisfied: rich>=10.11.0 in ./.local/lib/python3.10/site-packages (from typer-slim[standard]==0.12.0->typer<0.13.0,>=0.12.0->rick-portal-gun==0.1.0) (13.7.1)
621+ Requirement already satisfied: pygments<3.0.0,>=2.13.0 in ./.local/lib/python3.10/site-packages (from rich>=10.11.0->typer-slim[standard]==0.12.0->typer<0.13.0,>=0.12.0->rick-portal-gun==0.1.0) (2.17.2)
622+ Requirement already satisfied: markdown-it-py>=2.2.0 in ./.local/lib/python3.10/site-packages (from rich>=10.11.0->typer-slim[standard]==0.12.0->typer<0.13.0,>=0.12.0->rick-portal-gun==0.1.0) (3.0.0)
623+ Requirement already satisfied: mdurl~=0.1 in ./.local/lib/python3.10/site-packages (from markdown-it-py>=2.2.0->rich>=10.11.0->typer-slim[standard]==0.12.0->typer<0.13.0,>=0.12.0->rick-portal-gun==0.1.0) (0.1.2)
624+ Downloading rick_portal_gun-0.1.0-py3-none-any.whl (1.8 kB)
630625Installing collected packages: rick-portal-gun
631626Successfully installed rick-portal-gun-0.1.0
632627```
@@ -686,14 +681,11 @@ rick-portal-gun = "rick_portal_gun.main:app"
686681
687682[tool .poetry .dependencies ]
688683python = " ^3.10"
689- typer = {extras = [" all" ], version = " ^0.1.0" }
690-
691- [tool .poetry .dev-dependencies ]
692- pytest = " ^5.2"
684+ typer = " ^0.12.0"
693685
694686[build-system ]
695- requires = [" poetry>=0.12 " ]
696- build-backend = " poetry.masonry.api"
687+ requires = [" poetry-core " ]
688+ build-backend = " poetry.core. masonry.api"
697689```
698690
699691And in the file ` rick_portal_gun/__init__.py ` :
@@ -714,7 +706,6 @@ $ poetry publish --build
714706Building rick-portal-gun (0.2.0)
715707 - Building sdist
716708 - Built rick-portal-gun-0.2.0.tar.gz
717-
718709 - Building wheel
719710 - Built rick_portal_gun-0.2.0-py3-none-any.whl
720711
0 commit comments