Installation

Installation

This page installs Aspose.HTML FOSS for Python and verifies the setup with a minimal DOM round-trip.


Prerequisites

RequirementDetail
Python3.10 or later
pipAny recent version
Operating systemWindows, Linux, or macOS
Native dependenciesNone — pure Python implementation

1. Create a virtual environment (recommended)

Keep the installation isolated from the system Python:

python -m venv .venv

Activate it — on Windows:

.venv\Scripts\activate

On Linux/macOS:

source .venv/bin/activate

2. Install the package

Install the current release (0.1.0) from PyPI:

pip install aspose-html-foss

3. Verify the installation

Build a one-element document and read a computed style back — if this prints without errors, the install is working:

from aspose_html.dom import Document
from aspose_html.cssom import CSSStyleSheet

doc = Document()
el = doc.create_element("div")
el.set_attribute("id", "bar")
doc.append_child(el)

sheet = CSSStyleSheet()
sheet.replace_sync("#bar { color: blue }")
doc.attach_style_sheet(sheet)

print(el.get_computed_style().get_property_value("color"))

Next Steps

See Also