You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
### 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`
0 commit comments