pywinrt/python-winsdk

split namespaces into packages

dlech opened this issue · 6 comments

dlech commented

It could be nice if we were able to create a separate Python package for each WinRT namespace, similar to how PyObjC works. This way apps could only include the packages they use instead of one big monolithic package. Although there could still be a meta "install everything" package too.

@dlech Is there currently a way to make a "lighter" version of the package?
I would like to add Windows 10/11 style toast notifications to our application (SABnzbd), but adding winsdk would double our application's file size.
Thanks so much!

dlech commented

You can create your own package with only the namespaces you need like https://github.com/dlech/bleak-winrt.

Thanks a lot, that's encouraging!
Do I understand correctly that I just have to modify these 2 lines? That's it?
And then run the Github actions workflow.
https://github.com/dlech/bleak-winrt/blob/a6c1f3fd073a7b5678304ea6bc08b9b067544320/generate.ps1#L23

dlech commented

Do I understand correctly that I just have to modify these 2 lines?

Yes, that is where you need to select the required WinRT namespaces.

That's it?

You will also need to change the package name (any instance of bleak_winrt or bleak-winrt), for example at https://github.com/dlech/bleak-winrt/blob/a6c1f3fd073a7b5678304ea6bc08b9b067544320/generate.ps1#L34C26-L34C27 and in other files too.

Thank you 👍

dlech commented

Individual per-winrt-namespace packages have been published on PyPI now. Please refer to https://github.com/pywinrt/pywinrt for the source of those packages.