Skip to content

Use pyproject.toml instead of setup.py and uv(x) in GitHub workflow. #1984

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 10, 2025
Merged
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
40 changes: 18 additions & 22 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,36 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
- uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install Dependencies
run: |
sudo apt remove python3-pip
python -m pip install --upgrade pip
python -m pip install . ruff typos coverage codecov mypy pytest readme_renderer types-contextvars asyncssh
pip list
- name: Ruff
- name: Code formatting
if: ${{ matrix.python-version == '3.13' }}
run: |
ruff check .
ruff format --check .
uvx ruff check .
uvx ruff format --check .
- name: Typos
if: ${{ matrix.python-version == '3.13' }}
run: |
typos .
- name: Tests
uvx typos .
- name: Unit test
run: |
coverage run -m pytest
- name: Mypy
# Check whether the imports were sorted correctly.
# When this fails, please run ./tools/sort-imports.sh
uvx --with . --with pytest coverage run -m pytest tests/
- name: Type Checking
run: |
mypy --strict src/prompt_toolkit --platform win32
mypy --strict src/prompt_toolkit --platform linux
mypy --strict src/prompt_toolkit --platform darwin
uvx --with . --with asyncssh mypy --strict src/ --platform win32
uvx --with . --with asyncssh mypy --strict src/ --platform linux
uvx --with . --with asyncssh mypy --strict src/ --platform darwin
- name: Validate README.md
if: ${{ matrix.python-version == '3.13' }}
# Ensure that the README renders correctly (required for uploading to PyPI).
run: |
uv pip install readme_renderer
python -m readme_renderer README.rst > /dev/null
- name: Run codecov
run: |
codecov
uvx codecov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
18 changes: 0 additions & 18 deletions mypy.ini

This file was deleted.

50 changes: 50 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
[project]
name = "prompt_toolkit"
version = "3.0.50"
description="Library for building powerful interactive command lines in Python"
readme = "README.rst"
authors = [{ name = "Jonathan Slenders" }]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python",
"Topic :: Software Development",
]
requires-python = ">=3.8"
dependencies = [
"wcwidth",
]

[tool.ruff]
target-version = "py37"
lint.select = [
Expand Down Expand Up @@ -67,3 +94,26 @@ extend-exclude = [
# complains about some spelling in human right declaration.
"examples/prompts/multiline-autosuggest.py",
]

[tool.mypy]
# --strict.
check_untyped_defs = true
disallow_any_generics = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
ignore_missing_imports = true
no_implicit_optional = true
no_implicit_reexport = true
strict_equality = true
strict_optional = true
warn_redundant_casts = true
warn_return_any = true
warn_unused_configs = true
warn_unused_ignores = true

[build-system]
requires = ["setuptools>=68"]
build-backend = "setuptools.build_meta"
40 changes: 0 additions & 40 deletions setup.cfg

This file was deleted.

39 changes: 0 additions & 39 deletions setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/test_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test_always():

def test_invert():
assert not (~Always())()
assert ~Never()()
assert (~Never())()

c = ~Condition(lambda: False)
assert c()
Expand Down