skillfed

pynliner

Python CSS-to-inline-styles conversion tool for HTML using BeautifulSoup and cssutils

pynliner v0.8.0 220.0K downloads/30d#9,315 on PyPI
Permissive license MIT Abandoned released

What it is and what it does

Pynliner is a CSS-to-inline-styles converter for HTML documents. It takes HTML with external or embedded stylesheets and rewrites the CSS rules as inline style attributes on the matching elements, which is useful for email templates and contexts where external stylesheets cannot be loaded. The tool parses HTML with BeautifulSoup and CSS with cssutils, then applies the styles to produce a self-contained HTML document.

The package is classified as Production/Stable but has not been updated since 2017-01-10. It carries no runtime dependencies, making installation friction minimal. However, the long period without updates means no active support, bug fixes, or compatibility updates for modern Python or library versions.

Use it for:

  • Prepare HTML email templates by inlining CSS so styles render correctly in email clients that strip external stylesheets
  • Convert web pages to self-contained HTML documents where external CSS references are not available or permitted
  • Preprocess HTML for archival or offline distribution where stylesheet links cannot be resolved
  • Embed styles directly into HTML snippets for use in contexts with strict Content Security Policy rules

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Converts CSS stylesheets to inline styles in HTML documents, using BeautifulSoup and cssutils to embed external or embedded CSS directly into element attributes.

Yes, if you need CSS inlining and can tolerate an unmaintained package. The tool is simple, has no runtime dependencies, and carries no known vulnerabilities. However, verify compatibility with your Python version and library versions before relying on it in production, and be prepared to fork or patch it if issues arise.

Install

pynliner on PyPI

pip

pip install pynliner

uv

uv add pynliner

poetry

poetry add pynliner

Installing pynliner

Before you install

Installation is straightforward with no runtime dependencies, but the package has been abandoned since 2017-01-10 with no updates since. No active maintenance or security patches should be expected.

License in practice

MIT license permits unrestricted use, modification, and distribution with minimal restrictions, making it legally safe to adopt in most projects.

Quickstart

pip install pynliner

from pynliner import Pynliner

html = '<style>p { color: red; }</style><p>Hello</p>'
result = Pynliner(html).run()
print(result)

Verify before relying

  • Whether the package works reliably with modern Python versions despite classifiers listing only up to 3.5
  • Current compatibility with recent versions of BeautifulSoup and cssutils
  • Whether abandoned status has led to unresolved bugs or security issues in real-world use

Package facts

License MIT (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance abandoned — 3,503 days since the last release
First released
Downloads 220,027/month — #9,315 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pynliner-0.8.0-py2.py3-none-any.whl

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 2.6Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Topic :: Text Processing :: Markup :: HTML

Tags

css to inline styles htmlhtml email css inliningconvert stylesheet to inlinecss inliner toolhtml style embeddingemail template css
email-template-prephtml-css-processing

More HTML packages