Skip to content
Myr

📝 Update package docs with the latest versions of Typer and Poetry (#781)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Kinuax · committed by GitHub · parent a1e80f3 · Browse files · 1 file+42 added−55 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: svlandeg <svlandeg@github.com>

Diff stats

1 file+42 added−55 removed

  • other:+42 added−55 removed

1 file+42 added−55 removed

modified:docs/tutorial/package.md+42 added-55 removed
47 unmodified lines
48</div>4950## Dependencies and environment5152Add `typer[all]` to your dependencies:52Add `typer` to your dependencies:5354<div class="termy">5556```console57$ poetry add "typer[all]"57$ poetry add typer5859// It creates a virtual environment for your project60Creating virtualenv rick-portal-gun-w31dJa0b-py3.10 in /home/rick/.cache/pypoetry/virtualenvs61Using version ^0.1.0 for typer61Using version ^0.12.0 for typer6263Updating dependencies64Resolving dependencies... (1.2s)6566Writing lock file6766---> 100%6770Package operations: 15 installs, 0 updates, 0 removals68Package operations: 8 installs, 0 updates, 0 removals6972 - Installing zipp (3.1.0)73 - Installing importlib-metadata (1.5.0)74 - Installing pyparsing (2.4.6)75 - Installing six (1.14.0)76 - Installing attrs (19.3.0)77 - Installing click (7.1.1)78 - Installing colorama (0.4.3)79 - Installing more-itertools (8.2.0)80 - Installing packaging (20.3)81 - Installing pluggy (0.13.1)82 - Installing py (1.8.1)83 - Installing shellingham (1.3.2)84 - Installing wcwidth (0.1.8)85 - Installing pytest (5.4.1)86 - Installing typer (0.0.11)70 - Installing mdurl (0.1.2)71 - Installing markdown-it-py (3.0.0)72 - Installing pygments (2.17.2)73 - Installing click (8.1.7)74 - Installing rich (13.7.1)75 - Installing shellingham (1.5.4)76 - Installing typing-extensions (4.11.0)77 - Installing typer (0.12.3)7879Writing lock file8081// Activate that new virtual environment82$ poetry shell8384Spawning shell within /home/rick/.cache/pypoetry/virtualenvs/rick-portal-gun-w31dJa0b-py3.10
13 unmodified lines
98├── README.md99├── rick_portal_gun100│   └── __init__.py101└── tests109 ├── __init__.py110 └── test_rick_portal_gun.py102 └── __init__.py103```104105## Create your app106
67 unmodified lines
174rick-portal-gun = "rick_portal_gun.main:app"175176[tool.poetry.dependencies]177python = "^3.10"186typer = {extras = ["all"], version = "^0.1.0"}178typer = "^0.12.0"179188[tool.poetry.dev-dependencies]189pytest = "^5.2"190180[build-system]192requires = ["poetry>=0.12"]193build-backend = "poetry.masonry.api"181requires = ["poetry-core"]182build-backend = "poetry.core.masonry.api"183```184185Here's what that line means:186
40 unmodified lines
227Installing dependencies from lock file228229No dependencies to install or update230242 - Installing rick-portal-gun (0.1.0)231 - Installing the current project: rick-portal-gun (0.1.0)232```233234</div>235
10 unmodified lines
246// You get the one from your environment247/home/rick/.cache/pypoetry/virtualenvs/rick-portal-gun-w31dJa0b-py3.10/bin/rick-portal-gun248249// Try it261$ rick-portal-gun250$ rick-portal-gun --help251252// You get all the standard help253Usage: rick-portal-gun [OPTIONS] COMMAND [ARGS]...254
25 unmodified lines
280281Building rick-portal-gun (0.1.0)282 - Building sdist283 - Built rick-portal-gun-0.1.0.tar.gz295284 - Building wheel285 - Built rick_portal_gun-0.1.0-py3-none-any.whl286```287
19 unmodified lines
307308<div class="termy">309310```console323$ pip install --user /home/rock/code/rick-portal-gun/dist/rick_portal_gun-0.1.0-py3-none-any.whl311$ pip install --user /home/rick/rick-portal-gun/dist/rick_portal_gun-0.1.0-py3-none-any.whl312313---> 100%314```315
32 unmodified lines
348349```console350$ rick-portal-gun --install-completion351364zsh completion installed in /home/user/.zshrc.352zsh completion installed in /home/rick/.zshrc.353Completion will take effect once you restart the terminal.354```355356</div>
69 unmodified lines
426│ ├── __init__.py427│ ├── __main__.py428│ └── main.py429└── tests442 ├── __init__.py443 └── test_rick_portal_gun.py430 └── __init__.py431```432433No 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.434
8 unmodified lines
443444<div class="termy">445446```console460$ python -m rick_portal_gun447$ python -m rick_portal_gun --help448449Usage: __main__.py [OPTIONS] COMMAND [ARGS]...450451 Awesome Portal Gun
47 unmodified lines
499500<div class="termy">501502```console516$ python -m rick_portal_gun503$ python -m rick_portal_gun --help504505Usage: rick-portal-gun [OPTIONS] COMMAND [ARGS]...506507 Awesome Portal Gun
81 unmodified lines
589590Building rick-portal-gun (0.1.0)591 - Building sdist592 - Built rick-portal-gun-0.1.0.tar.gz606593 - Building wheel594 - Built rick_portal_gun-0.1.0-py3-none-any.whl595596Publishing rick-portal-gun (0.1.0) to PyPI
18 unmodified lines
615616Found existing installation: rick-portal-gun 0.1.0617Uninstalling rick-portal-gun-0.1.0:618 Would remove:633 /home/user/.local/bin/rick-portal-gun634 /home/user/.local/lib/python3.10/site-packages/rick_portal_gun-0.1.0.dist-info/*635 /home/user/.local/lib/python3.10/site-packages/rick_portal_gun/*636# Proceed (y/n)? $ y619 /home/rick/.local/bin/rick-portal-gun620 /home/rick/.local/lib/python3.10/site-packages/rick_portal_gun-0.1.0.dist-info/*621 /home/rick/.local/lib/python3.10/site-packages/rick_portal_gun/*622# Proceed (Y/n)? $ Y623 Successfully uninstalled rick-portal-gun-0.1.0624```625626</div>
6 unmodified lines
633$ pip install --user rick-portal-gun634635// Notice that it says "Downloading" 🚀636Collecting rick-portal-gun651 Downloading rick_portal_gun-0.1.0-py3-none-any.whl (1.8 kB)652Requirement already satisfied: typer[all]<0.0.12,>=0.0.11 in ./.local/lib/python3.10/site-packages (from rick-portal-gun) (0.0.11)653Requirement 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)654Requirement 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)655Requirement 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)637 Downloading rick_portal_gun-0.1.0-py3-none-any.whl.metadata (435 bytes)638Requirement already satisfied: typer<0.13.0,>=0.12.3 in ./.local/lib/python3.10/site-packages (from rick-portal-gun==0.1.0) (0.12.3)639Requirement already satisfied: typing-extensions>=3.7.4.3 in ./.local/lib/python3.10/site-packages (from typer<0.13.0,>=0.12.3->rick-portal-gun==0.1.0) (4.11.0)640Requirement already satisfied: click>=8.0.0 in ./.local/lib/python3.10/site-packages (from typer<0.13.0,>=0.12.3->rick-portal-gun==0.1.0) (8.1.7)641Requirement already satisfied: shellingham>=1.3.0 in ./.local/lib/python3.10/site-packages (from typer<0.13.0,>=0.12.3->rick-portal-gun==0.1.0) (1.5.4)642Requirement already satisfied: rich>=10.11.0 in ./.local/lib/python3.10/site-packages (from typer<0.13.0,>=0.12.3->rick-portal-gun==0.1.0) (13.7.1)643Requirement already satisfied: pygments<3.0.0,>=2.13.0 in ./.local/lib/python3.10/site-packages (from rich>=10.11.0->typer<0.13.0,>=0.12.3->rick-portal-gun==0.1.0) (2.17.2)644Requirement already satisfied: markdown-it-py>=2.2.0 in ./.local/lib/python3.10/site-packages (from rich>=10.11.0->typer<0.13.0,>=0.12.3->rick-portal-gun==0.1.0) (3.0.0)645Requirement already satisfied: mdurl~=0.1 in ./.local/lib/python3.10/site-packages (from markdown-it-py>=2.2.0->rich>=10.11.0->typer<0.13.0,>=0.12.3->rick-portal-gun==0.1.0) (0.1.2)646Downloading rick_portal_gun-0.1.0-py3-none-any.whl (1.8 kB)647Installing collected packages: rick-portal-gun648Successfully installed rick-portal-gun-0.1.0649```650
54 unmodified lines
705rick-portal-gun = "rick_portal_gun.main:app"706707[tool.poetry.dependencies]708python = "^3.10"718typer = {extras = ["all"], version = "^0.1.0"}709typer = "^0.12.0"710720[tool.poetry.dev-dependencies]721pytest = "^5.2"722711[build-system]724requires = ["poetry>=0.12"]725build-backend = "poetry.masonry.api"712requires = ["poetry-core"]713build-backend = "poetry.core.masonry.api"714```715716And in the file `rick_portal_gun/__init__.py`:717
12 unmodified lines
730731Building rick-portal-gun (0.2.0)732 - Building sdist733 - Built rick-portal-gun-0.2.0.tar.gz746734 - Building wheel735 - Built rick_portal_gun-0.2.0-py3-none-any.whl736737Publishing rick-portal-gun (0.2.0) to PyPI
25 unmodified lines