Skip to content

Latest commit

 

History

History
74 lines (52 loc) · 1.71 KB

README.md

File metadata and controls

74 lines (52 loc) · 1.71 KB

sample-poetry

Installing

$pip install poetry

Create New Project

$poetry new sample-project

This will create the following files and folders:

sample-project
├── README.rst
├── pyproject.toml
├── sample_project
│   └── __init__.py
└── tests
    ├── __init__.py
    └── test_sample_project.py

Add New Dependency

$cd sample-project
$poetry add [--dev] <package name>

This downloads and install a dependency inside the virtual environment managed by Poetry,
and adds or updates poetry.lock file, and updates pyproject.toml.

Remove Deoendency

$poetry remove <package name>

This is very simple :)

Use Virtual Environment

# not active
$poetry run python -m pytest

# active
$poetry shell

Use Exsting Environment

$poetry install [--no-dev]

Reference

Poetry - Python dependency management and packaging made easy.
GitHub - python-poetry/poetry: Python dependency management and packaging made easy.
Modern Python Environments - dependency and workspace management | TestDriven.io

めも

Pipenvなんかにはないスマートな依存関係の解決ができるよって言ってる
確かにpipenv uninstallは依存関係を見てないし、言われてみればinstallでコケることも割とあるので、 poetry removeとそのスマートさがよしなにしてくれるなら嬉しいなーという感じ

参考:Pipenv uninstallよりcleanの方が多分便利 - Qiita