Тёмный

Pythonizing Imgui (feat. Cython) and contributing to open source. 

mCoding
Подписаться 232 тыс.
Просмотров 95 тыс.
50% 1

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

 

17 сен 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 178   
@KinxKlark
@KinxKlark 2 года назад
Hey, youtube just suggested me that, I didn't realize you were making videos. Great stuff and thanks again for the help! Indeed pyimgui is currently too close to the cpp dearimgui and would gain to be more inline with the python way. I am hoping to push it in this diretion. :)
@mCoding
@mCoding 2 года назад
For anyone who doesn't know, Kinox is the maintainer of pyimgui, so show your thanks!
@SpaghettDev
@SpaghettDev 2 года назад
thank you so much for this awesome module!
@john.dough.
@john.dough. 2 года назад
omg thanks for all your hard work
@DiddleDangle
@DiddleDangle Год назад
What an absolute beast.
@ciscoortega9789
@ciscoortega9789 2 года назад
Awesome video! I genuinely feel like this is something most programmers need to see demoed for them. It's such a vital process that I suppose most people just try to "figure out" on their own and end up making many embarrassing mistakes. Great resource video, and I'm pretty sure I will be referring people to it when they ask about the process of contributing to open-source projects :))
@ciscoortega9789
@ciscoortega9789 2 года назад
I wonder if perhaps this could benefit from being more explicit in the title that this is about the process of contributing to open-source projects? I clicked on this thinking that it would just be a showcase of Imgui and its features (ty for the recommendation btw)
@mCoding
@mCoding 2 года назад
Good point! Done
@Josh-ui7nq
@Josh-ui7nq 2 года назад
Great, love to see the process of suggesting and implementing a new and useful feature
@sgazda_
@sgazda_ 2 года назад
There's also DearPyGui. " Dear PyGui is NOT a wrapping of Dear ImGui in the normal sense. It is a library built with Dear ImGui."
@jecaballeror
@jecaballeror 2 года назад
You're a true MVP. Also, I cracked at the end with that jk. I can only imagine the pain when seeing how much of those there were. As always, great content! A couple if days ago, i sent some of my students your way, i hope they see the Light with your Teachings
@mCoding
@mCoding 2 года назад
Many thanks! Glad you enjoyed.
@Cookie-mv2hg
@Cookie-mv2hg 2 года назад
This is the first time I see how library is developed with random people online and I'm impressed!!
@mCoding
@mCoding 2 года назад
Welcome to the club! I hope I've set a decent example for you.
@coarse_snad
@coarse_snad 2 года назад
The fact that I now feel really motivated to contribute to something open source is evidence of a well structured video. I also feel a sudden urge to convert my work project from a CLI to a GUI application... Not sure if that is such a necessary thing though :|
@coarse_snad
@coarse_snad 2 года назад
Also, is the purpose of Cython to compile C/C++ code with the syntax of Python so that people unfamiliar with such languages get an easier introduction? Or is it perhaps something more subtle?
@mCoding
@mCoding 2 года назад
Cython serves a dual purpose of allowing you to write Python C extensions using Pythonish syntax, as well as allowing you to easily interface with native C and C++ code. The reason for wanting to write Python C extensions is to take advantage of the fact that C compilers do optimization, whereas the Python compiler basically does not.
@coarse_snad
@coarse_snad 2 года назад
@@mCoding Interesting... How much usage does Cython see? I've sadly never heard about it before, so I'm presuming it's quite niche? Or maybe I have a talent for avoiding interesting things.
@SkrtlIl
@SkrtlIl 2 года назад
@@coarse_snad It finds heavy usage in tons of frameworks for the given two use cases, but is typically implemented privately with a public interface (like shown here) so you don't notice it as a regular user/non contributor.
@tobiasbergkvist4520
@tobiasbergkvist4520 2 года назад
@@coarse_snad You don't need to do manual reference counting in Cython (Py_INCREF/Py_DECREF), as compared to when writing Python C extensions. There is also less boilerplate.
@alperengencoglu5367
@alperengencoglu5367 2 года назад
7:15 I really would like to see some videos about Cython from you in the future. Great video as always, thanks!
@viliamklein
@viliamklein 2 года назад
I really like how this video includes subtle (and direct) hints on how to behave in the open source community.
@weekendforever
@weekendforever 2 года назад
Just the other day I was wondering why I still haven't seen some code-RU-vidr who was applying what they want to show to a open source project. I hope you get many internet points for this.
@nothingiseverperfect
@nothingiseverperfect 2 года назад
Wow, I hardly understand what’s going on, but it is all super interesting. I especially enjoyed the part at 6:00 of how you showed how you submitted a pull request, and how you documented your new implementation idea. This was incredible insightful and your documentation of your process and what you hope to do was fantastic. Also loved how you mentioned how you tested your code. The process of implementing your code was so through. Hope go get where you are! Thank you for this! I’ve got a lot to learn 😭😭
@mathijsdejong6416
@mathijsdejong6416 2 года назад
Great video! As mentioned by others in the comments, it's very useful to be able to follow your thought process when encountering a problem in software and how you solved it. Really enjoying and learning a ton from your amazing videos!
@mCoding
@mCoding 2 года назад
Thanks so much!
@Omaryllo
@Omaryllo 2 года назад
Yes please i want a Cython tutorial. There is no other place to find knowledge this densely packed and valuable
@Tomyb15
@Tomyb15 2 года назад
This is the second time I've seen great developers that I trust recommend Dear I'm Gui (first one was from The Cherno's channel!) But I have to say, I'm still not sold on Immediate GUIs. Having to do every little thing seems to go against the idea of having a library to abstract away the logic. I will nonetheless still give it a try because the end result looks very good.
@erfer
@erfer 2 года назад
I find that immediate mode GUI's are most useful when you are already doing quite a bit of things yourself or are doing something with many updates (e.g. games / rendering) so that you can integrate it closely with the actual data
@paulhemebert496
@paulhemebert496 2 года назад
Awesome video! A Cython introduction would be very cool.
@dharma4248
@dharma4248 2 года назад
I've used imgui pretty often with C++ projects and I never knew I could use it with python too. Now even more easily! Thank you
@pratikmahamuni4856
@pratikmahamuni4856 2 года назад
A great tutorial not just for Cython, ImGUI but also how to contribute to open source projects! Kudos. Thank you.
@ConstantlyDamaged
@ConstantlyDamaged 2 года назад
As someone who mostly does web-dev that others build the interfaces for, let me just hide in the corner and reeeee-but still admire your use of pythonic ideals.
@dennyw17
@dennyw17 2 года назад
Very cool walk through of both the module and the contribution!
2 года назад
Amazing work, man. They should have made it like this from the outset, and it's great to see you helped them check that box. This video is also a great promo for Pyimgui; although I never consider making guis in Python, now you made me want to try. Keep up the great work.
@bettercalldelta
@bettercalldelta 2 года назад
Thanks to you, I successfully made "with" support for my project
@mCoding
@mCoding 2 года назад
Awesome!
@PeterSeres
@PeterSeres 2 года назад
Hey James!! Great video, great resource and I've finally got a little bit of understanding of what Cython is. Just letting you know that I would really appreciate a Cython overview if one day you have the time and patience. Cheers!!!
@oeerturk
@oeerturk Год назад
open source contribution videos are reeaaalllllllly appreciated and needed imo
@embeddor3023
@embeddor3023 2 года назад
4:33 Everytime I talk with a C programmer about RAII.
@TheMcSebi
@TheMcSebi 2 года назад
wow, I just learned about Imgui through this video and it actually made me consider using this for my next project that requires a gui.
@masheroz
@masheroz 2 года назад
I'm trying to learn c++and have a project planned out. Imgui and implot will feature.
@sadhlife
@sadhlife 2 года назад
Afaik there's no proper tutorials for cython on youtube. An in-depth course be a really good resource.
@AngryArmadillo
@AngryArmadillo 2 года назад
Excellent video! Excited to see this get merged. I’ll definitely try out pyimgui
@ohwow2074
@ohwow2074 2 года назад
Please please make more videos about advanced C++ techniques. The last one you did was an eye opener 🙂.
@philosophiabme
@philosophiabme 2 года назад
Great video!!! We need more emphasis on code literacy and comprehension skills. To write code you have to be able to read code!
@rishabhanand4270
@rishabhanand4270 2 года назад
damn it's so easy to use this library. plus, contributing to open source is always great, although I feel you did a lot for one PR (but it kinda checks out i would say)
@scottk3292
@scottk3292 Год назад
Major LOL on updating the docs later! Reminds me of my contract work at Google. My team manager wouldn't approve any code pushes until we'd verified that we'd updated the docs.
@Firigion
@Firigion 2 года назад
My exact thoughts when I saw the begin and end statements! That is begging for a context manager.
@Epinardscaramel
@Epinardscaramel 2 года назад
0:39 love the Python emoji mashup 😅
@vt2788
@vt2788 Год назад
Great stuff! This is what separates the top programmers from the rest of us ;)
@Omaryllo
@Omaryllo 2 года назад
I made a PR once for a change i needed without asking. It would fail many tests and the syntax was newer JS code that they didn't support. I got it at the end and it was actually merged after 3 tries though. Don't be a knucklehead like me :D
@joffreybluthe7906
@joffreybluthe7906 2 года назад
Some of your stuff is too advanced for me, but my goodness your channel is gold This is exactly the kind of material I was looking for to become a better programmer (citizen 😉)
@mCoding
@mCoding 2 года назад
You will get there in time :) just keep at it!
@joffreybluthe7906
@joffreybluthe7906 2 года назад
@@mCoding thx man :)
@mattiasbermellrudfeldt570
@mattiasbermellrudfeldt570 2 года назад
Great video, thanks! I've used cython to speed up the slowest part of a open source project I'm contributing to. I struggled a lot getting started and still do from time to time. I'd love to see your take on it! All the best! :)
@Rohrschacht
@Rohrschacht 2 года назад
C++ fan commenting now as requested! Python is also awesome though :D
@Phaust94
@Phaust94 Год назад
Thanks James! Great content, as always! It doesn't seem that daunting to contribute to open source projects anymore
@novoehuevoe9340
@novoehuevoe9340 2 года назад
Oh, man. I really want to see Cython tutorial
@Scranny
@Scranny 2 года назад
Yes! Please do a Cython tutorial. As a longtime Python programmer, I would like to know in which use cases it might be useful to me to write my code in Cython instead.
@SkyFly19853
@SkyFly19853 2 года назад
I hope you will make more videos on Cython.
@adamhenriksson6007
@adamhenriksson6007 2 года назад
Looks like streamlit. I really like that style of GUI programming
@drygordspellweaver8761
@drygordspellweaver8761 Год назад
James, can you please elaborate on what you feel is the best practice for implementing multi-threaded functionality with the imGUI event loop in Python? For example, say I have a UI for managing multiple servers and I am using the select module to check for socket read/writes. I press a button and send a command to one of the servers etc. Should the imGUI event loop be run in its own separate Thread from the socket loop? (PyQT incessantly crashed when I tried this). If so, what would the best method of 'communication' be between these two loops? IPC? Or adding commands to a queue then processing this in a third event loop separate from both imGUI and the socket loop? On that note, should any performant task be handled in the imGUI loop or will that slow down the rendering? I am assuming most people just call a function and that command gets passed to another thread where it can run asynchronously from the rendering? Thanks in advance!
@mCoding
@mCoding Год назад
Hi Drygord, great question! Typically the imgui event loop runs on the main thread, as is typical for most guis. Waiting on sockets using select (or more commonly the higher-level interface in the selectors module) should be done off the main thread. When the socket thread has some data for the main thread, set an Event and if it is set, have the main thread grab a Lock and take ownership of the data. I'm available for consulting :) mcoding.io.
@drygordspellweaver8761
@drygordspellweaver8761 Год назад
@@mCoding Hey thanks for the reply! I will keep your consulting services in mind, as you seem like a great tutor. Cheers!
@97jackroma
@97jackroma 2 года назад
This made me very interested about Cython
@abismayn
@abismayn 2 года назад
way more than i expected from just reading the title :) Great job!
@UnexpectedMaker
@UnexpectedMaker 2 года назад
Great stuff, and a much needed addition to the library! Also very well explained.
@lepsycho3691
@lepsycho3691 2 года назад
That's amazing! It shed light on a problem when I had when I tried to use the with context manager with a python program that did not implement it!
@ltc0060
@ltc0060 2 года назад
This is a great video. I really appreciate it, thanks! I want to contribute to open source, but I have no idea how (or even where to start). If you can invest your time into how-to videos of contributing to open-source (the way it should be), that I believe, would be very beneficial to our community. Even if you don't have the time for other videos, thank you for this one!
@babatona
@babatona 2 года назад
Thanks, I never seen such cool C++ Ui library and what is even more cooler is that you made a video on it with python Edit: I have 140+ errors. I imported the library and everything but it says that for example it can't find imgui.io or something method
@prawnydagrate
@prawnydagrate 2 года назад
you deserve more recognition
@Alche_mist
@Alche_mist 2 года назад
Nice, this PyImgui thing seems like a useful alternative to my beloved PySimpleGUI (which is a nice pythonic wrapper around tkinter, PyQt, WxPython or Remy).
@cleverclover7
@cleverclover7 2 года назад
lol at the end! i typically used tkinter for stuff like this in the past, but imgui seems way cooler, especially now that you can use it more pythonically.
@roryglenn3612
@roryglenn3612 2 года назад
Always a great time James!
@vxsniffer
@vxsniffer 2 года назад
I've discovered DearPyGUI recently, and have to admit, GUIs were never so easy before (with Tkinter, PyQt or else)... big thumbs up for Jonathan Hoffstadt and Preston Cothren for making imGui framework available in Python!
@__jan
@__jan 2 года назад
A showcase of Cython would be really nice!
@Khushpich
@Khushpich 2 года назад
Great content as always. Best non trivial python content on RU-vid.
@whamer100
@whamer100 2 года назад
you just made my one reason i didnt want to use pyimgui the reason i want to use pyimgui now 👀
@danielrhouck
@danielrhouck 2 года назад
Why didn’t you inherit from `tuple` or a non-typing `collections.namedtuple`? That way you don’t have to manually write (part) of the tuple functionality, and miss other parts. Is that harder in Cython?
@mCoding
@mCoding 2 года назад
Tuple's elements are not named and i dont think i can expose them easily with names. Even if i could like namedtuple, namedtuple stores pyobject*s, not C bools so it wont be as efficient, and i dont want other tuple functionality like all the comparison operations. Theoretically it would have been fine to use tuple or namedtuple, they just didnt quite fit my needs.
@danielrhouck
@danielrhouck 2 года назад
@@mCoding You were careful to allow iterating though; I guess that’s used somewhere? Edit: oops I missed where you mentioned it’s for unpacking
@mCoding
@mCoding 2 года назад
Yes, the idea was that even though I don't want this object to have tuple semantics, previously it did and i don't want too break much old code, which very commonly does things like opened, selected = imgui.begin(...)
@aaronm6675
@aaronm6675 2 года назад
Love to see this kind of instructive and compelling stuff. Thx!
@TheChemicalWorkshop
@TheChemicalWorkshop 2 года назад
finally a pythonic gui... other ones were ehhh, not so pythonic
@comradestinger
@comradestinger 2 года назад
Really great video! love the idea of using the 'with' for making sure end() gets called I know it's not the point of the video, but here's a tiiiiny nitpick (I couldn't help myself I'm sorry, feel free to ignore xD) I think you got Imperative and Declarative the wrong way around at 2:50? Dear Imgui runs from start to end, "one thing after another", IE, Imperative. While the initializing everything at startup, "Declaring" the behaviour then letting it do its thing on its own, would be a declarative style.
@krishnamenon6288
@krishnamenon6288 2 года назад
1:16 Jetbrains Mono? Just a shot in the dark ;)
@simentorseth
@simentorseth 2 года назад
you're correct
@mystisification
@mystisification 2 года назад
very informative, thanks James! Seems like you had to do a lot of legwork just to run the tests, why is that?
@mCoding
@mCoding 2 года назад
Good question! Because Cython code must be compiled like C or C++ code, I can't just make a change in the code and re run the tests immediately. I have to recompile the library and install it again after every change (that's what pip install -e . -v does in this case). That actually involves recompiling the 11k lines of Pyimgui code as well as the even larger imgui C++ code, which is why it took so long.
@mystisification
@mystisification 2 года назад
@@mCoding But that's strange, isn't there a build file à la Makefile/CMake to only rebuild the relevant parts?
@MrTyty527
@MrTyty527 2 года назад
I see you are low-key adding more humor in your video haha
@zacharymiller7573
@zacharymiller7573 2 года назад
This is so sweet I love imgui in C++ but now I’ll have to try it in python
@cefqrn9494
@cefqrn9494 2 года назад
1:16 Consolas?
@freddupont3597
@freddupont3597 2 года назад
LOL the documentation got the usual treatm
@antoniolewis1016
@antoniolewis1016 2 года назад
You earned my sub. Thank you for your clear presentation!!
@royz_1
@royz_1 2 года назад
I am intrigued to give this a try. It's far better than tkinter in terms of developer experience (even though it's a bit hacky). Pyqt5 still holds the first place in my opinion.
@yash1152
@yash1152 5 месяцев назад
8:47 > _"out parameters"_ niiice
@nimerkees7907
@nimerkees7907 2 года назад
Besides the superb content you create. I watch your videos a lot, and every time I get this question popping in my head … Are you peter from spider man? But like the bad ass version of him?
@mCoding
@mCoding 2 года назад
Haha which spiderman do I look like?
@nimerkees7907
@nimerkees7907 2 года назад
images.app.goo.gl/KwnscCFE7D47zss9A Am I right or it’s just me with some 3 AM ideas?😅 I gotta say lately abstractions and inheritance concepts may have got into me and took you as a parent class which peter in spider man inherits from … but it may be just me Either way, Love your content, I learned so much from you :) Thank you!
@RyanMorey1
@RyanMorey1 2 года назад
“For sneaky reasons this is going to be faster” lol
@bennguyen1313
@bennguyen1313 9 месяцев назад
Do the python bindings also work for imPlot or only the base imGui? I'm looking to write a simple one-window gui (no floating/docking etc) just a couple textboxes/labels, some pushbuttons... perhaps a few red/green led-like indicators. ImGui looks very clean, but does it lend itself can it do such an app?
@SkyFly19853
@SkyFly19853 2 года назад
Cython! One of my favorites! Wonderful for video game development. ✅✅✅✅✅✅
@HoSza1
@HoSza1 Год назад
Hey mCoding! I'd like to ask if you have any experience with kivy? And if so, how do they compare to each other. Imgui has a main drawback in my view, that it intermingles logic and presentation and I doubt that it would scale very well without any problems when creating more complex applications.
@mCoding
@mCoding Год назад
Hello! I don't have any experience with kivy. Imgui is great for rapid development, but I can see it being too simple for a large application. For medium sized it works fine though :)
@mme725
@mme725 2 года назад
Random question about PyImgui, but can a Pyimgui be compiled to an executable? Was a bit fuzzy on the line between "This is an interpreter program, using C++ extensions like Numpy" and "This is a program deeply integrated with C++, and is just a pretty transpiler for GUI writing". Assuming it was more like the Numpy scenario, but figured I'd ask because making portable little GUI applications with this sounded really neat. (Admittedly even if it didn't compile down, there is always the PyInstaller route. I'm just asking for hobbyist reasons rather than anything serious.)
@mme725
@mme725 2 года назад
Oh second note! Really appreciate this video! Really good dive into a neat topic, but also the casual-but-educational dive into contributing to open source projects never hurts. :)
@mCoding
@mCoding 2 года назад
Good question and thank you! Yes pyimgui is more like numpy. There is the core imgui library written in cpp, then the pyimgui module is a compiled python c extension that calls out to the imgui cpp functions at runtime. It is only portable because the pyimgui maintainer builds binary wheels of the package that include the pre-built c extension and compiled imgui library so you dont need cython or a c compiler to pip install it.
@cub1cc
@cub1cc 2 года назад
1:16 JetBrains Mono😁
@handlenotprovided
@handlenotprovided 2 года назад
Excellent work and video :)
@this_is_japes7409
@this_is_japes7409 Год назад
13:07 would be nice if you did videos on PEP8 and maybe just on how to document code properly, maybe you have? i should look for that, new to the channel. and love the content.
@simplevc2980
@simplevc2980 2 года назад
one of C++'s ImGui user here xD
@PetrSzturc
@PetrSzturc 2 года назад
Great video. You covered quite many topics. :D
@ugurunver2403
@ugurunver2403 2 года назад
So those if's just for serializing async events in a sync flow, right? I mean, the library calls frame_commands function for every event happened in window and we just select the event with those if's?
@mCoding
@mCoding 2 года назад
There's no async here, it's all synchronous. The frame commands get called once per frame, not once per event. It's some kind of magic that imgui figures out what to draw from just one pass through the render commands!
@thethiny
@thethiny 2 года назад
It's called I'm Gui, hence the name "Dear I'm Gui".
@giosen1817
@giosen1817 8 месяцев назад
What if I wanted to view imgui windows in notepad-type software instead of a window generated as a background?
@Epinardscaramel
@Epinardscaramel 2 года назад
Damn that's high level 😲
@sharkinahat
@sharkinahat 2 года назад
GUI program that is not spaghetti-code? What sorcery is this!?!
@Alche_mist
@Alche_mist 2 года назад
Check out also my beloved PySimpleGUI. Event-based wrapper around common GUI libraries with the intention to make it far more pythonic and understandable. The spaghetti is all hidden in the library and the user-facing GUI code is also quite nice, readable, well working.
@masheroz
@masheroz 2 года назад
Came here to spruik pysimplegui!
@jti107
@jti107 2 года назад
what are your thoughts on pyside?
@mCoding
@mCoding 2 года назад
Never used it!
@meirzilkha
@meirzilkha Год назад
do you have intelisense auto complete when working with this library. It does not work wiht the latest pip install
@el_chivo99
@el_chivo99 2 года назад
I’ve always wondered how numpy implements the @ operator for matrix multiplication. It’s not a symbol you can normally use in python. would be awesome if you used this example to dig more into python that wraps C!
@lawrencedoliveiro9104
@lawrencedoliveiro9104 Год назад
It was added as a new operator in Python 3.5.
@jurebajic6844
@jurebajic6844 2 года назад
I just love the end! 😂
@mCoding
@mCoding 2 года назад
Haha thanks I still havent written the docs yet 😅
@yash1152
@yash1152 5 месяцев назад
8:37 > _"do docs count as LOC?"_ in adsence of stub files? yes, yes they unfortunately do.
@yash1152
@yash1152 5 месяцев назад
13:06 oh lol
@marcusmanmarcus
@marcusmanmarcus 2 года назад
Hi, can you make on tutorial on injecting a gui like this into a selenium browser instance?
@oida10000
@oida10000 2 года назад
Can you do a Cython (beginer's) tutorial in the future?
@dpmitko
@dpmitko 2 года назад
I'd appreciate a Cython tutorial ...
@trag1czny
@trag1czny 2 года назад
great vid 🤩 DISCORD GANG BTW 🤙🤙
@yash1152
@yash1152 5 месяцев назад
10:52 > _"__repr__()"_ what does that do?
@relic374
@relic374 2 года назад
I've always wanted to contribute to open source projects, but it's hard to find a project you know you can work on, you're allowed to work on, you know you can commit to the project, you know you can do things correctly, etc....
@bosch5303
@bosch5303 2 года назад
Please show dearpygui
@danny-jo1rb
@danny-jo1rb 2 года назад
your using jetbrains mono font :D
Далее
Modern Python logging
21:32
Просмотров 185 тыс.
Тарковский - гений
00:48
Просмотров 742 тыс.
Malware Development: Processes, Threads, and Handles
31:29
Master Pointers in C:  10X Your C Coding!
14:12
Просмотров 306 тыс.
super/MRO, Python's most misunderstood feature.
21:07
Просмотров 217 тыс.
Become a shell wizard in ~12 mins
12:25
Просмотров 248 тыс.
Interview with Senior Rust Developer in 2023
9:46
Просмотров 701 тыс.
Every Programming Language Ever Explained in 15 Minutes
15:29
Async for loops in Python
16:36
Просмотров 62 тыс.
Python 3.12 is HERE!
12:37
Просмотров 158 тыс.