skillfed

python-frontmatter

Parse and manage posts with YAML (or other) frontmatter

python-frontmatter v1.3.0 19.6M downloads/30d#1,060 on PyPI427
Permissive license MIT Active released

What it is and what it does

Python Frontmatter is a lightweight parser for documents that combine structured metadata (front matter) with body content, separated by delimiters. It reads files or text containing YAML (or other format) metadata blocks followed by content, and exposes them as separate, easily accessible objects—metadata as a dictionary and content as a string. The package handles common workflows: loading from files or file-like objects, parsing raw text, accessing metadata fields as dictionary keys, modifying metadata, and writing the combined document back to text or file format.

It's built for static site generators, documentation systems, and any workflow where you need to attach structured metadata to plain-text documents. The single runtime dependency is pyyaml, and it supports Python 3.10 and later. The package is actively maintained and has been stable since its early releases.

Use it for:

  • Parse Jekyll or Hugo blog posts that use YAML front matter for metadata like title, date, and tags
  • Extract and modify document metadata in static site generators or documentation pipelines
  • Build content management workflows where metadata and body are stored together in plain text
  • Process Markdown files with structured headers for automation or indexing
  • Strip and rewrite front matter in batch document transformations

Worth the install?

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

Parses and manages text files with YAML (or JSON, TOML) front matter, separating structured metadata from document content for easy access and manipulation.

Yes. Low install friction, no security vulnerabilities, MIT license, active maintenance, and a single stable dependency make this a safe choice. Install it if you work with front-matter-delimited documents (Jekyll posts, static site content, or similar). Skip it only if your workflow doesn't involve parsing metadata-prefixed text files.

Install

python-frontmatter on PyPI

pip

pip install python-frontmatter

uv

uv add python-frontmatter

poetry

poetry add python-frontmatter

Installing python-frontmatter

Before you install

Low friction: pure Python wheel with a single runtime dependency (pyyaml). Active maintenance with a recent release (86 days ago) and 427 repository stars.

License in practice

MIT license permits unrestricted use, modification, and distribution with only attribution required—no restrictions on commercial or proprietary use.

Quickstart

import frontmatter

post = frontmatter.load('document.txt')
print(post['title'])  # access metadata
print(post.content)   # access body content

# Or parse from text:
metadata, content = frontmatter.parse(text)

Verify before relying

  • Whether JSON, TOML, and other front matter formats are equally well-supported or if YAML is the primary use case
  • Performance characteristics when processing large files or batch operations

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 1 — pyyaml
Maintenance actively maintained — 86 days since the last release
Last repo commit
First released
Downloads 19,580,081/month — #1,060 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: python_frontmatter-1.3.0-py3-none-any.whl

Keywords: frontmatter

Development Status :: 5 - Production/StableIntended Audience :: DevelopersNatural Language :: EnglishProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13

Tags

yaml frontmatter parserparse front matter metadatayaml document metadata extractionfrontmatter file parsingstructured metadata in text filesjekyll-style front matterdocument metadata separator
metadata-extractionstatic-site-generationyaml-parsing

More Markup packages