greghesp / ha-bambulab

A Home Assistant Integration for Bambu Lab Printers
1.04k stars 91 forks source link

[Feature] Make pybambu available on https://pypi.org/ with docs #734

Open SilkePilon opened 1 week ago

SilkePilon commented 1 week ago

Describe the feature

Hi, im working on a new project over on https://bambumanager.vercel.app/ and am looking for a better lib i can use to control the printers, this is also an open source project. Is there any way you can publish this part of your code to pypi?

I would love to help you out by writing some docs and examples once i know where to start.

jneilliii commented 1 week ago

an older version of pybambu is already living on pypi and is found here: https://github.com/greghesp/pybambu

https://pypi.org/project/pybambu/

I was using it for my OctoPrint plugin integration until all the crazy cloud blocking started happening.

AdrianGarside commented 1 week ago

Honestly the main blocker for official releasing it on pypi is that there isn't a clean API boundary around it yet. I haven't been able to find time to do the slog of learning the right style and cleaning up the existing code.

SilkePilon commented 1 week ago

ok, can you maybe tell me how to use this code standalone, just an basic example, so i can at least write some docs for it as i think a lot of other projects would love to use something like this.

jneilliii commented 1 week ago

To get it working for me with some of the latest changes I just copied the pybambu folder into my own project and made minor adjustments to some of the functions to make them non async (the bambu_client connect function call).

https://github.com/jneilliii/OctoPrint-BambuPrinter/tree/rc/octoprint_bambu_printer/printer/pybambu

prior to that, I was just using the pybambu module as a dependency from pypi, which is still in the current master branch.

https://github.com/jneilliii/OctoPrint-BambuPrinter

greghesp commented 1 week ago

The library itself is bundled into this repo, however as Adrian says, there isn't a clean API schema around it yet as it's designed for this integration, and Bambu keep changing things.

You can find the library here though: https://github.com/greghesp/ha-bambulab/tree/main/custom_components/bambu_lab/pybambu

If you're doing this on Vercel, I assume you're using Nextjs, so you might be better off converting the way the pybambu works into Javascript. Something like https://www.npmjs.com/package/bambu-js