Тёмный

How to Publish a Python Package to PyPI (pip) 

pixegami
Подписаться 39 тыс.
Просмотров 16 тыс.
50% 1

Learn how to publish your own custom Python package to PyPI.
This tutorial covers setting up the project, configuring the setup.py file, building and testing the package, adding CLI functionality, publishing to PyPI, and installing using pip. Watch this video if you want to share your code and make it easily installable for others.
📚 Chapters
00:00 Introduction
00:34 Project Setup
02:06 Configure and Build Package
04:14 Local Testing
05:53 Adding a CLI Entry Point
07:36 Publish to PyPI
10:01 Wrapping Up
#pixegami #python

Опубликовано:

 

4 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 77   
@shivuveerkumar
@shivuveerkumar 5 месяцев назад
Bro seriously one of the best video on RU-vid
@2dapoint424
@2dapoint424 2 месяца назад
The best video!! Short and concise!! Thank you sharing this!
@aadilzikre
@aadilzikre 2 месяца назад
Thank you for the Guidance. I was able to create the package without much googling!!
@pixegami
@pixegami 2 месяца назад
Awesome, glad to hear that!
@muhammadqaisarali
@muhammadqaisarali 8 месяцев назад
Thanks man, it was straight forward
@typehint
@typehint 22 дня назад
This is an absolutely fantastic tutorial. Thanks for this!
@pythonantole9892
@pythonantole9892 9 месяцев назад
I'm surprised at how easy this is. I'm motivated to bundle some of my scripts into packages.
@danielvega646
@danielvega646 9 месяцев назад
actually npm is way better and straightforward. This part of creating a token on pypi was a whole issue for me
@pixegami
@pixegami 8 месяцев назад
Sometimes I do wish Python's package management/environment was as integrated as Node :)
@pixegami
@pixegami 8 месяцев назад
Yup! This can be useful if you if you need to re-use scripts or to share them with your team.
@rafaelfonseca7942
@rafaelfonseca7942 5 месяцев назад
Helpful video... came in handy for me here! Thanks!
@pixegami
@pixegami 5 месяцев назад
Thank you! I'm glad to hear that :)
@DamoOne
@DamoOne 7 месяцев назад
Really well explained, thanks!
@pixegami
@pixegami 6 месяцев назад
Glad it was helpful!
@Valer_100
@Valer_100 27 дней назад
Really useful tutorial! It was very easy to understand.
@tarangsuri8932
@tarangsuri8932 Месяц назад
Great tutorial, Thanks!
@bgd_surf
@bgd_surf 8 месяцев назад
awesome!!
@EvanRickettsUk
@EvanRickettsUk 2 месяца назад
This was great, thank you!
@pixegami
@pixegami 2 месяца назад
Glad you enjoyed it!
@TaerimYoon
@TaerimYoon 21 день назад
Best video! Thank you!
@marsbars1105
@marsbars1105 3 месяца назад
This is such a great video! Thankyou very much!
@pixegami
@pixegami 2 месяца назад
Glad it was helpful!
@paloha
@paloha Месяц назад
Very well made video. Thanks
@luishenriquelopesteodoro1921
@luishenriquelopesteodoro1921 5 месяцев назад
Excellent
@Happyendrew
@Happyendrew 2 месяца назад
Thanks a lot!
@sg8nj
@sg8nj 18 дней назад
Great work
@pablomunsey
@pablomunsey 4 месяца назад
Concise and to the point. I keep revisiting it as I progress. Would like to see a compatible one usng a pyproject.toml.
@pixegami
@pixegami 3 месяца назад
Thank you, glad it's helpful! I need to take a look at using the toml format, I haven't used it before.
@mrpizzakingman4604
@mrpizzakingman4604 5 месяцев назад
just what i need :D
@pixegami
@pixegami 5 месяцев назад
Glad to hear that :)
@slipthetrap
@slipthetrap 4 месяца назад
Is this all that is needed to also do: pipx install pixegami-hello ... for example? Thanks for the videos.
@xsamueljr
@xsamueljr 9 месяцев назад
If my package is in a github repository, and I want to use `pip install git+[some link].git`, do I need to commit and push the wheel files?
@Chuukwudi
@Chuukwudi 5 дней назад
Important question. Have you found an answer?
@xsamueljr
@xsamueljr 4 дня назад
​@@Chuukwudi I think you don't need to push the wheel files (mainly because I was able to install a package that didn't have them), but I'm not entirely sure
@paradoxial7665
@paradoxial7665 2 месяца назад
So I installed my library and when I import it to a file to test, everything works fine when I run the code, however Pylance says the module doesn't exist but when the code is ran, it works just fine? I wonder why??
@richardalphonse2680
@richardalphonse2680 6 месяцев назад
Well Explained , thanks I Have doubt in terms of loading json data within folder structure and reading it wihthin a function how it can excuted can you help me with this
@pixegami
@pixegami 5 месяцев назад
First, you need to configure your setuptools to include data files like JSON: docs.python.org/3.8/distutils/setupscript.html#installing-additional-files Then it'll be packaged along with your Python scripts, and you can just call/use it from there.
@_aade
@_aade 5 месяцев назад
Is there a way to change the version number automatically?
@pixegami
@pixegami 5 месяцев назад
Yeah, I'd recommend implementing this as something like a Git hook maybe for minor/patch version number.
@_aade
@_aade 5 месяцев назад
Will there be a problem if I delete previous versions?
@pixegami
@pixegami 5 месяцев назад
Generally, I don't think you're meant to delete previous versions, but I'm sure it'll be fine if you have to do it (I haven't tried it out myself though).
@prajganesh
@prajganesh 9 месяцев назад
Great one. side topic. Can you tell us which tool you use to create the youtube thumbnail? thanks.
@pixegami
@pixegami 8 месяцев назад
Thanks! I use Photoshop for the thumbnails.
@gokulyc
@gokulyc 9 месяцев назад
can you make using hatch package manager
@lookingoffswitch4344
@lookingoffswitch4344 Месяц назад
Should "pip install setuptools wheel twice" be done in my project's virtual environment or should these libraries be installed into my global Python environment? TIA!
@niklyons9674
@niklyons9674 20 дней назад
This is awesome information. I have a script I'm looking do download on a Windows system and a Linux system. Are you able to run this packages on a CronJob for Linux and task scheduler for Windows Machines?
@pranav_arya
@pranav_arya 2 месяца назад
which plugin or app you are using for VS Code terminal autocomplete suggestions?
@pixegami
@pixegami 2 месяца назад
It's GitHub Co-Pilot.
@pranav_arya
@pranav_arya 2 месяца назад
​@@pixegami Thanks for responding. Are you using the fish terminal?
@_aade
@_aade 5 месяцев назад
Why do we have to use twine?
@pixegami
@pixegami 5 месяцев назад
I don't think we have to use it, but it was just the easiest/recommended way I found online of how to actually upload the local content to the remote repository.
@_aade
@_aade 5 месяцев назад
Thank you, my friend, I am grateful to you for answering all three of my questions :)@@pixegami
@tellezgerardoruben5202
@tellezgerardoruben5202 6 дней назад
Is possible to make this work with extensions made in another language like C?
@Tcrrxzz
@Tcrrxzz 7 месяцев назад
But the entry_points isn't a setup parameter? please explain it!! thanks
@shubhamshastri7409
@shubhamshastri7409 5 месяцев назад
i am able to do this but what if i want my package to be uploaded privately , one only with auth can able to install it with pip
@pixegami
@pixegami 5 месяцев назад
I think you can upload to your own private repository for that. You'll probably have to look up how to set up your own private PyPI server.
@cristiandiaz3551
@cristiandiaz3551 4 месяца назад
hey men, im do the same but my project have some dependencies, it work localy but but i try to install form pypi it dont install the dependacies, can you help me ?
@pixegami
@pixegami 4 месяца назад
Have you tried adding them to `install_requires`? See here: python-packaging.readthedocs.io/en/latest/dependencies.html
@HashtagTiluda
@HashtagTiluda 3 месяца назад
A quick question, what if I want to pass a string to the hello function?
@pixegami
@pixegami 3 месяца назад
If you wanna use it as a library, then it's just a normal function (so you can add an argument to it, and use it after you import it). If you wanna use it like a CLI (from the terminal), you can do it using a library like argparse: docs.python.org/3/library/argparse.html#module-argparse
@HashtagTiluda
@HashtagTiluda 3 месяца назад
@@pixegami thank you!
@anirbansom6682
@anirbansom6682 Месяц назад
How to create a CLI Command which will accept arguments ? Like, pixegami-hello --file_name /file/path/
@pixegami
@pixegami Месяц назад
This is how you wire up scripts to command: python-packaging.readthedocs.io/en/latest/command-line-scripts.html If you want to parse arguments, use this built-in library: docs.python.org/3/library/argparse.html
@ishanoshada
@ishanoshada 8 месяцев назад
How to totp verification do???
@pixegami
@pixegami 8 месяцев назад
Hmm, is this part of the package publishing workflow, or is this for something different?
@ishanoshada
@ishanoshada 8 месяцев назад
@@pixegami pypi verification
@Investmentpunk1
@Investmentpunk1 6 дней назад
Can you please redo that video with the pyproject.toml and poetry, since it is the industry standard nowadays. Thank you :)
@prashantmeti7986
@prashantmeti7986 2 месяца назад
I didn't get how and where to export the token and api key please tell me
@pixegami
@pixegami 2 месяца назад
It's just environment variables, so if you're not familair with them, search "how do I set environments in Linux/Mac/Windows?" (or whichever OS you are using) on Google. Good luck!
@AbtinDar
@AbtinDar 4 месяца назад
String library is not installed
@DioneAl-Farisi
@DioneAl-Farisi Месяц назад
I can't install twine
@TechnicalLodhiOfficial
@TechnicalLodhiOfficial 3 месяца назад
Bro I can't understand how setup environment variable ( 8:14 ) Can you please clarify that?
@pixegami
@pixegami 2 месяца назад
There's lots of ways to set an environment variable. It's basically a variable that is set at the OS level, and shared with all processes in that terminal/application context. I'd recommend to Google "how do I set up environment variables on Linux/Mac/Windows? (or whichever OS you are on)" and follow those instructions.
@TechnicalLodhiOfficial
@TechnicalLodhiOfficial 2 месяца назад
@@pixegami I googled it and found out the results Thanks!
@thetaomegatheta
@thetaomegatheta 14 дней назад
5:00 Nope. Does not work. Neither the python CLI, nor other projects can see anything in the package after installation. Furthermore, `__init__.py` even claims that the imports are unused. When trying to import anything from the package after the installation, it throws ModuleNotFoundError: No module named 'my-library'.
@seesmof
@seesmof Месяц назад
Hallelujah thank YOU Jesus Christ our Holy Lord GOD Almighty ✝❣ GOD bless you, great video, very straightforward, may Jesus Christ our Holy Lord GOD Almighty bless you and keep you, may GOD make His face shine upon you and be gracious to you, may King Jesus Christ our Lord lift up His face to you and give you peace in JESUS HOLY Name we pray LORD GOD, AMEN be saved from hell: repent of your sins and put your faith alone in Jesus Christ our Lord ✝💞
Далее
Бмв сгорела , это нормально?
01:01
15 Python Libraries You Should Know About
14:54
Просмотров 378 тыс.
5 Good Python Habits
17:35
Просмотров 468 тыс.
How to Create Python Package and Upload to PyPi
19:56
Просмотров 1,8 тыс.
Python RAG Tutorial (with Local LLMs): AI For Your PDFs
21:33
Creating your first PyPI package
27:42
Просмотров 7 тыс.
Why Developers Are OBSESSED With Obsidian
11:26
Просмотров 45 тыс.
Бмв сгорела , это нормально?
01:01