Modern Python Projects Transcripts
Chapter: Let's build a package
Lecture: Flit

Login or purchase this course to watch this video and the rest of the course contents.
0:00 It took us quite a few steps to publish our package on pypi. We had to create a setup.py file,
0:07 and we had to make sure that everything is correctly set there. And then we had to run some commands manually.
0:14 So if for some reason you don't want to write your own, setup.py file. But you also don't want to use poetry. Another great tool is called flit.
0:23 All it does is it simplifies publishing packages on pypi. You can go to the flit, read the docs page to see the installation and user's instructions,
0:33 but there are other simple. First, you have to install it. Then make sure you have the underscore version(__version__) file where
0:40 you specify the version of your package. Then you can run flit in it, and this will create the pyproject.toml file.
0:49 Here You have to specify similar options as we did. We've setup.py So, for example, under the build system,
0:56 you have to specify the requirements for your package, and under the metadata, you have to specify some information about your project.
1:03 So who's the Author? What's your email. What's the homepage and stuff like that? The style is much more simple than setup.py.
1:12 And once you have that, you just have to run flit publish command. It will also ask you for your pypi user name and password and then it
1:20 will publish this package. And if you want to install it locally, you can run flit install command,
1:26 and that way you can check if your package is working fine. So that's a very good alternative to writing setup.py filed by hand.


Talk Python's Mastodon Michael Kennedy's Mastodon