legacy-cgi
Fork of the standard library cgi and cgitb modules removed in Python 3.13
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-cgiuv
uv add legacy-cgipoetry
poetry add legacy-cgiInstalling 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
More Dynamic Content packages
MarkupSafe provides a text object that escapes…
permissive · top 100 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
soupsieveSoupsieve is a CSS selector library designed to…
permissive · top 100 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
FlaskFlask is a lightweight WSGI web application…
permissive · top 1,000 on PyPI
MakoMako compiles Python-embedded templates into…
permissive · top 1,000 on PyPI
oldest-supported-numpyProvides the oldest version of NumPy compatible…
permissive · top 5,000 on PyPI
standard-telnetlibProvides the telnetlib module removed from…
permissive · top 15,000 on PyPI
standard-distutilsProvides the distutils module from Python's…
permissive · top 15,000 on PyPI
standard-sunauProvides the sunau module, a standard library…
permissive · top 5,000 on PyPI
standard-imghdrProvides the `imghdr` module, a Python standard…
permissive · top 5,000 on PyPI
standard-chunkProvides the chunk module, a removed Python…
permissive · top 5,000 on PyPI
enum-compatConditionally installs enum34 on Python…
permissive · top 5,000 on PyPI
standard-aifcProvides the aifc module, a pure-Python…
permissive · top 5,000 on PyPI
wsgirefProvides WSGI 1.0.1 (PEP 3333) validation…
permissive · top 15,000 on PyPI