<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Introduction on Poetry - Python dependency management and packaging made easy</title><link>https://python-poetry.org/docs/</link><description>Recent content in Introduction on Poetry - Python dependency management and packaging made easy</description><generator>Hugo</generator><language>en-us</language><atom:link href="https://python-poetry.org/docs/index.xml" rel="self" type="application/rss+xml"/><item><title>Basic usage</title><link>https://python-poetry.org/docs/basic-usage/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://python-poetry.org/docs/basic-usage/</guid><description>&lt;h1 id="basic-usage">Basic usage&lt;/h1>
&lt;p>For the basic usage introduction we will be installing &lt;code>pendulum&lt;/code>, a datetime library.
If you have not yet installed Poetry, refer to the &lt;a href="https://python-poetry.org/docs/" title="Introduction">Introduction&lt;/a> chapter.&lt;/p>
&lt;h2 id="project-setup">Project setup&lt;/h2>
&lt;p>First, let&amp;rsquo;s create our new project, let&amp;rsquo;s call it &lt;code>poetry-demo&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">poetry new poetry-demo
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>This will create the &lt;code>poetry-demo&lt;/code> directory with the following content:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">poetry-demo
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">├── pyproject.toml
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">├── README.md
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">├── src
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">│ └── poetry_demo
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">│ └── __init__.py
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">└── tests
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> └── __init__.py
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The &lt;code>pyproject.toml&lt;/code> file is what is the most important here. This will orchestrate
your project and its dependencies. For now, it looks like this:&lt;/p></description></item><item><title>Building extension modules</title><link>https://python-poetry.org/docs/building-extension-modules/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://python-poetry.org/docs/building-extension-modules/</guid><description>&lt;h1 id="building-extension-modules">Building Extension Modules&lt;/h1>
&lt;div class="admonition warning">
 &lt;div class="title">Warning&lt;/div>
 &lt;div class="content">&lt;p>While this feature has been around since almost the beginning of the Poetry project and has needed minimal changes,
it is still considered unstable. You can participate in the discussions about stabilizing this feature
&lt;a href="https://github.com/python-poetry/poetry/issues/2740">here&lt;/a>.&lt;/p>
&lt;p>And as always, your contributions towards the goal of improving this feature are also welcome.&lt;/p>
&lt;/div>
&lt;/div>
&lt;p>Poetry allows a project developer to introduce support for, build and distribute native extensions within their project.
In order to achieve this, at the highest level, the following steps are required.&lt;/p></description></item><item><title>Commands</title><link>https://python-poetry.org/docs/cli/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://python-poetry.org/docs/cli/</guid><description>&lt;h1 id="commands">Commands&lt;/h1>
&lt;p>You&amp;rsquo;ve already learned how to use the command-line interface to do some things.
This chapter documents all the available commands.&lt;/p>
&lt;p>To get help from the command-line, simply call &lt;code>poetry&lt;/code> to see the complete list of commands,
then &lt;code>--help&lt;/code> combined with any of those can give you more information.&lt;/p>
&lt;h2 id="global-options">Global Options&lt;/h2>
&lt;ul>
&lt;li>&lt;code>--verbose (-v|vv|vvv)&lt;/code>: Increase the verbosity of messages: &amp;ldquo;-v&amp;rdquo; for normal output, &amp;ldquo;-vv&amp;rdquo; for more verbose output and &amp;ldquo;-vvv&amp;rdquo; for debug.&lt;/li>
&lt;/ul>
&lt;div class="admonition note">
 &lt;div class="title">Note&lt;/div>
 &lt;div class="content">&lt;p>You can also set the verbosity level using the &lt;code>SHELL_VERBOSITY&lt;/code> environment variable.
This is useful in CI/CD pipelines or scripts where you cannot easily modify command-line arguments.&lt;/p></description></item><item><title>Community</title><link>https://python-poetry.org/docs/community/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://python-poetry.org/docs/community/</guid><description>&lt;h1 id="community">Community&lt;/h1>
&lt;h2 id="badge">Badge&lt;/h2>
&lt;p>For any projects using Poetry, you may add its official badge somewhere prominent like the README.&lt;/p>
&lt;p>&lt;a href="https://python-poetry.org/">&lt;img src="https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json" alt="Poetry">&lt;/a>&lt;/p>
&lt;p>&lt;strong>Markdown&lt;/strong>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-md" data-lang="md">&lt;span class="line">&lt;span class="cl">[&lt;span class="nt">![Poetry&lt;/span>](&lt;span class="na">https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json&lt;/span>)](https://python-poetry.org/)
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;strong>reStructuredText&lt;/strong>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-rst" data-lang="rst">&lt;span class="line">&lt;span class="cl">&lt;span class="p">..&lt;/span> &lt;span class="ow">image&lt;/span>&lt;span class="p">::&lt;/span> https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json&lt;span class="err">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="err">&lt;/span> &lt;span class="nc">:alt:&lt;/span> &lt;span class="nf">Poetry&lt;/span>&lt;span class="err">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="err">&lt;/span> &lt;span class="nc">:target:&lt;/span> &lt;span class="nf">https://python-poetry.org/&lt;/span>&lt;span class="err">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>Configuration</title><link>https://python-poetry.org/docs/configuration/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://python-poetry.org/docs/configuration/</guid><description>&lt;h1 id="configuration">Configuration&lt;/h1>
&lt;p>Poetry can be configured via the &lt;code>config&lt;/code> command (&lt;a href="https://python-poetry.org/docs/cli/#config" title="config command documentation">see more about its usage here&lt;/a>)
or directly in the &lt;code>config.toml&lt;/code> file that will be automatically created when you first run that command.
This file can typically be found in one of the following directories:&lt;/p>
&lt;ul>
&lt;li>macOS: &lt;code>~/Library/Application Support/pypoetry&lt;/code>&lt;/li>
&lt;li>Windows: &lt;code>%APPDATA%\pypoetry&lt;/code>&lt;/li>
&lt;/ul>
&lt;p>For Unix, we follow the XDG spec and support &lt;code>$XDG_CONFIG_HOME&lt;/code>.
That means, by default &lt;code>~/.config/pypoetry&lt;/code>.&lt;/p>
&lt;h2 id="local-configuration">Local configuration&lt;/h2>
&lt;p>Poetry also provides the ability to have settings that are specific to a project
by passing the &lt;code>--local&lt;/code> option to the &lt;code>config&lt;/code> command.&lt;/p></description></item><item><title>Contributing to Poetry</title><link>https://python-poetry.org/docs/contributing/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://python-poetry.org/docs/contributing/</guid><description>&lt;h1 id="contributing-to-poetry">Contributing to Poetry&lt;/h1>
&lt;p>First off, thanks for taking the time to contribute!&lt;/p>
&lt;p>The following is a set of guidelines for contributing to Poetry on GitHub. These are mostly guidelines, not rules. Use
your best judgement, and feel free to propose changes to this document in a pull request.&lt;/p>
&lt;h2 id="how-to-contribute">How to contribute&lt;/h2>
&lt;h3 id="reporting-bugs">Reporting bugs&lt;/h3>
&lt;p>This section guides you through submitting a bug report for Poetry.
Following these guidelines helps maintainers and the community understands your report, reproduces the behavior, and finds
related reports.&lt;/p></description></item><item><title>Dependency specification</title><link>https://python-poetry.org/docs/dependency-specification/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://python-poetry.org/docs/dependency-specification/</guid><description>&lt;h1 id="dependency-specification">Dependency specification&lt;/h1>
&lt;p>Dependencies for a project can be specified in various forms, which depend on the type
of the dependency and on the optional constraints that might be needed for it to be installed.&lt;/p>
&lt;h2 id="projectdependencies-and-toolpoetrydependencies">&lt;code>project.dependencies&lt;/code> and &lt;code>tool.poetry.dependencies&lt;/code>&lt;/h2>
&lt;p>Prior Poetry 2.0, dependencies had to be declared in the &lt;code>tool.poetry.dependencies&lt;/code>
section of the &lt;code>pyproject.toml&lt;/code> file.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-toml" data-lang="toml">&lt;span class="line">&lt;span class="cl">&lt;span class="p">[&lt;/span>&lt;span class="nx">tool&lt;/span>&lt;span class="p">.&lt;/span>&lt;span class="nx">poetry&lt;/span>&lt;span class="p">.&lt;/span>&lt;span class="nx">dependencies&lt;/span>&lt;span class="p">]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nx">requests&lt;/span> &lt;span class="p">=&lt;/span> &lt;span class="s2">&amp;#34;^2.13.0&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>With Poetry 2.0, you should consider using the &lt;code>project.dependencies&lt;/code> section instead.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-toml" data-lang="toml">&lt;span class="line">&lt;span class="cl">&lt;span class="p">[&lt;/span>&lt;span class="nx">project&lt;/span>&lt;span class="p">]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c"># ...&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nx">dependencies&lt;/span> &lt;span class="p">=&lt;/span> &lt;span class="p">[&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;requests (&amp;gt;=2.23.0,&amp;lt;3.0.0)&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="p">]&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>While dependencies in &lt;code>tool.poetry.dependencies&lt;/code> are specified using toml tables,
dependencies in &lt;code>project.dependencies&lt;/code> are specified as strings according
to &lt;a href="https://peps.python.org/pep-0508/">PEP 508&lt;/a>.&lt;/p></description></item><item><title>FAQ</title><link>https://python-poetry.org/docs/faq/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://python-poetry.org/docs/faq/</guid><description>&lt;h1 id="faq">FAQ&lt;/h1>
&lt;h3 id="why-is-the-dependency-resolution-process-slow">Why is the dependency resolution process slow?&lt;/h3>
&lt;p>While the dependency resolver at the heart of Poetry is highly optimized and
should be fast enough for most cases, with certain sets of dependencies,
it can take time to find a valid solution.&lt;/p>
&lt;p>This is due to the fact that not all libraries on PyPI have properly declared their metadata
and, as such, they are not available via the PyPI JSON API. At this point, Poetry has no choice
but to download the packages and inspect them to get the necessary information. This is an expensive
operation, both in bandwidth and time, which is why it seems this is a long process.&lt;/p></description></item><item><title>Libraries</title><link>https://python-poetry.org/docs/libraries/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://python-poetry.org/docs/libraries/</guid><description>&lt;h1 id="libraries">Libraries&lt;/h1>
&lt;p>This chapter will tell you how to make your library installable through Poetry.&lt;/p>
&lt;h2 id="versioning">Versioning&lt;/h2>
&lt;p>Poetry requires &lt;a href="https://peps.python.org/pep-0440">PEP 440&lt;/a>-compliant versions for all projects.&lt;/p>
&lt;p>While Poetry does not enforce any release convention, it used to encourage the use of
&lt;a href="https://semver.org/">semantic versioning&lt;/a> within the scope of
&lt;a href="https://peps.python.org/pep-0440/#semantic-versioning">PEP 440&lt;/a> and supports
&lt;a href="https://python-poetry.org/docs/dependency-specification/#caret-requirements">version constraints&lt;/a>
that are especially suitable for semver.&lt;/p>
&lt;div class="admonition note">
 &lt;div class="title">Note&lt;/div>
 &lt;div class="content">As an example, &lt;code>1.0.0-hotfix.1&lt;/code> is not compatible with &lt;a href="https://peps.python.org/pep-0440">PEP 440&lt;/a>. You can instead
choose to use &lt;code>1.0.0-post1&lt;/code> or &lt;code>1.0.0.post1&lt;/code>.&lt;/div>
&lt;/div>
&lt;h2 id="lock-file">Lock file&lt;/h2>
&lt;p>For your library, you may commit the &lt;code>poetry.lock&lt;/code> file if you want to.
This can help your team to always test against the same dependency versions.
However, this lock file will not have any effect on other projects that depend on it.
It only has an effect on the main project.&lt;/p></description></item><item><title>Managing dependencies</title><link>https://python-poetry.org/docs/managing-dependencies/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://python-poetry.org/docs/managing-dependencies/</guid><description>&lt;h1 id="managing-dependencies">Managing dependencies&lt;/h1>
&lt;p>Poetry supports specifying main dependencies in the &lt;a href="https://python-poetry.org/docs/pyproject/#dependencies">&lt;code>project.dependencies&lt;/code>&lt;/a> section of your &lt;code>pyproject.toml&lt;/code>
according to PEP 621. For legacy reasons and to define additional information that are only used by Poetry
the &lt;a href="https://python-poetry.org/docs/pyproject/#dependencies-and-dependency-groups">&lt;code>tool.poetry.dependencies&lt;/code>&lt;/a> sections can be used.&lt;/p>
&lt;p>See &lt;a href="https://python-poetry.org/docs/dependency-specification/">Dependency specification&lt;/a> for more information.&lt;/p>
&lt;h2 id="dependency-groups">Dependency groups&lt;/h2>
&lt;p>Poetry provides a way to &lt;strong>organize&lt;/strong> your dependencies by &lt;strong>groups&lt;/strong>.&lt;/p>
&lt;p>The dependencies declared in &lt;code>project.dependencies&lt;/code> respectively &lt;code>tool.poetry.dependencies&lt;/code>
are part of an implicit &lt;code>main&lt;/code> group. Those dependencies are required by your project during runtime.&lt;/p></description></item><item><title>Managing environments</title><link>https://python-poetry.org/docs/managing-environments/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://python-poetry.org/docs/managing-environments/</guid><description>&lt;h1 id="managing-environments">Managing environments&lt;/h1>
&lt;p>Poetry makes project environment isolation one of its core features.&lt;/p>
&lt;p>What this means is that it will always work isolated from your global Python installation.
To achieve this, it will first check if it&amp;rsquo;s currently running inside a virtual environment.
If it is, it will use it directly without creating a new one. But if it&amp;rsquo;s not, it will use
one that it has already created or create a brand new one for you.&lt;/p></description></item><item><title>Plugins</title><link>https://python-poetry.org/docs/plugins/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://python-poetry.org/docs/plugins/</guid><description>&lt;h1 id="plugins">Plugins&lt;/h1>
&lt;p>Poetry supports using and building plugins if you wish to
alter or expand Poetry&amp;rsquo;s functionality with your own.&lt;/p>
&lt;p>For example if your environment poses special requirements
on the behaviour of Poetry which do not apply to the majority of its users
or if you wish to accomplish something with Poetry in a way that is not desired by most users.&lt;/p>
&lt;p>In these cases you could consider creating a plugin to handle your specific logic.&lt;/p></description></item><item><title>pre-commit hooks</title><link>https://python-poetry.org/docs/pre-commit-hooks/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://python-poetry.org/docs/pre-commit-hooks/</guid><description>&lt;h1 id="pre-commit-hooks">pre-commit hooks&lt;/h1>
&lt;p>pre-commit is a framework for building and running
&lt;a href="https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks">git hooks&lt;/a>.
See the official documentation for more information: &lt;a href="https://pre-commit.com/">pre-commit.com&lt;/a>&lt;/p>
&lt;p>This document provides a list of available pre-commit hooks provided by Poetry.&lt;/p>
&lt;div class="admonition note">
 &lt;div class="title">Note&lt;/div>
 &lt;div class="content">If you specify the &lt;code>args:&lt;/code> for a hook in your &lt;code>.pre-commit-config.yaml&lt;/code>,
the defaults are overwritten. You must fully specify all arguments for
your hook if you make use of &lt;code>args:&lt;/code>.&lt;/div>
&lt;/div>
&lt;div class="admonition note">
 &lt;div class="title">Note&lt;/div>
 &lt;div class="content">If the &lt;code>pyproject.toml&lt;/code> file is not in the root directory, you can specify &lt;code>args: [&amp;quot;-C&amp;quot;, &amp;quot;./subdirectory&amp;quot;]&lt;/code>.&lt;/div>
&lt;/div>
&lt;h2 id="poetry-check">poetry-check&lt;/h2>
&lt;p>The &lt;code>poetry-check&lt;/code> hook calls the &lt;code>poetry check&lt;/code> command
to make sure the poetry configuration does not get committed in a broken state.&lt;/p></description></item><item><title>Repositories</title><link>https://python-poetry.org/docs/repositories/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://python-poetry.org/docs/repositories/</guid><description>&lt;h1 id="repositories">Repositories&lt;/h1>
&lt;p>Poetry supports the use of &lt;a href="https://pypi.org">PyPI&lt;/a> and private repositories for discovery of
packages as well as for publishing your projects.&lt;/p>
&lt;p>By default, Poetry is configured to use the &lt;a href="https://pypi.org">PyPI&lt;/a> repository,
for package installation and publishing.&lt;/p>
&lt;p>So, when you add dependencies to your project, Poetry will assume they are available
on PyPI.&lt;/p>
&lt;p>This represents most cases and will likely be enough for most users.&lt;/p>
&lt;h3 id="private-repository-example">Private Repository Example&lt;/h3>
&lt;h4 id="installing-from-private-package-sources">Installing from private package sources&lt;/h4>
&lt;p>By default, Poetry discovers and installs packages from &lt;a href="https://pypi.org">PyPI&lt;/a>. But, you want to
install a dependency to your project for a &lt;a href="#simple-api-repository">simple API repository&lt;/a>? Let&amp;rsquo;s
do it.&lt;/p></description></item><item><title>The pyproject.toml file</title><link>https://python-poetry.org/docs/pyproject/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://python-poetry.org/docs/pyproject/</guid><description>&lt;h1 id="the-pyprojecttoml-file">The &lt;code>pyproject.toml&lt;/code> file&lt;/h1>
&lt;p>In package mode, the only required fields are &lt;code>name&lt;/code> and &lt;code>version&lt;/code>
(either in the &lt;code>project&lt;/code> section or in the &lt;code>tool.poetry&lt;/code> section).
Other fields are optional.
In non-package mode, the &lt;code>name&lt;/code> and &lt;code>version&lt;/code> fields are required
if using the &lt;code>project&lt;/code> section.&lt;/p>
&lt;div class="admonition note">
 &lt;div class="title">Note&lt;/div>
 &lt;div class="content">Run &lt;code>poetry check&lt;/code> to print warnings about deprecated fields.&lt;/div>
&lt;/div>
&lt;h2 id="the-project-section">The &lt;code>project&lt;/code> section&lt;/h2>
&lt;p>The &lt;code>project&lt;/code> section of the &lt;code>pyproject.toml&lt;/code> file according to the
&lt;a href="https://packaging.python.org/en/latest/specifications/pyproject-toml/#declaring-project-metadata-the-project-table">specification of the PyPA&lt;/a>.&lt;/p>
&lt;h3 id="name">name&lt;/h3>
&lt;p>The name of the package. &lt;strong>Always required when the &lt;code>project&lt;/code> section is specified&lt;/strong>&lt;/p></description></item></channel></rss>