Skip to content

Commit d31d817

Browse files
refactor: code
1 parent 44e9175 commit d31d817

File tree

2 files changed

+52
-52
lines changed

2 files changed

+52
-52
lines changed

poetry_basics_tut.md

-52
This file was deleted.

poetry_tut/README.md

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
### What is poetry?
2+
3+
Poetry is a tool for dependency management and packaging in Python. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.
4+
5+
### Why we need poetry in modern development?
6+
7+
To resolve the library versioning issues as there are new versions each day. And it create a virtual environment for you same as conda env
8+
9+
10+
### To install poetry:
11+
12+
`curl -sSL https://install.python-poetry.org | python3 -`
13+
14+
on linux
15+
16+
### To create new project with poetry:
17+
18+
`poetry new project_name`
19+
20+
### This will create a directory with project name with
21+
- pyproject.toml
22+
- ReadMe.md
23+
- project_name
24+
- __init__.py
25+
- tests
26+
- __init__.py
27+
- poetry.lock
28+
29+
This will create a directory structure
30+
31+
### To initialize poetry in pre existing repository then go to repository and open terminal and type `poetry init` command to initialize the poetry
32+
33+
34+
To add dependencies open terminal :
35+
36+
- Add libery dependencies to poetry
37+
`poetry add library_name`
38+
- To Remove `poetry remove library_name`
39+
- If there is already a pyproject and poetry.lock file then you can simply type `poetry install`
40+
- To activate poetry env
41+
`poetry shell`
42+
- To add a libray manually in pyproject add
43+
library_name = version
44+
- We can create different envrionment for development, deployment and for testing
45+
- Can create groups and dependencies to it `poetry add pytest --group test` this is to add dependencies to group test and you can use without `poetry install --without test,docs` to add dependencies to all except the given groups
46+
- Whenever you add a dependency its good to lock them using `poetry lock`
47+
48+
49+
References:
50+
- Install: https://python-poetry.org/docs/
51+
- Basic usage link: https://python-poetry.org/docs/basic-usage/
52+

0 commit comments

Comments
 (0)