1. Poetry vs. Conda
| Tool | Poetry | Conda |
|---|---|---|
| Main scope | Python project dependency management | cross-language environment management |
| File used | pyproject.toml, poetry.lock | environment.yml |
| Virtual environments | built for Python projects | can manage any environment |
| Packaging | strong packaging support | not the primary focus |
| Best use case | Python app or library development | projects 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.