Poetry Operations: Difference between revisions
(→export) |
|||
(8 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
=Installation= | =Installation= | ||
==With | ==With Custom Installer== | ||
The custom installer installs Poetry in a new virtual environment to isolate it from the rest of your system. This ensures that dependencies will not be accidentally upgraded or uninstalled, and allows Poetry to manage its own environment. | |||
Unless <code>POETRY_HOME</code> environment variable is set, the custom installer will install the tool in <code>/Users/ovidiu/Library/Application Support/pypoetry</code> and will link the executable from <code>~/.local/bin</code>, which will have to be added to the path, unless it is there already. | |||
<syntaxhighlight lang='bash'> | <syntaxhighlight lang='bash'> | ||
# ensure the Python version is the one you want: | # ensure the Python version is the one you want: | ||
Line 19: | Line 15: | ||
# install Poetry | # install Poetry | ||
curl -sSL https://install.python-poetry.org | | curl -sSL https://install.python-poetry.org | python - | ||
</syntaxhighlight> | |||
... then add <code>/Users/ovidiu/.local/bin</code> to your <code>PATH</code>. | |||
==With <tt>brew</tt>== | |||
I had problems with this. It installs Poetry with the system Python version, which then caused some dependency installation issues. To install Poetry with a specific Python version, see [[#With_Custom_Installer|With Custom Installer]] section above. | |||
<syntaxhighlight lang='bash'> | |||
brew install poetry | |||
</syntaxhighlight> | </syntaxhighlight> | ||
=Commands= | |||
==<tt>run</tt>== | |||
Runs a command in the appropriate environment. | |||
==<tt>env</tt>== | |||
See: {{Internal|Poetry_Concepts#Virtual_Environments|Poetry Concepts | Virtual Environments}} | |||
< | ==<tt>export</tt>== | ||
Generates a <code>[[Requirements.txt#Overview|requirements.txt]]</code> file. | |||
<syntaxhighlight lang='bash'> | |||
poetry export --without-hashes --format=requirements.txt > ~/tmp/requirements.txt | |||
</syntaxhighlight> |
Latest revision as of 22:06, 9 November 2023
Internal
Installation
With Custom Installer
The custom installer installs Poetry in a new virtual environment to isolate it from the rest of your system. This ensures that dependencies will not be accidentally upgraded or uninstalled, and allows Poetry to manage its own environment.
Unless POETRY_HOME
environment variable is set, the custom installer will install the tool in /Users/ovidiu/Library/Application Support/pypoetry
and will link the executable from ~/.local/bin
, which will have to be added to the path, unless it is there already.
# ensure the Python version is the one you want:
python --version
# install Poetry
curl -sSL https://install.python-poetry.org | python -
... then add /Users/ovidiu/.local/bin
to your PATH
.
With brew
I had problems with this. It installs Poetry with the system Python version, which then caused some dependency installation issues. To install Poetry with a specific Python version, see With Custom Installer section above.
brew install poetry
Commands
run
Runs a command in the appropriate environment.
env
See:
export
Generates a requirements.txt
file.
poetry export --without-hashes --format=requirements.txt > ~/tmp/requirements.txt