skillfed

prance

Resolving Swagger/OpenAPI 2.0 and 3.0.0 Parser

prance v26.7.19.0 6.2M downloads/30d#1,959 on PyPI262
License unclear MITNFA Active released

What it is and what it does

Prance is a parser and validator for Swagger/OpenAPI specifications that handles both local file paths and remote URLs. It extends standard JSON reference resolution to work with OpenAPI's non-URI relative file paths, which standard JSON reference libraries do not support. The package provides two main parsing modes: ResolvingParser, which follows and resolves all JSON references into a flat specification dictionary, and BaseParser, which parses without resolving references.

The package includes a command-line interface for validating specs, compiling them into fully resolved output files, and converting older Swagger 2.0 specs to OpenAPI 3.0 format via an external web service. It depends on chardet, ruamel.yaml, requests, and packaging for core functionality, and delegates actual validation to pluggable backends (openapi-spec-validator, swagger-spec-validator, or flex) that you install separately.

Use it for:

  • Validate and resolve Swagger/OpenAPI specs in CI/CD pipelines before deploying API services
  • Parse OpenAPI specifications from files or URLs into Python dictionaries for code generation or documentation tools
  • Compile multi-file API specs with external references into single resolved output files for distribution
  • Convert legacy Swagger 2.0 definitions to OpenAPI 3.0 format programmatically
  • Extract and flatten API specifications containing JSON references for analysis or transformation

Worth the install?

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

Prance parses and validates Swagger/OpenAPI 2.0 and 3.0 specifications in Python, resolving JSON references and external file paths according to the OpenAPI standard.

Yes, if you need to parse or validate OpenAPI/Swagger specs in Python. The package is actively maintained, has low install friction, and fills a real gap in reference resolution. Clarify the MITNFA license before use in proprietary contexts. Avoid the flex backend due to deprecated dependencies with known security issues.

Install

prance on PyPI

pip

pip install prance

uv

uv add prance

poetry

poetry add prance

Installing prance

Before you install

Low friction install with a pure-wheel distribution. Active maintenance as of 2026-07-19 with recent releases. Requires Python 3.10 or later. Optional validation backends (openapi-spec-validator, swagger-spec-validator, flex) must be installed separately; flex is deprecated and carries security risks in its dependencies.

License in practice

License treatment is unclear (MITNFA). Verify the actual license terms before using in proprietary or restricted-license projects.

Quickstart

pip install prance

from prance import ResolvingParser
parser = ResolvingParser('path/to/swagger.yaml')
spec = parser.specification  # fully resolved spec as dict

Requires Python 3.10 or later. A validation backend (openapi-spec-validator, swagger-spec-validator, or flex) must be installed separately for validation to work.

Verify before relying

  • Whether MITNFA license is MIT-compatible or a custom variant requiring legal review
  • Whether the package works correctly with all modern Python versions (3.10–3.14) despite Beta status
  • Performance characteristics when resolving large or deeply nested specifications

Package facts

License MITNFA (unclear)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 4 — chardet, ruamel.yaml, requests, packaging
Maintenance actively maintained — 26 days since the last release
Last repo commit
First released
Downloads 6,194,071/month — #1,959 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: prance-26.7.19.0-py3-none-any.whl

Keywords: swagger, openapi, parsing

Development Status :: 4 - BetaEnvironment :: PluginsIntended Audience :: DevelopersNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Internet :: WWW/HTTPTopic :: Software Development :: Libraries :: Python Modules

Tags

openapi specification parserswagger validation pythonjson reference resolverapi spec validatoropenapi 3.0 parserswagger 2.0 resolverspec reference resolution
api-specificationopenapi-swagger

More Python Modules packages