Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/quality.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# For documentation on GitHub Actions Workflows, see:
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
# This workflow runs the pre-commit checks using prek on pull requests and pushes to the main branch.
# Specifically it runs ruff autoformatting and linting, typos for spellchecking, and other
# pre-commit hooks defined in .pre-commit-config.yaml.
name: Quality
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [main]

permissions:
contents: read

jobs:
quality:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v6.0.2
with:
fetch-depth: 0 # Needed for setuptools_scm to work correctly

- uses: actions/cache@v5
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v7
with:
python-version: "3.14"
- name: Install the project
run: uv sync --group dev
- name: Run prek
run: uv run prek run -a --show-diff-on-failure
35 changes: 12 additions & 23 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,48 +1,37 @@
name: test
# This workflow runs pytest unit tests and code coverage reporting on push and pull requests to the main branch.
# It tests against multiple Python versions and operating systemsto ensure compatibility. The workflow uses Codecov
# for coverage reporting, and the results are uploaded to Codecov using a secret token.
name: Test

on:
push: # any branch
pull_request:
pull_request: # any branch
types: [opened, synchronize, reopened]
push:
branches: [main]

env:
FORCE_COLOR: 1

jobs:
test-ubuntu:
runs-on: ubuntu-latest
test:
strategy:
fail-fast: false
matrix:
python-version:
["3.10", "3.11", "3.12", "3.13", "3.14", "3.14t"]

os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.14t"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6.0.2
- uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
- name: Code formatting
if: ${{ matrix.python-version == '3.14' }}
run: |
uv run ruff check .
uv run ruff format --check .
- name: Typos
if: ${{ matrix.python-version == '3.14' }}
run: |
uv run typos .
- name: Unit test
run: |
uv run coverage run -m pytest tests/
- name: Type Checking
run: |
uv run mypy --strict src/ --platform win32
uv run mypy --strict src/ --platform linux
uv run mypy --strict src/ --platform darwin
- name: Run codecov
run: |
uv run codecov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
uses: codecov/codecov-action@v6
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
40 changes: 40 additions & 0 deletions .github/workflows/typecheck.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# For documentation on GitHub Actions Workflows, see:
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
# This workflow runs mypy type checking on push and pull requests to the main branch.
# It tests against multiple Python versions to ensure compatibility.
name: TypeCheck
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [main]

permissions:
contents: read

jobs:
type-check:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
fail-fast: false
defaults:
run:
shell: bash
steps:
- name: Check out
uses: actions/checkout@v6.0.2
with:
fetch-depth: 0

- name: Install uv and set the python version
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}

- name: Type Checking
run: |
uv run mypy --strict src/ --platform win32
uv run mypy --strict src/ --platform linux
uv run mypy --strict src/ --platform darwin
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.15.6"
rev: "v0.15.8"
hooks:
- id: ruff-format
args: [--config=pyproject.toml]
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
CHANGELOG
=========

3.0.53: 2026-0-TBD
------------------

New features:
- Lazy loading of `__version__`

Fixes:
- Fix get_word_before_cursor behavior
- Fix various typing issues
- Set missing minimal requirement on `wcwidth`
- Fix vt100 6x6x6 color cube range and missing grayscale shades (232, 254-255)

3.0.52: 2025-08-27
------------------

Expand Down
45 changes: 0 additions & 45 deletions appveyor.yml

This file was deleted.

9 changes: 9 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from __future__ import annotations

import sys
from functools import partial

import pytest
Expand Down Expand Up @@ -318,6 +319,10 @@ def test_controlx_controlx():
assert result.text == "hello worldX"


@pytest.mark.skipif(
sys.platform.startswith("win"),
reason="emacs history bindings don't work on Windows",
)
def test_emacs_history_bindings():
# Adding a new item to the history.
history = _history()
Expand Down Expand Up @@ -348,6 +353,10 @@ def test_emacs_history_bindings():
assert result.text == "line2 second input"


@pytest.mark.skipif(
sys.platform.startswith("win"),
reason="emacs history bindings don't work on Windows",
)
def test_emacs_reverse_search():
history = _history()

Expand Down
8 changes: 8 additions & 0 deletions tests/test_memory_leaks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from __future__ import annotations

import gc
import sys

import pytest

from prompt_toolkit.shortcuts.prompt import PromptSession

Expand All @@ -15,6 +18,11 @@ def _count_prompt_session_instances() -> int:


# This test used to fail in GitHub CI, probably due to GC differences.
# Still fails on Windows due to win32.NoConsoleScreenBufferError.
@pytest.mark.skipif(
sys.platform.startswith("win"),
reason="Fails in GitHug CI due to win32.NoConsoleScreenBufferError",
)
def test_prompt_session_memory_leak() -> None:
before_count = _count_prompt_session_instances()

Expand Down
9 changes: 9 additions & 0 deletions tests/test_shortcuts.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
from __future__ import annotations

import sys

import pytest

from prompt_toolkit.shortcuts import print_container
from prompt_toolkit.shortcuts.prompt import _split_multiline_prompt
from prompt_toolkit.widgets import Frame, TextArea
Expand Down Expand Up @@ -55,6 +59,11 @@ def test_split_multiline_prompt():
assert first_input_line() == [("class:testclass", "a"), ("class:testclass", "b")]


# Test fails on Windows due to win32.NoConsoleScreenBufferError.
@pytest.mark.skipif(
sys.platform.startswith("win"),
reason="Fails in GitHug CI due to win32.NoConsoleScreenBufferError",
)
def test_print_container(tmpdir):
# Call `print_container`, render to a dummy file.
f = tmpdir.join("output")
Expand Down