The Poetry repository can be found here and the website here.
For documentation on the pyproject.toml
file specific to Poetry, go here.
The goal of this workshop is to have a pyproject.toml
that poetry
can use
to build your package to a distribution and then publish it to a private repository.
Run the following command to install Poetry on to your machine. Don't worry, this won't pollute your system's environment
since poetry
vendorizes its dependencies.
curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python
There are several ways we can go about this tutorial and it is up to you how you want to go through it.
-
If you are already a library author using anything other than
poetry
to build and publish your package, you can take your current configuration files and translate it to apyproject.toml
. -
Similar to the above, you can take an existing Python project (for example,
python-datamuse
) and using the current configuration files of that project, translate it to apyproject.toml
. -
You can create a new Python project using Poetry using
poetry new <awesome_package_name>
and fill out the generatedpyproject.toml
file as we go along.
To build your Python package, run poetry build [-f|--format] (wheel|sdist)
. Specify the format only if you want
one or the other format.
We must first add the remote repository to the list of repositories that poetry
can publish to.
poetry config repositories.workshop http://10.66.5.80:8080/
To publish to the remote repository:
poetry publish -r workshop -u <some_username> -p <some_password>
If no arguments are passed to the publish
command, it will use PyPI
as the default repository to publish to.
Some repositories that are good examples of how to use poetry
are: