smartypants
Python with the SmartyPants
What it is and what it does
smartypants is a Python port of the original SmartyPants text filter. It transforms plain-text punctuation into typographically correct HTML entities—converting straight quotes to curly quotes, replacing hyphens and double-hyphens with en-dashes and em-dashes, and handling other common typographic improvements. It works as both a Python module and a command-line tool, making it useful for preprocessing text before publishing to the web or for document generation pipelines.
The package has no external dependencies and installs with low friction. It is classified as Production/Stable and has been maintained since 2008, though releases are infrequent. The repository remains active, indicating the project is mature and unlikely to break, but the aging maintenance status suggests it is not under active feature development.
Use it for:
- Preprocess blog post or article text before publishing to ensure professional typography in HTML output
- Filter user-generated content in web applications to improve readability without requiring manual editing
- Convert plain-text documentation or markdown to typographically correct HTML for static site generators
- Clean up text in content management systems to standardize punctuation across published material
- Process text files from legacy systems or plain-text sources before importing into publishing platforms
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Converts plain-text punctuation to typographically correct HTML entities—replacing straight quotes with curly quotes, hyphens with em-dashes, and similar transformations for improved typography in web and document output.
Yes, if you need simple, dependency-free text punctuation normalization for web or document output. The permissive BSD License, zero runtime dependencies, and stable codebase make it a low-risk addition. The aging maintenance is not a concern for a mature, narrow-purpose tool, but verify that its punctuation rules match your typographic requirements before committing to it in a pipeline.
Install
smartypants on PyPI
pip
pip install smartypantsuv
uv add smartypantspoetry
poetry add smartypantsInstalling smartypants
Before you install
Low install friction with no runtime dependencies. Maintenance is aging—last release was 423 days ago—but the repository remains active with a recent commit on 2025-06-17, suggesting the project is stable rather than abandoned.
License in practice
BSD License (permissive) allows free use, modification, and distribution with minimal restrictions, making it suitable for both open-source and commercial projects.
Quickstart
import smartypants
text = '"Hello" -- world\'s best'
result = smartypants.smartypants(text)
print(result)
Verify before relying
- Whether Python 2 support is actively maintained or merely declared in classifiers
- Performance characteristics on large text volumes or streaming input
- Customization options for which punctuation transformations to apply
- Specific HTML entity output format and which punctuation rules are applied
Package facts
| License | BSD License (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | aging — 423 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 232,590/month — #9,062 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: smartypants-2.0.2-py2.py3-none-any.whl
Tags
More Filters packages
Pygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
MarkdownConverts Markdown text to HTML using a Python…
permissive · top 1,000 on PyPI
nltkNLTK is a Python library for natural language…
permissive · top 1,000 on PyPI
pandocfiltersProvides Python utilities for writing pandoc…
permissive · top 1,000 on PyPI
UnidecodeConverts Unicode text to ASCII-safe…
copyleft · top 1,000 on PyPI
pymdown-extensionsPymdown Extensions provides a collection of…
permissive · top 1,000 on PyPI
markdown2Converts Markdown text to HTML using a fast,…
permissive · top 5,000 on PyPI
tokenizerTokenizes Icelandic text into words,…
permissive · top 15,000 on PyPI
fix-busted-jsonRepairs malformed JSON strings by fixing common…
permissive · top 15,000 on PyPI
normalityNormality removes diacritics, punctuation, and…
permissive · top 15,000 on PyPI
setuptools-markdownConverts Markdown files to reStructuredText…
permissive · top 15,000 on PyPI
multimarkConverts Markdown to HTML, LaTeX, groff man,…
permissive · top 15,000 on PyPI
matchMaps tokenized words and phrases back to their…
permissive · top 5,000 on PyPI
cmarkgfmConverts CommonMark and GitHub-flavored…
permissive · top 15,000 on PyPI
ftfyDetects and fixes mojibake (garbled Unicode…
permissive · top 5,000 on PyPI
recognizers-textRecognizes and extracts entities like numbers,…
permissive · top 15,000 on PyPI