Skip to content

Commit 2c1cbda

Browse files
authored
Fix GitHub Actions and Python upgrade to >=3.10
- Fix GitHub Actions by setting correct branch in `.github/workflows/test.yaml` from master to main. - Added `.pre-commit-config.yaml` and prek to automate checks easily - Bumped minimum Python version to 3.10 - Added support for Python 3.14, 3.15, and their free-threaded variants - Added various dependency_groups to pyproject.toml - Modify tests.yaml to use `uv run` instead of `uvx` - Fix readme-renderer
1 parent f04219e commit 2c1cbda

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+388
-259
lines changed

.github/workflows/test.yaml

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: test
33
on:
44
push: # any branch
55
pull_request:
6-
branches: [master]
6+
branches: [main]
77

88
env:
99
FORCE_COLOR: 1
@@ -14,41 +14,35 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
17+
python-version:
18+
["3.10", "3.11", "3.12", "3.13", "3.14", "3.14t"]
1819

1920
steps:
20-
- uses: actions/checkout@v4
21-
- uses: astral-sh/setup-uv@v5
21+
- uses: actions/checkout@v6.0.2
22+
- uses: astral-sh/setup-uv@v7
2223
with:
2324
python-version: ${{ matrix.python-version }}
2425
- name: Code formatting
25-
if: ${{ matrix.python-version == '3.13' }}
26+
if: ${{ matrix.python-version == '3.14' }}
2627
run: |
27-
uvx ruff check .
28-
uvx ruff format --check .
28+
uv run ruff check .
29+
uv run ruff format --check .
2930
- name: Typos
30-
if: ${{ matrix.python-version == '3.13' }}
31+
if: ${{ matrix.python-version == '3.14' }}
3132
run: |
32-
uvx typos .
33+
uv run typos .
3334
- name: Unit test
3435
run: |
35-
uvx --with . --with pytest coverage run -m pytest tests/
36+
uv run coverage run -m pytest tests/
3637
- name: Type Checking
37-
if: ${{ matrix.python-version != '3.8' }}
3838
run: |
39-
uvx --with . --with asyncssh mypy --strict src/ --platform win32
40-
uvx --with . --with asyncssh mypy --strict src/ --platform linux
41-
uvx --with . --with asyncssh mypy --strict src/ --platform darwin
42-
- name: Validate README.md
43-
if: ${{ matrix.python-version == '3.13' }}
44-
# Ensure that the README renders correctly (required for uploading to PyPI).
45-
run: |
46-
uv pip install readme_renderer
47-
python -m readme_renderer README.rst > /dev/null
39+
uv run mypy --strict src/ --platform win32
40+
uv run mypy --strict src/ --platform linux
41+
uv run mypy --strict src/ --platform darwin
4842
- name: Run codecov
4943
run: |
50-
uvx codecov
44+
uv run codecov
5145
- name: Upload coverage to Codecov
52-
uses: codecov/codecov-action@v4
46+
uses: codecov/codecov-action@v5
5347
env:
5448
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,14 @@ pip-log.txt
3030
.tox
3131
nosetests.xml
3232
.pytest_cache
33+
coverage.xml
3334

3435
# Translations
3536
*.mo
3637

38+
# Makefile - for those who like that workflow
39+
Makefile
40+
3741
# Mr Developer
3842
.mr.developer.cfg
3943
.project
@@ -45,6 +49,9 @@ docs/_build
4549
# pycharm metadata
4650
.idea
4751

52+
# uv
53+
uv.lock
54+
4855
# vscode metadata
4956
.vscode
5057

.pre-commit-config.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: "v6.0.0"
4+
hooks:
5+
- id: check-case-conflict
6+
- id: check-executables-have-shebangs
7+
- id: check-merge-conflict
8+
- id: check-toml
9+
- id: detect-private-key
10+
- id: end-of-file-fixer
11+
- id: fix-byte-order-marker
12+
- id: mixed-line-ending
13+
- id: trailing-whitespace
14+
15+
- repo: https://github.com/astral-sh/ruff-pre-commit
16+
rev: "v0.15.6"
17+
hooks:
18+
- id: ruff-format
19+
args: [--config=pyproject.toml]
20+
- id: ruff-check
21+
args: [--config=pyproject.toml, --fix, --exit-non-zero-on-fix]
22+
23+
- repo: https://github.com/crate-ci/typos
24+
rev: v1.44.0
25+
hooks:
26+
- id: typos
27+
exclude: |
28+
(?x)^(
29+
tests/.*
30+
)$

PROJECTS.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Shells:
3737
- `athenacli <https://github.com/dbcli/athenacli>`_: A CLI for AWS Athena.
3838
- `vulcano <https://github.com/dgarana/vulcano>`_: A framework for creating command-line applications that also runs in REPL mode.
3939
- `kafka-shell <https://github.com/devshawn/kafka-shell>`_: A supercharged shell for Apache Kafka.
40-
- `starterTree <https://github.com/thomas10-10/starterTree>`_: A command launcher organized in a tree structure with fuzzy autocompletion
40+
- `starterTree <https://github.com/thomas10-10/starterTree>`_: A command launcher organized in a tree structure with fuzzy autocompletion
4141
- `git-delete-merged-branches <https://github.com/hartwork/git-delete-merged-branches>`_: Command-line tool to delete merged Git branches
4242
- `radian <https://github.com/randy3k/radian>`_: A 21 century R console
4343

README.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,3 @@ Special thanks to
141141

142142
.. |Codecov| image:: https://codecov.io/gh/prompt-toolkit/python-prompt-toolkit/branch/master/graphs/badge.svg?style=flat
143143
:target: https://codecov.io/gh/prompt-toolkit/python-prompt-toolkit/
144-

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Have a look at :ref:`the gallery <gallery>` to get an idea of what is possible.
4242
Getting started
4343
---------------
4444

45-
Go to :ref:`getting started <getting_started>` and build your first prompt.
45+
Go to :ref:`getting started <getting_started>` and build your first prompt.
4646
Issues are tracked `on the Github project
4747
<https://github.com/prompt-toolkit/python-prompt-toolkit>`_.
4848

docs/pages/advanced_topics/styling.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ The style is determined as follows:
185185

186186
- Then we go through this style from left to right, starting from the default
187187
style. Inline styling is applied directly.
188-
188+
189189
If we come across a class name, then we generate all combinations of the
190190
class names that we collected so far (this one and all class names to the
191191
left), and for each combination which includes the new class name, we look

docs/pages/advanced_topics/unit_testing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ these.
3636
structures (like text buffers) change over time.
3737

3838
So we programmatically feed some input to the input pipe, have the key
39-
bindings process the input and then test what comes out of it.
39+
bindings process the input and then test what comes out of it.
4040

4141
In the following example we use a
4242
:class:`~prompt_toolkit.shortcuts.PromptSession`, but the same works for any

docs/pages/asking_for_input.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ Suppose we'd like to use a Pygments style, for instance
178178
tango_style = style_from_pygments_cls(TangoStyle)
179179
180180
text = prompt(
181-
"Enter HTML: ",
181+
"Enter HTML: ",
182182
lexer=PygmentsLexer(HtmlLexer),
183183
style=tango_style
184184
)

docs/pages/dialogs.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,14 @@ each providing the return value (first element) and the displayed value (second
9898
9999
from prompt_toolkit.shortcuts import radiolist_dialog
100100
101-
result = radiolist_dialog(
102-
title="RadioList dialog",
103-
text="Which breakfast would you like ?",
104-
values=[
105-
("breakfast1", "Eggs and beacon"),
106-
("breakfast2", "French breakfast"),
107-
("breakfast3", "Equestrian breakfast")
108-
]
101+
result = radiolist_dialog(
102+
title="RadioList dialog",
103+
text="Which breakfast would you like ?",
104+
values=[
105+
("breakfast1", "Eggs and beacon"),
106+
("breakfast2", "French breakfast"),
107+
("breakfast3", "Equestrian breakfast")
108+
]
109109
).run()
110110
111111
@@ -118,15 +118,15 @@ The :func:`~prompt_toolkit.shortcuts.checkboxlist_dialog` has the same usage and
118118
119119
from prompt_toolkit.shortcuts import checkboxlist_dialog
120120
121-
results_array = checkboxlist_dialog(
122-
title="CheckboxList dialog",
121+
results_array = checkboxlist_dialog(
122+
title="CheckboxList dialog",
123123
text="What would you like in your breakfast ?",
124-
values=[
124+
values=[
125125
("eggs", "Eggs"),
126126
("bacon", "Bacon"),
127127
("croissants", "20 Croissants"),
128128
("daily", "The breakfast of the day")
129-
]
129+
]
130130
).run()
131131
132132

0 commit comments

Comments
 (0)