question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build wheels with compiled libraries

See original GitHub issue

One good thing about wheels is that it allow us to embed DLL files. So simply adding all DLL files and making the wheel platform specific would significantly help users by not installing system dependencies. I recently made a PR in cairocffi repo https://github.com/Kozea/cairocffi/pull/164 providing a way to do so. I got a nice repo which builds cairo as a single DLL file so I could do that. But here I couldn’t find the one for Pango ( I don’t think anything else is needed). So, finding a way to build that would be good or rather it can also be taken from msys2 in case of windows and brew in case of MacOS. I don’t about linux.

What I did there was not that correct I think but I don’t know. Possibly there should be a better solution and I started searching for similar libraries. I found freetype-py which had a script to build freetype same thing can be done here also I think. Next, I found  this issue https://github.com/pypa/wheel/issues/128 which is more related and from that thread I found pypandoc where their implementation was very good IMHO, See setup.py. Next, I found this thread at stackoverflow https://stackoverflow.com/questions/45150304/how-to-force-a-python-wheel-to-be-platform-specific-when-building-it. Next, I find another interesting thing which is used with cffi is milksnake which simply suited this one but I haven’t tried using it.

Sorry, for a braindump I thought I would organize it a little better but I didn’t find time.

Finally, the conclusion is there must be platform specific wheel so that weasyprint can simply be installed using pip without any system dependencies.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
liZecommented, Mar 1, 2021

@liZe I plan to help here.

Thank you!

I think needed dependencies are Pango and Gdk-Pixbuf right?

The libraries directly used by WeasyPrint in master are Pango and some of its dependencies:

  • PangoFT2 (independent DLL generated by Pango, for FreeType support),
  • HarfBuzz,
  • FontConfig,
  • GObject.

the DLL files are name as CORE_MANIM_*.dll to avoid DLL hell

I’m really scared of adding a way to specify custom DLL names in WeasyPrint, because I’m afraid that it will add another configuration layer and cause bugs with a more complex way to debug. If it’s only done in the wheel (with specific code in the building script), then why not.

I need to look into Gdk-Pixbuf though, it also uses meson so it should be easy to compile it using meson. Thoughts?

Gdk-Pixbuf is not needed anymore 😉.

1reaction
liZecommented, Mar 2, 2021

So I think there is no compiling work, everything you want is ready in the other repo. It should be just about getting those and package it properly. I think it should need a setup.py to do so. I will work this week 😃

We’ve worked hard to remove setup.py, so it would be a good idea to find a solution without it 😉.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What Are Python Wheels and Why Should You Care?
That's all you need to experiment with installing and building wheels! ... the wheel, a package format designed to ship libraries with compiled...
Read more >
How to Build and Install C Libraries in Python - ActiveState
Python wheel not available? Learn how to automatically build binary wheels for Python packages that incorporate C libraries.
Read more >
Build Python Wheel which contains c library (pytidylib)
It wraps a library written in C with ctypes. According to the docs of pytidylib you need to install the library via apt/rpm:...
Read more >
Tips and tricks - cibuildwheel - Read the Docs
Linux wheels are built in manylinux / musllinux containers to provide binary ... backend to compile libraries correctly create wheels with the right...
Read more >
Finding libraries & includes for wheel building - Packaging
For many compiled python packages I can download from ~gohlke/pythonlibs/, but I think attempting to use these in cibuildwheel will require ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found