Skip to content

Commit 8cd4f9f

Browse files
committed
Added Poetry
1 parent c26a7b0 commit 8cd4f9f

5 files changed

Lines changed: 122 additions & 0 deletions

File tree

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"cSpell.enabled": false
3+
}

README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ All contributions are welcome:
203203
- [Type hints](#type-hints)
204204
- [Virtual Environment](#virtual-environment)
205205
- [virtualenv](#virtualenv)
206+
- [poetry](#poetry)
206207
- [pipenv](#pipenv)
207208
- [anaconda](#anaconda)
208209

@@ -4614,6 +4615,66 @@ Usage:
46144615

46154616
[*Return to the Top*](#python-cheatsheet)
46164617

4618+
### poetry
4619+
4620+
> [Poetry](https://poetry.eustace.io/) 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.
4621+
4622+
1. Install Poetry
4623+
4624+
pip install --user poetry
4625+
4626+
2. Create a new project
4627+
4628+
poetry new my-project
4629+
4630+
This will create a my-project directory:
4631+
4632+
my-project
4633+
├── pyproject.toml
4634+
├── README.rst
4635+
├── poetry_demo
4636+
│ └── __init__.py
4637+
└── tests
4638+
├── __init__.py
4639+
└── test_poetry_demo.py
4640+
4641+
The pyproject.toml file will orchestrate your project and its dependencies:
4642+
4643+
[tool.poetry]
4644+
name = "my-project"
4645+
version = "0.1.0"
4646+
description = ""
4647+
authors = ["your name <[email protected]>"]
4648+
4649+
[tool.poetry.dependencies]
4650+
python = "*"
4651+
4652+
[tool.poetry.dev-dependencies]
4653+
pytest = "^3.4"
4654+
4655+
3. Packages
4656+
4657+
To add dependencies to your project, you can specify them in the tool.poetry.dependencies section:
4658+
4659+
[tool.poetry.dependencies]
4660+
pendulum = "^1.4"
4661+
4662+
Also, instead of modifying the pyproject.toml file by hand, you can use the add command and it will automatically find a suitable version constraint.
4663+
4664+
$ poetry add pendulum
4665+
4666+
To install the dependencies listed in the pyproject.toml:
4667+
4668+
poetry install
4669+
4670+
To remove dependencies:
4671+
4672+
poetry remove pendulum
4673+
4674+
For more information, check the [documentation](https://poetry.eustace.io/docs/).
4675+
4676+
[*Return to the Top*](#python-cheatsheet)
4677+
46174678
### pipenv
46184679

46194680
> [Pipenv](https://pipenv.readthedocs.io/en/latest/) is a tool that aims to bring the best of all packaging worlds (bundler, composer, npm, cargo, yarn, etc.) to the Python world. Windows is a first-class citizen, in our world.

blog_files/pysheet.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4105,6 +4105,64 @@ Usage:
41054105

41064106
workon HelloWold
41074107

4108+
### poetry
4109+
4110+
> [Poetry](https://poetry.eustace.io/) 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.
4111+
4112+
1. Install Poetry
4113+
4114+
pip install --user poetry
4115+
4116+
2. Create a new project
4117+
4118+
poetry new my-project
4119+
4120+
This will create a my-project directory:
4121+
4122+
my-project
4123+
├── pyproject.toml
4124+
├── README.rst
4125+
├── poetry_demo
4126+
│ └── __init__.py
4127+
└── tests
4128+
├── __init__.py
4129+
└── test_poetry_demo.py
4130+
4131+
The pyproject.toml file will orchestrate your project and its dependencies:
4132+
4133+
[tool.poetry]
4134+
name = "my-project"
4135+
version = "0.1.0"
4136+
description = ""
4137+
authors = ["your name <[email protected]>"]
4138+
4139+
[tool.poetry.dependencies]
4140+
python = "*"
4141+
4142+
[tool.poetry.dev-dependencies]
4143+
pytest = "^3.4"
4144+
4145+
3. Packages
4146+
4147+
To add dependencies to your project, you can specify them in the tool.poetry.dependencies section:
4148+
4149+
[tool.poetry.dependencies]
4150+
pendulum = "^1.4"
4151+
4152+
Also, instead of modifying the pyproject.toml file by hand, you can use the add command and it will automatically find a suitable version constraint.
4153+
4154+
$ poetry add pendulum
4155+
4156+
To install the dependencies listed in the pyproject.toml:
4157+
4158+
poetry install
4159+
4160+
To remove dependencies:
4161+
4162+
poetry remove pendulum
4163+
4164+
For more information, check the [documentation](https://poetry.eustace.io/docs/).
4165+
41084166
### pipenv
41094167

41104168
> [Pipenv](https://pipenv.readthedocs.io/en/latest/) is a tool that aims to bring the best of all packaging worlds (bundler, composer, npm, cargo, yarn, etc.) to the Python world. Windows is a first-class citizen, in our world.
File renamed without changes.

python_cheat_sheet.pdf

6.07 KB
Binary file not shown.

0 commit comments

Comments
 (0)