serhii.net

In the middle of the desert you can say anything you want

11 Dec 2023

poetry running scripts after building python package

Was looking for a way to do this but it’s part of the batteries included: Pluralsight Tech Blog | Python CLI Utilities with Poetry and Typer

If you define run points in the pyproject.toml

[tool.poetry.scripts]
up_get_uris = "up_crawler.get_uris:main"
up_crawl_uris = "up_crawler.bs_oop:main"
up_run = "up_crawler.__main__:main"
up_convert = "up_crawler.up_reader:main"

Then once you install the package you built with poetry build elsewhere, these commands will be registered as cli commands, and then you’ll be able to just run up_run --help and it’ll work!

2023-12-11-170945_566x55_scrot.png

Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus