rodrigosantosbr

(Py) Poetry dependencies manager

Jul 24th, 2021 (edited)
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!

instalation

curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3

Confirm Poetry was installed correctly.

source $HOME/.poetry/env
poetry --version

make sure your .bash_profile (or .zshrc) was updated with the following, and restart your terminal:

sudo nano ~/.bashrc
export PATH="$HOME/.poetry/bin:${PATH}"
source ~/.bashrc

Create a Python Project with Poetry

poetry new prj1

Contents of our new project: /prj1

/prj1
├── README.md
├── prj1
│   └── __init__.py
├── pyproject.toml
└── tests
    ├── __init__.py
    └── test_prj1.py

project dependencies

nano pyproject.toml

example

[tool]
[tool.poetry]
name = "iabot"
version = "0.1.0"
description = ""
authors = ["Your Name <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.9"
huggingface-hub = "^0.0.12"
tokenizers = "^0.10.3"
transformers = "^4.9.0"
discord = "^1.7.3"
torch = "^1.9.0"

[tool.poetry.dev-dependencies]
pytest = "^5.2"

[tool.poetry.scripts]
app = "iabot.app:start"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

Poetry CLI

/home/operador/.cache/pypoetry/virtualenvs

poetry shell

poetry install

poetry update
poetry install
poetry run app
Add Comment
Please, Sign In to add comment