Modern Python Projects Transcripts
Chapter: Let's build a package
0:00 It took us quite a few steps to publish our package on pypi.
0:04 We had to create a setup.py file,
0:06 and we had to make sure that everything is correctly set there.
0:10 And then we had to run some commands manually.
0:13 So if for some reason you don't want to write your own,
0:15 setup.py file.
0:17 But you also don't want to use poetry.
0:20 Another great tool is called flit.
0:22 All it does is it simplifies publishing packages on pypi.
0:28 You can go to the flit,
0:29 read the docs page to see the installation and user's instructions,
0:32 but there are other simple. First,
0:34 you have to install it. Then make sure you have the underscore version(__version__) file where
0:39 you specify the version of your package.
0:42 Then you can run flit in it,
0:44 and this will create the pyproject.toml file.
0:48 Here You have to specify similar options as we did.
0:50 We've setup.py So,
0:52 for example, under the build system,
0:55 you have to specify the requirements for your package,
0:58 and under the metadata, you have to specify some information about your project.
1:02 So who's the Author? What's your email.
1:05 What's the homepage and stuff like that?
1:07 The style is much more simple than setup.py.
1:11 And once you have that, you just have to run flit publish command.
1:15 It will also ask you for your pypi user name and password and then it
1:19 will publish this package. And if you want to install it locally,
1:23 you can run flit install command,
1:25 and that way you can check if your package is working fine.
1:29 So that's a very good alternative to writing setup.py filed by hand.