python-editor
Programmatically open an editor, capture the result.
What it is and what it does
python-editor wraps your system's $EDITOR environment variable to let you spawn an interactive editor subprocess from Python code. It handles the plumbing of passing content to the editor, capturing the result, and returning it as bytes, or opening a file for in-place editing. The library searches for a known editor (vim, emacs, nano) if $EDITOR is not set, and supports TTY mode for programs whose output is piped elsewhere.
Typical use cases include building CLI tools that need user input (commit messages, configuration edits, bug reports), interactive Python scripts, and any workflow where you want to delegate text editing to the user's preferred editor rather than building your own UI. It has no runtime dependencies and installs with low friction.
Use it for:
- Building CLI tools that prompt users to edit commit messages, bug reports, or configuration in their preferred editor.
- Interactive Python scripts that need to let users edit multi-line text or files without embedding an editor.
- Git hooks or version-control workflows that programmatically invoke $EDITOR for commit messages or diffs.
- Admin or deployment scripts that need to open a file for user review and modification before proceeding.
- Testing frameworks or utilities that capture edited content for validation or logging.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Programmatically open your system's $EDITOR from Python, capture edited content, and return it as bytes or modify files in place.
Yes, if you need to invoke the user's system editor from Python. It is stable, dependency-free, and solves a specific problem well. Dormant maintenance is not a concern for a feature-complete library with no known vulnerabilities, but verify compatibility with your Python version before relying on it for new projects targeting Python 3.7+.
Install
python-editor on PyPI
pip
pip install python-editoruv
uv add python-editorpoetry
poetry add python-editorInstalling python-editor
Before you install
Low install friction with no runtime dependencies. Maintenance is dormant—last release was 2019-02-01 and last commit 2023-10-11—but the package is marked Production/Stable and has no known vulnerabilities, suggesting it is feature-complete rather than abandoned.
License in practice
Licensed under Apache (permissive), so you can use, modify, and distribute it freely in commercial and private projects without restriction.
Quickstart
import editor
commit_msg = editor.edit(contents=b"# Enter commit message here")
# Or edit a file in place:
editor.edit(file="README.txt")
Requires a system editor (vim, emacs, nano, or $EDITOR environment variable) to be installed and accessible on the system.
Verify before relying
- Whether the package works reliably with modern Python versions beyond 3.6 (classifiers list 3.4–3.6 but no newer versions).
- Whether dormant maintenance status poses any risk for future Python or OS compatibility issues.
Package facts
| License | Apache (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 2,751 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,761,129/month — #2,898 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: python_editor-1.0.4-py2-none-any.whl; python_editor-1.0.4-py3-none-any.whl
Keywords: editor, library, vim, emacs
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
editorOpens your system's default text editor (or a…
permissive · top 5,000 on PyPI
bcsfeA command-line save file editor for The Battle…
copyleft · top 15,000 on PyPI
pyvimA Vi/Vim-like text editor implemented entirely…
permissive · top 15,000 on PyPI
EditorConfigParses and applies EditorConfig files to…
permissive · top 5,000 on PyPI
scripttestscripttest runs command-line applications in…
permissive · top 15,000 on PyPI
subprocess.runProvides a simplified interface to run shell…
permissive · top 15,000 on PyPI
ezodfezodf creates, opens, and modifies OpenDocument…
permissive · top 15,000 on PyPI
draftjs_exporterConverts Draft.js ContentState (a rich text…
permissive · top 5,000 on PyPI
subprocess-teeA drop-in replacement for subprocess.run that…
permissive · top 5,000 on PyPI
pbxprojReads, modifies, and writes Xcode .pbxproj…
permissive · top 15,000 on PyPI