Poetry

1. Poetry vs. Conda

ToolPoetryConda
Main scopePython project dependency managementcross-language environment management
File usedpyproject.toml, poetry.lockenvironment.yml
Virtual environmentsbuilt for Python projectscan manage any environment
Packagingstrong packaging supportnot the primary focus
Best use casePython app or library developmentprojects requiring non-Python system libraries

pyproject.toml

This file defines project metadata and dependencies.

poetry.lock

This file pins the exact dependency versions used in the project for reproducibility.


2. Install Poetry

pip install poetry

poetry init

mkdir demo
cd demo
poetry init

poetry new

poetry new demo-xformers
cd demo-xformers
ls -al

3. Install dependencies

poetry install

4. Add packages

poetry add numpy
poetry add --group dev pytest

5. Run commands in the project environment

poetry run python your_script.py
poetry shell

6. Build

poetry build

Summary

Poetry is ideal for clean, reproducible Python project management and packaging workflows.

Related articles

Introduction to Linux

An operating system sits between users and hardware. It manages memory, processes, files, and devices while exposing a graphical or command-line interface. - Linux - iOS - Android - macOS - Windows…

Training

Python

In Python, values such as integers, strings, lists, and functions are all objects. They have types and methods, which is different from C++ primitive values. --- Lists are ordered, mutable sequence…

Training

Git

Git is a distributed version control system (DVCS) used to: - track changes to files over time - collaborate with multiple people on the same project - manage branches independently - sync code wit…

Training

Advanced Packaging Tool

This document contains frequently used command and the corresponding used cases for package management software Advanced Packaging Tool (APT). For simplification, all the variables are written in p…

Training