python packaging: basic setup.py and declarative metadata (intermediate) anthony explains

  Рет қаралды 49,829

anthonywritescode

anthonywritescode

Күн бұрын

Пікірлер: 58
@alexkennedy5324
@alexkennedy5324 3 жыл бұрын
This man's brain is running at a frequency that I can't even fathom. Really cool, informative video. Exactly what I'm looking for.
@anthonywritescode
@anthonywritescode 3 жыл бұрын
glad it helped!
@WatchNev
@WatchNev Жыл бұрын
This was extremely more helpful than dealing with StackOverflow jerks. Thank you for this.
@calmdo-able9925
@calmdo-able9925 2 жыл бұрын
Legendary, as basic as this is, it was something I was looking for. Top lad
@MrOxford
@MrOxford Ай бұрын
@anythonywritescode I liked this video and thought that you did a great job explaining how to do the setup file. I look forward to watching more of your content and learning how to package software correctly.
@ericng8807
@ericng8807 2 жыл бұрын
Great tutorial! It helped me setup this program called babi
@tombra4ril
@tombra4ril 3 жыл бұрын
Thanks man this was very cool and informative.
@ajinkyarathod5180
@ajinkyarathod5180 3 жыл бұрын
First I saw the video for 2 minutes, then I realized I also need to watch other things other than the keyboard. So I came to comment this and will continue the video again
@ulfgj
@ulfgj 3 жыл бұрын
at first, i though he was gonna make one project with the left hand and another with the right hand at the same time.... bummer.
@anthonywritescode
@anthonywritescode 3 жыл бұрын
hah! at one point I learned one-handed touch typing -- could get almost ~60 wpm (left hand only)
@jspreddy
@jspreddy 4 жыл бұрын
I am new to python and am trying to get up to speed on it. I understand that we could re-write a setup.cfg file easier than setup.py file, but why would we need to programmatically re-write this data in the first place? Maybe a few example cases when we would need to change this data would be helpful.
@anthonywritescode
@anthonywritescode 4 жыл бұрын
github.com/asottile/setup-cfg-fmt has a few good examples, basically if you want to format or normalize or automatically improve the setup metadata it'd be impossible with setup.py
@guntbert9709
@guntbert9709 4 жыл бұрын
Thx again - these "small" examples/tips are right what I need :thumbsup: ! What is the reason for using `exit(main))` instead of just `main()` in main.py?
@anthonywritescode
@anthonywritescode 4 жыл бұрын
I cover that in this video: kzbin.info/www/bejne/qaeXZ2VvabGihpo -- it doesn't make any difference in this particular example though
@guntbert9709
@guntbert9709 4 жыл бұрын
@@anthonywritescode got it :-))
@jfk1337
@jfk1337 2 жыл бұрын
Do you know about poetry and what do you think about such tools? And for the find packages in setup.cfg you can specify where to look, so you could do a src directory where you put your package( s) , no meed to exclude any new or other folders like docs etc.
@anthonywritescode
@anthonywritescode 2 жыл бұрын
yes, I know about poetry and the 3-4 similar tools. imo they slow down development more than helping it and poetry in particular has some very harmful opinions about versioning that make library development an absolute pain
@jbrnds
@jbrnds 3 жыл бұрын
How would you deal with automating the version in the setup.cfg when building the package if you’d have the version defined somewhere in an / __version__.py or similar.
@anthonywritescode
@anthonywritescode 3 жыл бұрын
imo don't bother, you _rarely_ need it at runtime and if you do you can retrieve it using `importlib.metadata.version('pkgname')`: kzbin.info/www/bejne/mJaneGl_l9RlsLM
@scillabiffolia4377
@scillabiffolia4377 3 жыл бұрын
what is the blue icon ad on you have in your browser. how about the one next to it?
@anthonywritescode
@anthonywritescode 3 жыл бұрын
that's probably bitwarden (password manager) and tampermonkey (user scripting engine)
@chepecarlo
@chepecarlo 3 жыл бұрын
Gracias me ayudó mucho gracias
@anthonywritescode
@anthonywritescode 3 жыл бұрын
¡de nada!
@BullishBuddy
@BullishBuddy Жыл бұрын
life saver!
@brainmri
@brainmri 3 жыл бұрын
A short tutorial on pyscaffold package will be helpful. Could you do one please? Thanks.
@anthonywritescode
@anthonywritescode 3 жыл бұрын
I've never used it personally -- I usually just use `cp` to make my new projects
@anand967
@anand967 3 жыл бұрын
If we want to declare two setup package in setup.cfg how can we do it. As it will have two "name,version,etc.
@anthonywritescode
@anthonywritescode 3 жыл бұрын
in that case you'd probably have two setup.py files (containing the `name` / `version`) that share the `setup.cfg`? seems a little bit of a weird setup though :thinking:
@RuslanKovtun
@RuslanKovtun Жыл бұрын
Link to "pyproject.toml explained" is missing (:
@anthonywritescode
@anthonywritescode Жыл бұрын
yeah, I don't use it and don't recommend it
@lonterel4704
@lonterel4704 Жыл бұрын
@@anthonywritescode why dont you like static project metadata in pyproject.toml? Even using setuptools, which is already supporting PEP621. Just curious
@vandykfernandes8356
@vandykfernandes8356 11 ай бұрын
Hi. Nice tutorial, how do we handle custom commands via cmdclass in setup.cfg?
@anthonywritescode
@anthonywritescode 11 ай бұрын
it doesn't support it -- for any non simple things you need to write them in setup py. it's a nice forcing function though
@vandykfernandes8356
@vandykfernandes8356 11 ай бұрын
@@anthonywritescode Okay, but am not understanding how it would work in python 3.12? Python now raises deprecation warnings for setuptools and calling setup.py installs. If I write it in setup.py won't it be an issue in future? Or is there a way to call commands in setup.py with pip install?
@anthonywritescode
@anthonywritescode 11 ай бұрын
setuptools is not deprecated, nor is setup.py -- the communication on this is terrible from pypa and it's leading to all sorts of misunderstandings. the things that are deprecated are distutils and calling setup.py directly. pip will do the right thing though
@vandykfernandes8356
@vandykfernandes8356 11 ай бұрын
Following is the warning I see, SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
@vandykfernandes8356
@vandykfernandes8356 11 ай бұрын
@@anthonywritescode Got it, maybe I explained myself poorly, if calling setup.py directly is deprecated and if I have custom cmds in my setup.py how do I call it without setup.py. Right now what we do is `python setup.py mycustomcommand` how should it be called when setup.py won't be allowed to be called directly?
@manoharkulat5614
@manoharkulat5614 2 жыл бұрын
hi atually I passed -e . in requirements.txt but I am getting ERROR: File "setup.py" no found.Directory cannot be installed in editable mode.
@anthonywritescode
@anthonywritescode 2 жыл бұрын
well, did you read what the error message says?
@Flyingnobull
@Flyingnobull 2 жыл бұрын
Thanks!
@Flyingnobull
@Flyingnobull 2 жыл бұрын
Wouldn't able to fix the issue without seeing the commas you added at setup.py script. - Thanks!
@meeexy116
@meeexy116 Жыл бұрын
how do you include stub (.pyi) files in the package with setuptools
@anthonywritescode
@anthonywritescode Жыл бұрын
check out these: - kzbin.info/www/bejne/mJfceqWOacSsgpo - kzbin.info/www/bejne/pGWqe2uopZt3pqc
@geekchiq5431
@geekchiq5431 Жыл бұрын
Python "package" - giggity
@PritishMishra
@PritishMishra 3 жыл бұрын
Good !!
@talalkalai8748
@talalkalai8748 2 жыл бұрын
Can u make a video explaining pkg versions in setup, specifically __version__.py file. Ive noticed both pytest/requests using it , but couldnt figure out the right way. (have a pr on the line here...)
@anthonywritescode
@anthonywritescode 2 жыл бұрын
they're using setuptools-scm which I do not recommend -- I talk about semantic versioning here: kzbin.info/www/bejne/rIO2qGWcaJmFiLc and I just write the version directly in setup.cfg as I show in this video
@talalkalai8748
@talalkalai8748 2 жыл бұрын
​@@anthonywritescode would you recommend shifting to pyproject.toml?
@anthonywritescode
@anthonywritescode 2 жыл бұрын
I'm not using it
@prafullakh
@prafullakh 2 жыл бұрын
Please help me understand the following Python behavior: def foo(): x = 1024 my_list = [1024] def helper(): x = 2048 my_list[0] = 2048 return helper() print(x) # Stuck at 1024 😞 print(my_list[0]) # Changed to 2048 🙂 return foo() Thanks!
@anthonywritescode
@anthonywritescode 2 жыл бұрын
sure! check out this video where I explain what's going on here: kzbin.info/www/bejne/m6e8gJ-KZrlqg9E
@prafullakh
@prafullakh 2 жыл бұрын
@@anthonywritescode Thank you very much. This really helped.
@PaulFidika
@PaulFidika 4 ай бұрын
Who is this guy?
@anthonywritescode
@anthonywritescode 4 ай бұрын
who me?
what is deadsnakes? (beginner - intermediate) anthony explains #058
7:29
anthonywritescode
Рет қаралды 4,3 М.
my python project setup (+ all tools) (intermediate) anthony explains #396
31:38
Cool Parenting Gadget Against Mosquitos! 🦟👶 #gen
00:21
TheSoul Music Family
Рет қаралды 30 МЛН
didn't manage to catch the ball #tiktok
00:19
Анастасия Тарасова
Рет қаралды 33 МЛН
啊?就这么水灵灵的穿上了?
00:18
一航1
Рет қаралды 65 МЛН
what are python wheels? (intermediate - advanced) anthony explains #371
22:47
how should I organize my project? (beginner) anthony explains #506
10:02
anthonywritescode
Рет қаралды 13 М.
25 nooby Python habits you need to ditch
9:12
mCoding
Рет қаралды 1,8 МЛН
This Is Why Python Data Classes Are Awesome
22:19
ArjanCodes
Рет қаралды 810 М.
Wheel Files: Packaging Python Applications & Modules
21:10
NeuralNine
Рет қаралды 24 М.
Cool Parenting Gadget Against Mosquitos! 🦟👶 #gen
00:21
TheSoul Music Family
Рет қаралды 30 МЛН