Python Project Workflow
Let's build a random quote generator to return a randomly selected quote from set of quotes.
First, let's create a new folder for our project:
$ mkdir random-quote-generator $ cd random-quote-generator
Initialize the project with Poetry:
$ poetry init Package name [random_quote_generator]: Version [0.1.0]: Description : Author [Your name <email@example.com>, n to skip]: License : Compatible Python versions [^3.10]: Would you like to define your main dependencies interactively? (yes/no) [yes] no Would you like to define your development dependencies interactively? (yes/no) [yes] no Do you confirm generation? (yes/no) [yes]
For more on Poetry, check out the Modern Python Environments - Dependency and workspace management article.
Your project name must be unique since you'll be uploading it to PyPI. So, to avoid name collisions add a unique string to the package name in pyproject.toml.
[tool.poetry] name = "random-quote-generator-9308" version = "0.1.0" description = "" authors = ["Michael Herman <firstname.lastname@example.org>"] [tool.poetry.dependencies] python = "^3.10" [tool.poetry.dev-dependencies] [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api"
Back to Top