3MFConsortium / lib3mf

lib3mf is an implementation of the 3D Manufacturing Format file standard
http://3mf.io
BSD 2-Clause "Simplified" License
228 stars 92 forks source link

Python wheels for Python bindings #350

Closed vijaiaeroastro closed 3 months ago

vijaiaeroastro commented 6 months ago

All Python bindings (Windows, Linux and OSX) should be distributed as Python wheels and made available through PIP for easier adoption of lib3mf.

vijaiaeroastro commented 5 months ago

I have set up the first public release of universal Python wheel structure in https://github.com/vijaiaeroastro/3MFPython. This basically makes Lib3MF a Universal Python library, and we pack necessary dependencies for all three platforms in a single wheel. I have uploaded the Python wheel to the cloud drive (since I cannot attach python wheels here and would require zipping. This may cause some confusion). So, you can get it from the following URL:

https://drive.proton.me/urls/KP9YS4K6TR#dSjHQb8ZYvA8

You can also download it from artifacts here if you prefer:

https://github.com/vijaiaeroastro/3MFPython/actions/runs/8408540655

You just need to do:

pip install Lib3MF-2.3.0-py3-none-any.whl

And then checkout the test script from the repository:

https://github.com/vijaiaeroastro/3MFPython/blob/main/test_lib3mf.py

There are three convenience functions (primarily introduced to avoid having to deal with raw library paths): get_library_path: Returns the installed library path for the respective platform. get_library_path_for_wrapper: Returns the library path without extension. This can be passed to existing code instead of the raw library path. get_wrapper: Does all of the above and gives a wrapper object to work with.

The test script linked above uses this get_wrapper() function. It makes the code look a little cleaner.

Kindly test it and give your feedback. The entire packaging process will be automated directly in Lib3MF repository through Github actions and there won't be a separate repository in future (unless it is deemed necessary).

martinweismann commented 5 months ago

Thanks @vijaiaeroastro

This works for me (Windows 11, python 3.11.8).

Can we call the library lib3mf in most places? After to many inconsistencies we decided to call the library lib3mf (over lib3MF, Lib3mf, Lib3MF) as often as possible (namespaces in C++ are still Lib3MF, though). image

What are the next steps to releasing this on Pip with every lib3mf release?

I held off posting to https://github.com/Ghostkeeper/Blender3mfFormat Let’s have more interesting Python examples in place before posting there. They will want those examples anyway.

Thanks!

vijaiaeroastro commented 3 months ago

Python wrapper for lib3mf 2.3.1 has been uploaded to pip already.

image

Almost eight examples have already been ported from C++ (https://github.com/3MFConsortium/lib3mf/issues/343) and It will be included in the develop branch soon.