Poetry
Installation
conda install -c conda-forge poetryAlternatvie installation instructions: python-poetry.org
Basic usage
Set-up project
poetry new "my_project_name"Installs poetry virtual environment and sets up the required files for poetry to work. pyproject.toml contains the configuration for poetry and the needed dependencies. The new folder is there for your source code.
- Adding / installing single dependencies
poetry add package_nameUses pip to install the new package to your virtual environment and adds it to your dependencies list.
- Installing the dependencies from the .toml-file
poetry installRunning code with poetry
There are two options:
- Using poetry command
:
poetry run python your_script.py- Activating the poetry shell
:
poetry shellUsing Jupyter-Notebooks in VS-Code
- List the directory of your python interpreter:
poetry env info --pathIn python-file,
on bottom right of VS-Code window click on python-version.
In new dialogue “Select Interpreter”, click “+ Enter interpreter path”
Paste the interpreter path into the text-box.
In jupyter-notebook,
Select kernel
Select Python environment
Select the python interpreter that you just listed before.
Build and publish your package
- Build package
poetry buildThis will package your file as sdist and wheel format.
- Publish to PyPI
poetry publish