pynliner
Python CSS-to-inline-styles conversion tool for HTML using BeautifulSoup and cssutils
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 pynlineruv
uv add pynlinerpoetry
poetry add pynlinerInstalling 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
Tags
More HTML packages
MarkupSafe provides a text object that escapes…
permissive · top 100 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
beautifulsoup4Beautiful Soup parses HTML and XML documents…
permissive · top 100 on PyPI
lxmllxml provides Python bindings to libxml2 and…
permissive · top 1,000 on PyPI
docutilsDocutils converts plaintext documentation in…
unclear · top 1,000 on PyPI
MarkdownConverts Markdown text to HTML using a Python…
permissive · top 1,000 on PyPI
css-inlineInlines CSS from style and link tags directly…
permissive · top 5,000 on PyPI
cssutilscssutils parses and builds CSS stylesheets as a…
copyleft · top 5,000 on PyPI
premailerConverts CSS style blocks into inline style…
permissive · top 5,000 on PyPI
prettierfierReformats HTML and XML strings with intelligent…
permissive · top 15,000 on PyPI
stylusBridges Python code to the Stylus CSS compiler,…
permissive · top 15,000 on PyPI
django-premailerA Django template tag that converts CSS blocks…
permissive · top 15,000 on PyPI
dict2cssdict2css converts Python dictionaries to CSS…
permissive · top 15,000 on PyPI
html-textExtracts plain text from HTML while filtering…
permissive · top 5,000 on PyPI
turbohtmlParse, query, edit, and serialize HTML and XML…
permissive · top 15,000 on PyPI
libsassCompiles Sass and SCSS stylesheets to CSS…
permissive · top 5,000 on PyPI