clitic / kdam

A console progress bar library for Rust. (inspired by tqdm & rich.progress)
https://docs.rs/kdam
Apache License 2.0
196 stars 6 forks source link

Integration with pyo3/Jupyter #13

Closed miratepuffin closed 1 year ago

miratepuffin commented 1 year ago

Hi there!

Firstly, fantastic job with the library! Has been super easy to integrate with my project and looking forward to pushing it throughout!

To summarise my problem, I am currently building a graph analytics platform in rust which has a python wrapper around it for ease of use. We are using your library to track how long different operations take - starting with ingestion from pandas into our internal model (e.g. https://github.com/Pometry/Raphtory/blob/master/raphtory/src/python/graph/pandas.rs#L105).

Obviously as it is used in python many people use our tool within a jupyter notebook, and unfortunately whilst everything works in a scripting context, the loading bars within a notebook context are not coming up until each operation has completed (similar to issues to the original python tqdm).

Their solution to this was to have their tqdm.notebook module (as I am sure you are aware) - I was just wondering if you have seen anyone else trying something similar to what we are doing that has already implemented a solution, or alternatively are you planning your own kdam.notebook 😃

If not we will find some way to hack it together, but would be great to get your opinion!

All the best, Ben

clitic commented 1 year ago

Thanks of appreciating my library. I will try to integrate it with pyo3 and update you soon.

miratepuffin commented 1 year ago

Thanks @clitic! Let me know if you need a hand testing or anything, happy to see if a branch etc works in our tool.

clitic commented 1 year ago

@miratepuffin checkout pyo3 branch and try to run this example with this notebook. I have not created something like kdam.notebook instead I have added kdam::set_notebook function which needs to be set true if pyo3 extension is running inside jupter notebook. It needs few more tweaks before a release which I will make in few days. If you have any suggestions or changes please let me know.

miratepuffin commented 1 year ago

Hi @clitic sorry for the late response!! I didn't get the notification for this. I shall trial it now if its still open :D Thanks for getting it sorted so quickly

miratepuffin commented 1 year ago

Hi @clitic we have tested this and it works great!

Would you be able to publish 0.5.0 so that I can merge it in and we can release a new patch including this?

clitic commented 1 year ago

@miratepuffin I will make a release tommorow and inform you.

miratepuffin commented 1 year ago

Thank you @clitic!

clitic commented 1 year ago

@miratepuffin kdam v0.5.0 is released at crates.io.

miratepuffin commented 1 year ago

Amazing @clitic!! Will update and merge in my PR now :)