Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

libtidy

Python binding for the libtidy C library.

Overview

Python libtidy module is a low-level binding for libtidy C library.
It is an effort to allow python programs full access to the API implemented and provided by the well known *libtidy* library.

PyPI record.

Documentation.

libtidy is a lightweight Python package, based on the ctypes library.
It is fully compliant implementation of the original C libtidy API by implementing whole its functionality in a clean Python instead of C.

libtidy API documentation can be found at:

libtidy API Reference

libtidy uses the underlying libtidy C shared library as specified in libtidy.cfg (included libtidy-X.X.* is the default), but there is also ability to specify it programmatically by one of the following ways:

import libtidy
libtidy.config(LIBTIDY="libtidy C shared library absolute path")
# or
libtidy.config(LIBTIDY=None)  # included libtidy-X.X.* will be used

About original libtidy:

Borrowed from the original website:

libtidy Introduction

libtidy is the library version of HTML Tidy. In fact, Tidy is libtidy; the console application is a very simple C application that links against libtidy. It’s what powers Tidy, mod-tidy, and countless other applications that perform tidying.

Design factors

libtidy is Thread Safe and Re-entrant. Because there are many uses for HTML Tidy - from content validation, content scraping, conversion to XHTML - it was important to make libtidy run reasonably well within server applications as well as client side.

Requirements

  • It is a fully independent package.
    All necessary things are installed during the normal installation process.
  • ATTENTION: currently works and tested only for Windows.

Installation

Prerequisites:

To install run:

python -m pip install --upgrade libtidy

Development

Prerequisites:

  • Development is strictly based on tox. To install it run:

    python -m pip install --upgrade tox

Visit Development page.

Installation from sources:

clone the sources:

git clone https://github.com/karpierz/libtidy.git libtidy

and run:

python -m pip install ./libtidy

or on development mode:

python -m pip install --editable ./libtidy

License

Copyright (c) 2024-2025 Adam Karpierz
Licensed under the HTML Tidy License
Please refer to the accompanying LICENSE file.

Authors

Changelog

5.9.14b3 (2025-06-30)

  • Better code linting.

  • Setup (dependencies) update.

5.9.14b2 (2025-05-15)

  • The distribution is now created using ‘build’ instead of ‘setuptools’.

  • Setup (dependencies) update (due to regressions in tox and setuptools).

5.9.14b1 (2025-05-05)

  • Add support for Python 3.14

  • Drop support for Python 3.9 (due to compatibility issues).

  • Update readthedocs’s python to version 3.13

  • Update tox’s base_python to version 3.13

  • Tox configuration is now in native (toml) format.

  • Add support for PyPy 3.11

  • Drop support for PyPy 3.9

  • Removed mixed-cased variants of constants ‘tidyFormatType_*’.

  • Removed mixed-cased constants ‘tidyStrings’.
    ‘TidyStrings’ should be used instead.
  • Removed mixed-cased constants ‘tidyLocaleMapItem’.
    ‘TidyLocaleMapItem’ should be used instead.
  • Added module libtidy.tidy as equivalent of standard tidy.exe.
  • The ‘tidy’ script was also created during the installation
    (on Windows as Scripts/tidy.exe) as a convenience.
  • Added preliminary tests for libtidy.tidy.

  • 100% code linting.

  • Copyright year update.

  • Setup (dependencies) update.

5.9.14a1 (2025-01-01)

  • First release.

0.0.0 (2024-10-10)

  • Initial commit.

Release files for libtidy 5.9.14b3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for libtidy 5.9.14b3
File Size Uploaded
libtidy-5.9.14b3.tar.gz 1.2 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for libtidy 5.9.14b3
File Interpreter ABI Platform
libtidy-5.9.14b3-py3-none-any.whl Python 3 none any Details

Total release size: 1.8 MB

Release files / libtidy-5.9.14b3.tar.gz

Download URL libtidy-5.9.14b3.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
9ec3f38037b3e923c81c25c64ae754b5cf7a0294ec45cd6a17f8c5853faab97c
BLAKE2b-256 checksum
How to use checksums
d82c131b9023c1591796e325910a44a225195a124240cda54f3bf37d6eecfc26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / libtidy-5.9.14b3-py3-none-any.whl

Download URL libtidy-5.9.14b3-py3-none-any.whl
Size 614.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7052fc8761ffdb86cb5c28d49c5218f9d98b9c66341a938b18a80146ea4dc08d
BLAKE2b-256 checksum
How to use checksums
d0fd0a7196bf1b2991bd8a985d9469ea03d004a5be3d843f423fb6d204edbe17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page