Skip to main content

edital

A text editor, in the terminal

Edital is a multi-tab terminal file editor built on Textual, with a Python API, periodic autosave, and recoverable unsaved documents. Its embedded text editor accepts initial text and an optional validator and returns an explicit accepted or cancelled result, leaving persistence to your application.

Use it for configuration drafts, notes, templates, and other workflows that need predictable Save & close behavior without a separately installed editor.

Installation

Requires Python 3.11 or newer. Interactive editing needs terminal input and output.

For the standalone CLI, install in an isolated environment with pipx:

pipx install edital

To use the Python API, install into your application's virtual environment:

python -m pip install edital

Textual is installed as a dependency. See the installation guide for setup, upgrades, and local development.

First edit

edital notes.txt new-file.txt

Existing files open in separate tabs; missing paths open named drafts without creating files until you save. Running edital without paths opens an unnamed draft, or restores unsaved documents when automatic recovery is configured.

Key Action
Ctrl+S Save the current document; choose a destination for an unnamed draft.
F2 Save and close the current tab.
F3 Save all and exit.
Ctrl+Q Exit, caching unsaved work by default.
F4 / F5 Find / Find and Replace in the current document.
F8 Browse, select, reorder, or close session documents.
F1 Open the complete, scrollable keyboard cheatsheet.

Escape dismisses help, search, and dialogs; it does not exit the editor. Ctrl+W closes a tab without caching, asking for discard confirmation when needed.

edital --recover                  # Restore cached unsaved work.
edital fresh.txt --no-cache        # Disable recovery and exit caching for this launch.
edital notes.txt --auto-save 2000  # Save dirty eligible files every two seconds.
edital conf                       # Edit settings; restart to apply saved changes.
edital -- conf                    # Open a file literally named "conf".
edital --help

Autosave is disabled by default and applies only to documents previously loaded from disk or explicitly saved. Exiting or discarding does not undo changes already autosaved. Recovery preserves unsaved work on orderly exit, not crashes or power loss. --no-cache retains existing snapshots; edital cache list inspects them and edital cache purge asks before removing them.

See the usage guide for file workflows, regex replacements, keyboard controls, and recovery conflicts.

Python file-session API

from edital import Edital

editor = Edital(auto_save=0)
documents = editor.open("notes.txt", "new-file.txt")
editor.run()  # Preparation above is headless; this launches the blocking TUI.

Headless callers can create a draft with editor.new(), assign its .text, and call editor.save(draft, path="notes.txt"). Construction loads user settings and initializes a missing configuration file; importing the package does not launch a UI. close(document, cache=True) preserves one document; exit(cache=True) preserves unsaved documents and exits the whole editor.

See file-session lifecycle and the API reference for persistence, confirmation, and recovery contracts.

Transactional embedded editor

from edital import edit_text

result = edit_text(
    "Initial notes\n",
    title="Notes",
    validator=lambda text: None if text.strip() else "Please enter some text",
)
if result.outcome == "accepted":
    print(result.text)  # Your application chooses how to save it.

F2 or F3 validates and accepts; Ctrl+Q cancels, confirming discard when text has changed. A validator returns None to accept or a diagnostic string to keep editing. Without a validator, empty text can be accepted too. Cancellation returns no text. TuiEditor().edit() provides the same blocking interface.

Embedded sessions do not load standalone configuration, write files, autosave, or cache text. Comments, whitespace, trailing-newline presence, and uniform LF or CRLF line endings are preserved; mixed endings and bare CR are rejected. See embedded integration for validation, controls, and terminal requirements.

Configuration

Run edital conf to edit user YAML. Explicit API/CLI settings override user YAML, which overrides packaged defaults. For example:

auto_save: 0
cache: true
prompt: true
auto_restore: false

auto_restore: true restores snapshots at editing startup. The Python API exposes the actual storage locations through editor.conf.path and editor.cache_dir. See configuration and storage and interface colors for all settings.

Documentation

License

MIT. See LICENSE.

Metadata

Release files for edital 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for edital 0.2.0
File Size Uploaded
edital-0.2.0.tar.gz 68.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for edital 0.2.0
File Interpreter ABI Platform
edital-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 107.5 kB

Release files / edital-0.2.0.tar.gz

Download URL edital-0.2.0.tar.gz
Size 68.0 kB
Tags Source
SHA-256 checksum
How to use checksums
cea41d44f1a43df92bc540670cc965f3369c7322dcaf70a8338313970610872b
BLAKE2b-256 checksum
How to use checksums
8ffde6f50ef41f04e6caf2d67043bc660011b5610fc151dc81f9124c16d46403
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / edital-0.2.0-py3-none-any.whl

Download URL edital-0.2.0-py3-none-any.whl
Size 39.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e8fb71a1e764e4ca185a6d1118d52d013932e695db6daf3ebd805a0b705beccd
BLAKE2b-256 checksum
How to use checksums
b50b66f0718f6afe63e03d2b887b0973b15076e3f343bf8f1412cb4dfceafd59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page