CourtBouillon

Authentic people growing open source code with taste

WeasyPrint v56 Has Been Released

Version 56 of WeasyPrint has been released. The beta didn’t suffer from outstanding bugs, this stable version is now ready to be installed and tested.

What’s New?

Visible Features

The previous article explained in details the three major features included in WeasyPrint v56:

  • PDF/A-*b documents can now be generated,
  • bitmap fonts (in otb format) are now supported,
  • max-lines works in nested tags,

We would like to thank Blueshoe and Expert Germany for their financial and professional investment on these topics. It has been a real pleasure to work with them during this release 💜. Don’t hesitate to contact us if your workflow requires specific features, bug fixes, gorgeous HTML templates or CSS magic tricks 🪄, we’ll be happy to help!

Invisible Work

As always, our work on WeasyPrint includes a lot of less visible but critical tasks.

This release includes a lot of changes in tests. Of course, more tests have been added, mainly to avoid regressions for the bugs that have been fixed recently, but that’s not the main part of what has changed.

One simple but important change has been made in the way tests are launched on our continuous integration platform, GitHub Actions. Instead of launching tests sequentially, we now launch tests in parallel. We also removed the code coverage reports by default. It takes less time and saves some server use, avoiding a useless waste of resources 🌿 while keeping our quality requirements intact 💯.

Another simplification has been made for tests comparing drawings. Instead of repeating multiple times the name of the test and the size of the expected result, we now have nice fixtures avoiding duplication. The code is now easier to read and more simple to understand for newcomers. Moreover, we avoid possible errors that were always frustrating, as this duplicated information sometimes led to problems that were really hard to debug.

WeasyPrint’s code has also been improved to take advantage of the new features offered by Python and of our increasing knowledge of its capabilities. We’ve been working on this project for a long time, and we believe that we are now better developers than we used to be! For example, we have replaced the pkgutil module by the brand new and more powerful importlib.resources module. We also simplified the management of fonts especially on Windows, continued our effort to separate the PDF generation code from the layout, simplified text extraction, or improved reproducible PDF generation.

Most of these changes are modest, but they really help to keep the code clean, readable and maintainable. Removing the useless complexity of code is an endless task, for sure, but each step makes the code slightly better. Adding code for new features is exciting, but removing code that’s dead or uselessly complicated is also very satisfying and important in the long term.

Thanks to the issues and the pull requests of our wonderful contributors 💜, thanks to the hard work we proudly provide for CourtBouillon ⭕, we believe that WeasyPrint can be more and more useful for you, and useful to more and more people.

What’s Coming Next?

Layout

Grid support has been delayed many times 🕓, flex boxes need some love ❤️, but don’t worry: their time has come! We explained in a previous article how important these features are for many users, it’s still true today!

Of course, as usual, we may have surprises 🎁 coming during the next months! And if you love surprises, don’t forget that you can be part of them by sponsoring a feature you’d love to have or by becoming a sponsor on OpenCollective. Sharing these features with the community is a nice way to be sure that you’ll benefit from the ones they’ll develop for you 🥰.

Your Turn!

Now that version 56 has been released, it’s time for you to update WeasyPrint and give some feedback! We really hope that you’ll enjoy this new version. Keep in touch even if it’s just to say that everything works well for you, we’ll be happy to share good vibes with you!