Package: relaxed-poetry
Relaxed Poetryℹ️ For installation instructions check theWikiThis project is a poetry fork. It serves as a relaxed version of poetry (currently based on version 1.2.0a2).Poetry is a great tool and was a perfect fit for my team. Over the time, we found several issues where it is a bit too strict, and while most of the time for good reasons, these issues still made poetry unusable for us in many projects.Since, in my eyes, there is no real alternative to poetry, I choose to fork it and include some relaxations for the issues that we encounter. While I'm at it, I also modified some of poetry's behavior and added some features that suite our workflows and views better.All of the changes that were made in this fork are documented in the wiki, the followings are some notable ones:Forced dependency versionsRelaxation of version-enforcementsFaster dependency-versions resolution (more than 4 times faster on tested projects)Multi-package projects supportvirtual environments are built inside the project directory by defaultProject and other components scaffolding usingprotopyproperty definition and substitution in pyprojectautomatic and manual build profiles (override groups of properties in pyproject)install, update and add are merged into a single (install) commandSee wiki for further details.Important: this package is based on alpha staged poetry, changes may be frequent,
though it is planed to be used internally for our projects from day one.The rest of this README left as is from the original Poetry READMEPoetry: Dependency Management for PythonPoetry helps you declare, manage and install dependencies of Python projects,
ensuring you have the right stack everywhere.It supports Python 2.7 and 3.5+.Note: Python 2.7 and 3.5 will no longer be supported in the next feature release (1.2).
You should consider updating your Python version to a supported one.Thecomplete documentationis available on theofficial website.InstallationPoetry provides a custom installer that will installpoetryisolated
from the rest of your system.osx / linux / bashonwindows install instructionscurl-sSLhttps://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py|python-windows powershell install instructions(Invoke-WebRequest-Urihttps://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py-UseBasicParsing).Content|python-Warning: The previousget-poetry.pyinstaller is now deprecated, if you are currently using it
you should migrate to the new, supported,install-poetry.pyinstaller.The installer installs thepoetrytool to Poetry'sbindirectory. This location depends on your system:$HOME/.local/binfor Unix%APPDATA%\Python\Scriptson WindowsIf this directory is not on yourPATH, you will need to add it manually
if you want to invoke Poetry with simplypoetry.Alternatively, you can use the full path topoetryto use it.Once Poetry is installed you can execute the following:poetry--versionIf you see something likePoetry (version 1.2.0)then you are ready to use Poetry.
If you decide Poetry isn't your thing, you can completely remove it from your system
by running the installer again with the--uninstalloption or by setting
thePOETRY_UNINSTALLenvironment variable before executing the installer.pythoninstall-poetry.py--uninstallPOETRY_UNINSTALL=1pythoninstall-poetry.pyBy default, Poetry is installed into the user's platform-specific home directory.
If you wish to change this, you may define thePOETRY_HOMEenvironment variable:POETRY_HOME=/etc/poetrypythoninstall-poetry.pyIf you want to install prerelease versions, you can do so by passing--previewoption toinstall-poetry.pyor by using thePOETRY_PREVIEWenvironment variable:pythoninstall-poetry.py--previewPOETRY_PREVIEW=1pythoninstall-poetry.pySimilarly, if you want to install a specific version, you can use--versionoption or thePOETRY_VERSIONenvironment variable:pythoninstall-poetry.py--version1.2.0POETRY_VERSION=1.2.0pythoninstall-poetry.pyYou can also install Poetry for agitrepository by using the--gitoption:pythoninstall-poetry.py--githttps://github.com/python-poetry/poetry.git@masterNote: Note that the installer does not support Python < 3.6.UpdatingpoetryUpdating poetry to the latest stable version is as simple as calling theself updatecommand.Warning: Poetry versions installed using the now deprecatedget-poetry.pyinstaller will not be able to use this
command to update to 1.2 releases or later. Migrate to using theinstall-poetry.pyinstaller orpipx.poetryselfupdateIf you want to install prerelease versions, you can use the--previewoption.poetryselfupdate--previewAnd finally, if you want to install a specific version you can pass it as an argument
toself update.poetryselfupdate1.2.0Enable tab completion for Bash, Fish, or Zshpoetrysupports generating completion scripts for Bash, Fish, and Zsh.
Seepoetry help completionsfor full details, but the gist is as simple as using one of the following:# Bashpoetrycompletionsbash>/etc/bash_completion.d/poetry.bash-completion# Bash (Homebrew)poetrycompletionsbash>$(brew--prefix)/etc/bash_completion.d/poetry.bash-completion# Fishpoetrycompletionsfish>~/.config/fish/completions/poetry.fish# Fish (Homebrew)poetrycompletionsfish>(brew--prefix)/share/fish/vendor_completions.d/poetry.fish# Zshpoetrycompletionszsh>~/.zfunc/_poetry# Zsh (Homebrew)poetrycompletionszsh>$(brew--prefix)/share/zsh/site-functions/_poetry# Zsh (Oh-My-Zsh)mkdir$ZSH_CUSTOM/plugins/poetry
poetrycompletionszsh>$ZSH_CUSTOM/plugins/poetry/_poetry# Zsh (prezto)poetrycompletionszsh>~/.zprezto/modules/completion/external/src/_poetryNote:you may need to restart your shell in order for the changes to take
effect.Forzsh, you must then add the following line in your~/.zshrcbeforecompinit(not for homebrew setup):fpath+=~/.zfuncIntroductionpoetryis a tool to handle dependency installation as well as building and packaging of Python packages.
It only needs one file to do all of that: the new,standardizedpyproject.toml.In other words, poetry usespyproject.tomlto replacesetup.py,requirements.txt,setup.cfg,MANIFEST.inand the newly addedPipfile.[tool.poetry]name="my-package"version="0.1.0"description="The description of the package"license="MIT"authors=["Sébastien Eustace <sebastien@eustace.io>"]readme='README.md'# Markdown files are supportedrepository="https://github.com/python-poetry/poetry"homepage="https://github.com/python-poetry/poetry"keywords=['packaging','poetry'][tool.poetry.dependencies]python="~2.7 || ^3.2"# Compatible python versions must be declared heretoml="^0.9"# Dependencies with extrasrequests={version="^2.13",extras=["security"]}# Python specific dependencies with prereleases allowedpathlib2={version="^2.2",python="~2.7",allow-prereleases=true}# Git dependenciescleo={git="https://github.com/sdispater/cleo.git",branch="master"}# Optional dependencies (extras)pendulum={version="^1.4",optional=true}[tool.poetry.dev-dependencies]pytest="^3.0"pytest-cov="^2.4"[tool.poetry.scripts]my-script='my_package:main'There are some things we can notice here:It will try to enforcesemantic versioningas the best practice in version naming.You can specify the readme, included and excluded files: no moreMANIFEST.in.poetrywill also use VCS ignore files (like.gitignore) to populate theexcludesection.Keywords (up to 5) can be specified and will act as tags on the packaging site.The dependencies sections support caret, tilde, wildcard, inequality and multiple requirements.You must specify the python versions for which your package is compatible.poetrywill also detect if you are inside a virtualenv and install the packages accordingly.
So,poetrycan be installed globally and used everywhere.poetryalso comes with a full fledged dependency resolution library.Why?Packaging systems and dependency management in Python are rather convoluted and hard to understand for newcomers.
Even for seasoned developers it might be cumbersome at times to create all files needed in a Python project:setup.py,requirements.txt,setup.cfg,MANIFEST.inand the newly addedPipfile.So I wanted a tool that would limit everything to a single configuration file to do:
dependency management, packaging and publishing.It takes inspiration in tools that exist in other languages, likecomposer(PHP) orcargo(Rust).And, finally, I startedpoetryto bring another exhaustive dependency resolver to the Python community apart fromConda's.What about Pipenv?In short: I do not like the CLI it provides, or some of the decisions made,
and I think we can make a better and more intuitive one. Here are a few things
that I don't like.Dependency resolutionThe dependency resolution is erratic and will fail even if there is a solution. Let's take an example:pipenvinstalloslo.utils==1.4.0will fail with this error:Could not find a version that matches pbr!=0.7,!=2.1.0,<1.0,>=0.6,>=2.0.0while Poetry will get you the right set of packages:poetryaddoslo.utils=1.4.0results in :- Installing pytz (2018.3)
  - Installing netifaces (0.10.6)
  - Installing netaddr (0.7.19)
  - Installing oslo.i18n (2.1.0)
  - Installing iso8601 (0.1.12)
  - Installing six (1.11.0)
  - Installing babel (2.5.3)
  - Installing pbr (0.11.1)
  - Installing oslo.utils (1.4.0)This is possible thanks to the efficient dependency resolver at the heart of Poetry.Here is a breakdown of what exactly happens here:oslo.utils (1.4.0)depends on:pbr (>=0.6,!=0.7,<1.0)Babel (>=1.3)six (>=1.9.0)iso8601 (>=0.1.9)oslo.i18n (>=1.3.0)netaddr (>=0.7.12)netifaces (>=0.10.4)What interests us ispbr (>=0.6,!=0.7,<1.0).At this point, poetry will choosepbr==0.11.1which is the latest version that matches the constraint.Next it will try to selectoslo.i18n==3.20.0which is the latest version that matchesoslo.i18n (>=1.3.0).However this version requirespbr (!=2.1.0,>=2.0.0)which is incompatible withpbr==0.11.1,
sopoetrywill try to find a version ofoslo.i18nthat satisfiespbr (>=0.6,!=0.7,<1.0).By analyzing the releases ofoslo.i18n, it will findoslo.i18n==2.1.0which requirespbr (>=0.11,<2.0).
At this point the rest of the resolution is straightforward since there is no more conflict.ResourcesOfficial WebsiteIssue TrackerDiscord