Skip to content

Commit 88a011c

Browse files
Use pyproject.toml instead of setup.py and uv(x) in GitHub workflow. (#1984)
* Use pyproject.toml instead of setup.py and uv(x) in GitHub workflow. * Fix incorrect test_invert unit test.
1 parent 68e3c39 commit 88a011c

File tree

6 files changed

+69
-120
lines changed

6 files changed

+69
-120
lines changed

Diff for: .github/workflows/test.yaml

+18-22
Original file line numberDiff line numberDiff line change
@@ -18,40 +18,36 @@ jobs:
1818

1919
steps:
2020
- uses: actions/checkout@v4
21-
- name: Setup Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@v4
21+
- uses: astral-sh/setup-uv@v5
2322
with:
2423
python-version: ${{ matrix.python-version }}
25-
allow-prereleases: true
26-
- name: Install Dependencies
27-
run: |
28-
sudo apt remove python3-pip
29-
python -m pip install --upgrade pip
30-
python -m pip install . ruff typos coverage codecov mypy pytest readme_renderer types-contextvars asyncssh
31-
pip list
32-
- name: Ruff
24+
- name: Code formatting
3325
if: ${{ matrix.python-version == '3.13' }}
3426
run: |
35-
ruff check .
36-
ruff format --check .
27+
uvx ruff check .
28+
uvx ruff format --check .
3729
- name: Typos
3830
if: ${{ matrix.python-version == '3.13' }}
3931
run: |
40-
typos .
41-
- name: Tests
32+
uvx typos .
33+
- name: Unit test
4234
run: |
43-
coverage run -m pytest
44-
- name: Mypy
45-
# Check whether the imports were sorted correctly.
46-
# When this fails, please run ./tools/sort-imports.sh
35+
uvx --with . --with pytest coverage run -m pytest tests/
36+
- name: Type Checking
4737
run: |
48-
mypy --strict src/prompt_toolkit --platform win32
49-
mypy --strict src/prompt_toolkit --platform linux
50-
mypy --strict src/prompt_toolkit --platform darwin
38+
uvx --with . --with asyncssh mypy --strict src/ --platform win32
39+
uvx --with . --with asyncssh mypy --strict src/ --platform linux
40+
uvx --with . --with asyncssh mypy --strict src/ --platform darwin
5141
- name: Validate README.md
42+
if: ${{ matrix.python-version == '3.13' }}
5243
# Ensure that the README renders correctly (required for uploading to PyPI).
5344
run: |
45+
uv pip install readme_renderer
5446
python -m readme_renderer README.rst > /dev/null
5547
- name: Run codecov
5648
run: |
57-
codecov
49+
uvx codecov
50+
- name: Upload coverage to Codecov
51+
uses: codecov/codecov-action@v4
52+
env:
53+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

Diff for: mypy.ini

-18
This file was deleted.

Diff for: pyproject.toml

+50
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
[project]
2+
name = "prompt_toolkit"
3+
version = "3.0.50"
4+
description="Library for building powerful interactive command lines in Python"
5+
readme = "README.rst"
6+
authors = [{ name = "Jonathan Slenders" }]
7+
classifiers = [
8+
"Development Status :: 5 - Production/Stable",
9+
"Intended Audience :: Developers",
10+
"License :: OSI Approved :: BSD License",
11+
"Operating System :: OS Independent",
12+
"Programming Language :: Python :: 3",
13+
"Programming Language :: Python :: 3.8",
14+
"Programming Language :: Python :: 3.9",
15+
"Programming Language :: Python :: 3.10",
16+
"Programming Language :: Python :: 3.11",
17+
"Programming Language :: Python :: 3.12",
18+
"Programming Language :: Python :: 3.13",
19+
"Programming Language :: Python :: 3 :: Only",
20+
"Programming Language :: Python",
21+
"Topic :: Software Development",
22+
]
23+
requires-python = ">=3.8"
24+
dependencies = [
25+
"wcwidth",
26+
]
27+
128
[tool.ruff]
229
target-version = "py37"
330
lint.select = [
@@ -67,3 +94,26 @@ extend-exclude = [
6794
# complains about some spelling in human right declaration.
6895
"examples/prompts/multiline-autosuggest.py",
6996
]
97+
98+
[tool.mypy]
99+
# --strict.
100+
check_untyped_defs = true
101+
disallow_any_generics = true
102+
disallow_incomplete_defs = true
103+
disallow_subclassing_any = true
104+
disallow_untyped_calls = true
105+
disallow_untyped_decorators = true
106+
disallow_untyped_defs = true
107+
ignore_missing_imports = true
108+
no_implicit_optional = true
109+
no_implicit_reexport = true
110+
strict_equality = true
111+
strict_optional = true
112+
warn_redundant_casts = true
113+
warn_return_any = true
114+
warn_unused_configs = true
115+
warn_unused_ignores = true
116+
117+
[build-system]
118+
requires = ["setuptools>=68"]
119+
build-backend = "setuptools.build_meta"

Diff for: setup.cfg

-40
This file was deleted.

Diff for: setup.py

-39
This file was deleted.

Diff for: tests/test_filter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def test_always():
1616

1717
def test_invert():
1818
assert not (~Always())()
19-
assert ~Never()()
19+
assert (~Never())()
2020

2121
c = ~Condition(lambda: False)
2222
assert c()

0 commit comments

Comments
 (0)