Modern Python Projects Transcripts
Chapter: Managing Python project
Lecture: Publishing package with Poetry
0:00 One last thing that I want to show you, is how to build a python package
0:03 with poetry. Normally, when you want to create a python package by hand,
0:07 you go to the python packaging User guide,
0:10 and you follow instructions from there.
0:13 First you need to create a setup.py file.
0:18 Then you need to install setup tools and wheel that you will use to generate
0:22 the sdist and bdist_wheel folders.
0:26 Then you need to install another tool called twine,
0:29 and finally you will have to use the tool to upload your package to pypi
0:33 The instructions are very detailed and rather easy to follow,
0:38 but there is no way I would remember all those steps of the top of my
0:41 head, unless I build and publish a lot of python packages,
0:45 which I don't. Let's compare this to using poetry.
0:48 First we run poetry build. Then we run poetry publish,
0:56 and that's all two commands, with the most obvious names possible built and publish.
1:01 As you can see, the publish command asked me for a Username and password
1:05 for PyPI. So if you want to publish your package,
1:08 need to first go to the pypi website and create an account.
1:12 This example Folder contains some rubbish files,
1:14 so I'm obviously not going to publish it.
1:17 But at the end of this course where we will be building a real python application
1:20 I will show you how you can build and publish a PyPI package, so stay tuned.