Registry / data / inscriptis

inscriptis

JSON →
library2.7.4pypypi✓ verified 22d ago

Inscriptis is a Python-based HTML to text conversion library, command line client, and Web service (v2.7.1). It specializes in providing high-quality, layout-aware text representations of HTML content, including support for nested tables and a subset of CSS, and offers optional annotated output. The library is actively maintained with regular releases addressing new Python versions and feature enhancements.

pip install inscriptis
INSTALL
IMPORT
SIG · INSCRIPTIS
I
inscriptis
datapythonv2.7.4
Install
4.3s avg
Import
102ms
Disk
47MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.7.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.104s · 48.9MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 4.3s · import 0.100s · 49MB
47MB installed
● package 47MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

get_text
from inscriptis import get_text

Convert HTML from a URL to plain text, preserving layout and structure. The example fetches content from 'https://www.informationscience.ch' and prints its text representation.

import urllib.request from inscriptis import get_text url = "https://www.informationscience.ch" try: with urllib.request.urlopen(url) as response: html_content = response.read().decode('utf-8') except Exception as e: html_content = f"<html><body><p>Error fetching URL: {e}</p></body></html>" text = get_text(html_content) print(text)
inscriptis --version
Debug
Known issues
breakingThe `XmlAnnotationProcessor` (introduced in 2.6.0) now requires a mandatory root element. The generated XML will contain a `<content>` root element by default. If you were using this processor directly, your XML output structure will change.
fix
If using `XmlAnnotationProcessor`, be aware of the new `<content>` root element. The name can be overwritten by providing the `root_element` parameter to the processor call.
affects: >=2.6.0
deprecatedSupport for Python 3.9 has been removed as of version 2.7.0. Python 3.8 support was deprecated in 2.5.1 and subsequently removed.
fix
Upgrade your Python environment to version 3.10 or newer (up to <3.15) to maintain compatibility with `inscriptis`.
affects: >=2.7.0 (for Python 3.9), >=2.5.1 (for Python 3.8)
gotchaWhen processing very complex HTML pages, `inscriptis` (which uses `lxml` internally) may exhibit increased memory consumption due to `lxml`'s tendency to reuse memory rather than releasing it back to the operating system.
fix
For long-running services processing many complex HTML documents, monitor memory usage and consider restarting processes periodically or optimizing the HTML input where possible. This is a characteristic of `lxml` rather than a direct `inscriptis` bug.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'inscriptis'
The 'inscriptis' library has not been installed in your Python environment or is not accessible within the current environment.
fix
Install the library using pip: `pip install inscriptis`
AttributeError: 'str' object has no attribute 'decode'
You are attempting to call the `.decode()` method on a Python 3 string (`str`) object, which is already Unicode. The `.decode()` method is only applicable to `bytes` objects to convert them to `str`.
fix
Remove the `.decode()` call if the input is already a string, or ensure the input is a `bytes` object before calling `.decode()`. For example, if reading from a network or file, ensure you obtain `bytes` before decoding: `html_content_bytes.decode('utf-8')`.
TypeError: a bytes-like object is required, not 'str'
A function or method within `inscriptis` or a related library (like `lxml` which `inscriptis` uses) expects a `bytes` object, but it received a standard Python 3 string (`str`).
fix
Convert the `str` object to a `bytes` object using the `.encode()` method with the appropriate encoding, typically UTF-8: `some_string_variable.encode('utf-8')`.
XmlAnnotationProcessor now requires a mandatory root element.
Inscriptis version 2.6.0 and later changed the `XmlAnnotationProcessor` to require a root element, which defaults to `<content>`. Older code using this processor directly might not provide this, leading to a change in the XML output structure.
fix
When using `XmlAnnotationProcessor`, be aware that the output will include a `<content>` root element by default. If you need a different root element, specify it using the `root_element` parameter: `XmlAnnotationProcessor(root_element='my_root')`.
Upgrade
Version history
2.7.4latest on PyPI · released Aug 10, 2026
Audit
Dependencies
requestsrequiredUsed for fetching web content.
lxmlrequiredHTML parsing backend.
fastapioptionalRequired for the optional web-service.
uvicornoptionalRequired for the optional web-service.
Agent activity
7 hits · last 30 days
node
6
Resources
inscriptis — pip install inscriptis · libregistry