How to Build a Complete Python Package Step-by-Step

preview_player
Показать описание
Do you want to know how to build a complete Python package? Well, look no further! This video will take you step-by-step through the entire process, from creating your project to publishing it on PyPI.

🎓 Courses:

👍 If you enjoyed this content, give this video a like. If you want to watch more of my upcoming videos, consider subscribing to my channel!

👀 Code reviewers:
- Yoriz
- Ryan Laursen
- James Dooley
- Dale Hagglund

🔖 Chapters:
0:00 Intro
1:10 Code example
3:18 Example use cases
4:31 Setuptools package
10:38 Building and installing a package
12:27 Introducing PyPI
13:54 Publishing the package on PyPI
16:13 Retrospective
19:57 Outro

#arjancodes #softwaredesign #python

DISCLAIMER - The links in this description might be affiliate links. If you purchase a product or service through one of those links, I may receive a small commission. There is no additional charge to you. Thanks for supporting my channel so I can continue to provide you with free content each week!
Рекомендации по теме
Комментарии
Автор

Man, you are taking Python learning to the next level. I am a big fan of your videos.

yahyamlaouhi
Автор

I have been learning so much from you. You Not just python but how to gain job ready skills. I used to be afraid that I do not know how to use any of the python I learned. You bring this down to earth with clear succinct and byte sized lessons. THANK YOU! 🙏

krimsonsun
Автор

Thank you Arjan! It's so valuable to have all of this concentrated into a single video.

Impatient_Ape
Автор

Thanks Arjan! Have you ever used declarative metadata? What are their (dis)advantages compared to setuptools?

dimboump
Автор

thanks so much Arjan! Stars aligned, I had put knowledge about Python packaging on my to-do list this week haha. All the best!

pepecopter
Автор

Excellent tutorial as always. Do you have any plans for a tutorial to distribute a python application for win/mac/linux (not just a single package)? Ideally through some kind of automated github pipeline.

UNgineering
Автор

This is amazing information. I believe this will be a great addition( having a course in details) to one of your amazing course library.

adityamathur
Автор

Great video! A good follow up would be good to configure the package with `setup.cfg` or the `.toml` file. The community it's trying to move away from `setup.py` because of security concerns about arbitrary code execution 👍

virtualraider
Автор

Packaging is by far the most challenging aspect of Python for me. This helped quite a lot though, thanks

JensN
Автор

I personally love poetry :) Never learnt the other ways of code packing - so this is neat to know! Thanks.

realplod
Автор

Excellent video, Man. keep it up!
I'm eager to watch a video you explain about meta class and meta-programming!

PavithraSuLa
Автор

Thank you for the assistance. I found it incredibly helpful. Suppose I have developed an application that is functioning perfectly on my machine. Now, I would like to obtain comprehensive information about the versions of all the requirements and ensure their accuracy. To achieve this, I used the "pip freeze" command to retrieve the versions of the libraries I utilized. I would appreciate your confirmation on whether this is considered a correct practice or if there are any alternative methods you would recommend.

Didanihaaaa
Автор

Wanna learn framework building process. Thanks for this awesome tutorial ❤️

mahbub_bro
Автор

Finally, a simple and straightforward approach to do it. Thanks for sharing!

KonstantinosAntonopoulos-pqqm
Автор

@11:00 I like to install the package like this: pip install -e .

The e flag makes it "editable" so while you continue developing any changes you make will be picked up.

qwertyuiopsdfgh
Автор

Yay, a code roast! XD

There is one big thing that I think I would still do: turn this into a package. Currently, you just have a collection of modules, but you have a proper package. It’s super easy to do with poetry. Why?
• Better separation between the library code (in src/my_package) and the main script (main.py lives outside).
• But instead of a script, you can also create a simple CLI, and for that, having a package will greatly help too
• Right now, running the main application and the tests ONLY WORKS because you run them from the root folder. But imports in the tests would fail if you were to run them from inside the test folder. And you cannot move the main.py elsewhere. Having a package removes those limitations, as you would import from the package in the tests and the scripts. The imports will always work because you have installed the package in your environment, so python knows where to look.
• And as a bonus, this would FIX your red-lines issues in your IDE! I guess what happens is that Pylint is having trouble locations the modules you import. Usually imports work a lot better with packages. BTW, if you have a poetry environment, you have to tell VSCode to use it (cmd palette > Select Python Environment)
I hope I convinced you 😊

Also, one more thing FYI: you have OUTPUT_TYPE = “visualizer” # “visualizer” | ”console”. Right now, the type of this variable would be inferred as string, but if you want to more precisely define it, you can do it like this: “OUTPUT_TYPE: Literal[“visualizer”] | Literal[“console”] = “visualizer”, and Literal imported from typing. However, I’m not sure I really recommend this approach, I wonder if a StrEnum wouldn’t be better…

Okay, thanks for reading if you made it here 😊 And thank you again for the video 😊

loic
Автор

That video was superb. I was so intersting that I forgot to like it in the first place. full of useful information and pro-tips. I just returned to like and leave a comment. Thanks a million.

naderbazyari
Автор

Rien a dire si ce n'est MERCI.Tres satisfaisant vos contenus.👍

daoudakone
Автор

Great outline. I'm building some common modules at work and this will allow me to easily share with my colleagues

jhillyt
Автор

Great video talking about the built in abilities of Python packaging! conda is a neat option too!

christensencode
welcome to shbcf.ru