filmov
tv
Python Poetry for a Noob - Getting started
![preview_player](https://i.ytimg.com/vi/jRdj3WSofVo/maxresdefault.jpg)
ะะพะบะฐะทะฐัั ะพะฟะธัะฐะฝะธะต
๐ โ ๐ซ ๐ ๐๐ฆ๐๐๐๐ฃ๐ช ๐ ๐ซ โ ๐
Managing packages and dependencies in Python can be overwhelming and resource intensive. Poetry will help with starting new projects, maintaining existing ones and provide centralized dependency management. Like most Python projects, it relies on external packages. The maintenance work falls on the developer to make sure each version of each package is updated and working after each update. By leveraging Poetry, a dependency manager, we can specify, install and resolve external packages in one source location known as out project file. This way we can ensure we always have the right dependencies,lol versions and configurations, and dependencies of dependencies, with the added value of central management.
๐ โ ๐ซ ๐ ๐ฝ๐๐๐๐ค ๐๐๐ ๐๐ ๐ฃ๐ ๐ฝ๐๐๐๐ค ๐ ๐ซ โ ๐
MANIFEST.in - Specifies metadata for accompanying files
Pipfile - Dedicated file for project dependencies
๐ โ ๐ซ ๐ ๐๐๐๐ฅ ๐ก๐ ๐๐ฅ๐ฃ๐ช ๐๐ ๐๐ค ๐๐ ๐ฃ ๐๐? ๐ ๐ซ โ ๐
After implementing Poetry, you will have 2 new files.
๐ โ ๐ซ ๐ โ๐ฃ๐๐๐ฅ๐๐๐ ๐ ๐๐๐จ ๐ก๐ ๐๐ฅ๐ฃ๐ช ๐ก๐๐๐๐๐๐ ๐ ๐ซ โ ๐
Creating our first poetry package is very simple.
$poetry new dolphin-poetry-project
A folder will be created "rp-poetry". Poetry will normalize packages for you automatically. The Poetry file structure is formatted as below.
dolphin-poetry-project
โโโ dolphin-poetry-project
โ โโโ __init__.py
โโโ tests/
โ โโโ __init__.py
โ
โโโ README.md
A toml and a lock file will be created to track all our packages, dependencies and version. See examples below.
------------------------------------------------------------------------------------------------------------
name = "dolphin-poetry-project"
version = "0.1.5"
description = "Dolphin test project"
python = "^3.7"
pytest = "^4.6"
invoke = "^1.8"
pycrypto = "^4.3"
strings = "^4.1"
remove-empty-directories = true
[build-system]
requires = ["poetry=0.12"]
run = "wsgi:main"
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
[[package]]name = "pytest"
version = "0.17.2"
description = "Python graph [network] package"
category = "dev"
optional = false
python-versions = "*"[[package]]
name = "attrs"
version = "20.3.0"
description = ""
category = "dev"
optional = false
python-versions = "=2.7, !
pytesting = "=1.1.0"
[[package]]name = "invoke"
version = "0.17.2"
description = "Python graph [network] package"
category = "dev"
optional = false
python-versions = "*"[[package]]
name = "attrs"
version = "20.3.0"
description = ""
category = "dev"
optional = false
------------------------------------------------------------------------------------------------------------
๐ โ ๐ซ ๐ The workflow
This can be allot to take in, so lets look at the workflow.
1. Install Poetry
2. Create a Poetry package
3. Add a package
4. Update the packages
5. Track/list the packages
6. Build the package
7. Install the package
๐ โ ๐ซ ๐ Workflow specifics
1. Installing on linux
B. Check version with - poetry --version
C. Set environment variable - export PATH="$HOME/.poetry/bin:${PATH}"
2. Create a Poetry package
poetry new mypoetryproject
3. Adding packages
poetry add "package name"
4. Update the packages
Poetry update
5. Track/list the packages
poetry show --tree
6. Build the packages
Poetry build
7. Publishing Packages
poetry publish
8. Publishing Packages
poetry publish
References:
Music:- ASHUTOSH - Chile
Managing packages and dependencies in Python can be overwhelming and resource intensive. Poetry will help with starting new projects, maintaining existing ones and provide centralized dependency management. Like most Python projects, it relies on external packages. The maintenance work falls on the developer to make sure each version of each package is updated and working after each update. By leveraging Poetry, a dependency manager, we can specify, install and resolve external packages in one source location known as out project file. This way we can ensure we always have the right dependencies,lol versions and configurations, and dependencies of dependencies, with the added value of central management.
๐ โ ๐ซ ๐ ๐ฝ๐๐๐๐ค ๐๐๐ ๐๐ ๐ฃ๐ ๐ฝ๐๐๐๐ค ๐ ๐ซ โ ๐
MANIFEST.in - Specifies metadata for accompanying files
Pipfile - Dedicated file for project dependencies
๐ โ ๐ซ ๐ ๐๐๐๐ฅ ๐ก๐ ๐๐ฅ๐ฃ๐ช ๐๐ ๐๐ค ๐๐ ๐ฃ ๐๐? ๐ ๐ซ โ ๐
After implementing Poetry, you will have 2 new files.
๐ โ ๐ซ ๐ โ๐ฃ๐๐๐ฅ๐๐๐ ๐ ๐๐๐จ ๐ก๐ ๐๐ฅ๐ฃ๐ช ๐ก๐๐๐๐๐๐ ๐ ๐ซ โ ๐
Creating our first poetry package is very simple.
$poetry new dolphin-poetry-project
A folder will be created "rp-poetry". Poetry will normalize packages for you automatically. The Poetry file structure is formatted as below.
dolphin-poetry-project
โโโ dolphin-poetry-project
โ โโโ __init__.py
โโโ tests/
โ โโโ __init__.py
โ
โโโ README.md
A toml and a lock file will be created to track all our packages, dependencies and version. See examples below.
------------------------------------------------------------------------------------------------------------
name = "dolphin-poetry-project"
version = "0.1.5"
description = "Dolphin test project"
python = "^3.7"
pytest = "^4.6"
invoke = "^1.8"
pycrypto = "^4.3"
strings = "^4.1"
remove-empty-directories = true
[build-system]
requires = ["poetry=0.12"]
run = "wsgi:main"
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
[[package]]name = "pytest"
version = "0.17.2"
description = "Python graph [network] package"
category = "dev"
optional = false
python-versions = "*"[[package]]
name = "attrs"
version = "20.3.0"
description = ""
category = "dev"
optional = false
python-versions = "=2.7, !
pytesting = "=1.1.0"
[[package]]name = "invoke"
version = "0.17.2"
description = "Python graph [network] package"
category = "dev"
optional = false
python-versions = "*"[[package]]
name = "attrs"
version = "20.3.0"
description = ""
category = "dev"
optional = false
------------------------------------------------------------------------------------------------------------
๐ โ ๐ซ ๐ The workflow
This can be allot to take in, so lets look at the workflow.
1. Install Poetry
2. Create a Poetry package
3. Add a package
4. Update the packages
5. Track/list the packages
6. Build the package
7. Install the package
๐ โ ๐ซ ๐ Workflow specifics
1. Installing on linux
B. Check version with - poetry --version
C. Set environment variable - export PATH="$HOME/.poetry/bin:${PATH}"
2. Create a Poetry package
poetry new mypoetryproject
3. Adding packages
poetry add "package name"
4. Update the packages
Poetry update
5. Track/list the packages
poetry show --tree
6. Build the packages
Poetry build
7. Publishing Packages
poetry publish
8. Publishing Packages
poetry publish
References:
Music:- ASHUTOSH - Chile
ะะพะผะผะตะฝัะฐัะธะธ