Metadata-Version: 2.4
Name: html5lib-free-threaded
Version: 1.1.2
Summary: A C-accelerated html5lib fork with auto-fallback and free-threading support for Python 3.15t.
Home-page: https://github.com/你的用户名/html5lib-free-threaded
Author-email: sunyiyao <sunwh1102@qq.com>
License: MIT
Project-URL: Homepage, https://pypi.org/project/html5lib-free-threaded/
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: C
Classifier: Programming Language :: Python :: 3.15
Classifier: Programming Language :: Python :: Free Threading
Classifier: Topic :: Text Processing :: Markup :: HTML
Requires-Python: >=3.13
Description-Content-Type: text/x-rst
License-File: LICENSE
License-File: AUTHORS.rst
Requires-Dist: six>=1.9
Requires-Dist: webencodings
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

HTML5lib Free-Threaded
======================

**A C-accelerated fork of html5lib with automatic Python fallback, specifically built for Python 3.15 Free-threading (no GIL).**

Overview
--------

This package is a highly optimized fork of the original `html5lib`. 

It features a custom, hand-written C state machine extension (``c_tokenizer.c``) that acts as a fast path for clean HTML. When the C parser encounters complex or malformed HTML, it seamlessly falls back to the original pure Python parser to ensure 100% WHATWG specification compliance.

Usage
-----

The API is perfectly compatible with the original ``html5lib``:

.. code-block:: python

    import html5lib

    # Parse a document
    doc = html5lib.parse("<p>Hello World!</p>")
    print(doc.tag)

    # Or use a specific treebuilder
    doc = html5lib.parse("<p>Hello World!</p>", treebuilder="lxml")

Installation
------------

This package is currently distributed as a pre-compiled binary wheel for **Windows x64 + CPython 3.15t (Free-threading)**.

.. code-block:: bash

    pip install html5lib-free-threaded

If you are on another platform, please download the source distribution (``.tar.gz``) and ensure you have a C compiler installed. pip will automatically compile the C extension for your platform.

Performance
-----------

On a dual-core Intel i7-6500U (Windows 10), parsing a 100KB HTML payload 10 times:

* **Original Python:** ~1.02 seconds
* **Pure C Fast Path:** ~0.12 seconds (8.5x faster)

License
-------

MIT License (Same as the original html5lib).
