skillfed

mf2py

Microformats parser

mf2py v2.0.1 562.7K downloads/30d#5,986 on PyPI
Permissive license MIT DORMANT released

What it is and what it does

mf2py is a microformats parser that reads HTML and extracts structured data in JSON format. It recognizes microformats2 classes (like h-card, h-entry, h-event) and converts them into a standardized dictionary structure, making it easy to programmatically access semantic markup embedded in web pages. The library also supports the older microformats1 format and has experimental metaformats extraction.

You typically use mf2py when you need to consume or validate microformats-marked HTML—common in IndieWeb applications, social media integrations, and semantic web tooling. It accepts HTML from files, strings, or URLs, and returns a dict with items, relationships, and metadata. The three runtime dependencies (html5lib, requests, beautifulsoup4) handle the heavy lifting of HTML parsing and network fetching.

Use it for:

  • Extract author and publication metadata from blog posts marked with h-entry and h-card microformats.
  • Parse event listings (h-event) from calendar or conference websites to build aggregators or search indexes.
  • Validate that your own HTML markup correctly implements microformats2 before publishing.
  • Build IndieWeb applications that need to read contact cards (h-card) or social interactions (webmentions) from remote URLs.
  • Convert microformats-annotated HTML into JSON for downstream processing or storage in a database.

Worth the install?

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

mf2py parses HTML documents to extract microformats2 data structures, with backwards compatibility for microformats1 and experimental metaformats support.

Yes, if you are working with microformats-marked HTML or building IndieWeb tooling. The package is stable, has no known vulnerabilities, and low install friction. However, dormant maintenance (980 days since last release) means you should not expect bug fixes or spec updates; use it only for stable, well-established microformats2 parsing tasks.

Install

mf2py on PyPI

pip

pip install mf2py

uv

uv add mf2py

poetry

poetry add mf2py

Installing mf2py

Before you install

Low install friction with a pure-Python wheel and three common dependencies (html5lib, requests, beautifulsoup4). Maintenance is dormant—last release was 980 days ago—so expect no active bug fixes or feature updates, though the package has been stable since its 2014 inception.

License in practice

MIT license is permissive, allowing commercial and private use with minimal restrictions. You may use, modify, and distribute mf2py freely as long as you retain the license notice.

Quickstart

import mf2py

mf2json = mf2py.parse(doc="<div class='h-card'><p class='p-name'>Jane</p></div>")
print(mf2json['items'])

Requires Python 3.8 or later. The parser uses html5lib internally, so BeautifulSoup documents passed to it may be modified in place.

Verify before relying

  • Whether dormant status (980 days since last release) affects real-world compatibility with current microformats2 specs or HTML5 parsing edge cases.
  • Performance characteristics when parsing large or deeply nested HTML documents.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 3 — html5lib, requests, beautifulsoup4
Maintenance dormant — 980 days since the last release
First released
Downloads 562,651/month — #5,986 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: mf2py-2.0.1-py3-none-any.whl

Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Text Processing :: Markup :: HTML

Tags

microformats parserparse microformats2 htmlextract h-card h-entrymicroformats to jsonindieweb microformatshtml microformat extractionsemantic html parsing
indiewebsemantic-htmlmicroformats

More HTML packages