Skip to content

Latest commit

 

History

History
117 lines (77 loc) · 1.76 KB

README.md

File metadata and controls

117 lines (77 loc) · 1.76 KB

Lego - Python Project Bootstrapper for AI

Project Setup

Python can use pyproject.toml to list dependencies instead of requirements.txt file

Old way was to use requirements.txt but its no long recommended.

New way is to use a dependencies manager

Poetry - The Dependencies manager

Link: https://python-poetry.org/

Installation: https://python-poetry.org/docs/#installing-with-pipx

Installation using Pipx - pipx is used to install global cli tools with isolating then in virtual environments.

sudo pip install pipx
pipx install poetry
# upgrade and uninstall is also supported

Using poetry

Init a new project

poetry init

Add Dependencies

poetry add pytest

Add Dependencies with version

poetry add requests@2.12.1

[Default] Add Dependencies with latest version un-till major change

poetry add requests^2.12.1

This will try to install more newer version but not 3.x.x

Add Dependencies upto latest minor version

poetry add requests~2.12.1

This will install 2.12.5

Show all the dependencies

poetry show
# poetry show requests

Remove dependencies

poetry remove pytest

Install Dependencies for new project

poetry install

Virtual Environment

poetry can create virtual environment for running the application

Spawn a new shell

poetry shell

Versioning

poetry version patch
# `x.y.z` this will bump z
poetry version minor
# `x.y.z` this will bump y
poetry version major
# `x.y.z` this will bump x

Packaging

poetry package
# need pypy credentials

legobadge