skillfed

legacy-cgi

Fork of the standard library cgi and cgitb modules removed in Python 3.13

legacy-cgi v2.6.4 6.2M downloads/30d#1,960 on PyPI48
Permissive license PSF-2.0 AGING released

What it is and what it does

legacy-cgi is a fork of Python's cgi and cgitb modules that were removed from the standard library in Python 3.13 per PEP-594. It restores those modules for projects that still depend on them, allowing CGI scripts written for Python 3.12 and earlier to run unchanged on newer Python versions.

The package has no runtime dependencies and is designed purely for compatibility—the author explicitly recommends that new applications use ASGI or WSGI frameworks instead. It is most useful as a conditional dependency for legacy codebases that cannot immediately migrate away from CGI.

Use it for:

  • Running existing CGI scripts on Python 3.13+ without rewriting them to use modern web frameworks.
  • Maintaining backward compatibility in projects that still use cgi.FieldStorage or cgitb for error handling.
  • Gradual migration of legacy systems by keeping old CGI code functional while planning a transition to ASGI or WSGI.

Worth the install?

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

Provides the cgi and cgitb modules removed from Python 3.13's standard library, allowing existing CGI scripts to run on newer Python versions without modification.

Yes, if you have code that depends on cgi or cgitb and cannot immediately refactor to ASGI or WSGI. Install it conditionally to avoid unnecessary overhead on older Python versions. No security vulnerabilities are known. Not recommended for new projects.

Install

legacy-cgi on PyPI

pip

pip install legacy-cgi

uv

uv add legacy-cgi

poetry

poetry add legacy-cgi

Installing legacy-cgi

Before you install

Low install friction with no runtime dependencies. Maintenance status is aging—last commit was 2025-10-27—but the package remains active. Suitable for projects that need backward compatibility with removed stdlib modules.

License in practice

Licensed under PSF-2.0 (permissive), the same license as Python itself. No restrictions on use or redistribution in typical projects.

Quickstart

pip install legacy-cgi

import cgi
form = cgi.FieldStorage()

Intended for Python 3.13+; on earlier versions the built-in stdlib modules take precedence, making this package unnecessary.

Verify before relying

  • Whether the package handles all edge cases that arose during stdlib removal in Python 3.13.
  • Performance characteristics compared to modern ASGI/WSGI alternatives for production deployments.
  • Full compatibility scope with all cgi and cgitb use patterns from Python 3.12 and earlier.

Package facts

License PSF-2.0 (permissive)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance aging — 291 days since the last release
Last repo commit
First released
Downloads 6,193,550/month — #1,960 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: legacy_cgi-2.6.4-py3-none-any.whl

Tags

cgi module python 3.13legacy cgi supportcgitb error handlingpython cgi forkstandard library cgi replacementcgi script compatibility
legacy-supportcgi-compatibility

More Dynamic Content packages