Skip to content

Commit b7bb086

Browse files
author
Robert Roos
committed
Merge remote-tracking branch 'origin/main' into add-domain-rebase-2025
2 parents 191c5e6 + fa28a38 commit b7bb086

6 files changed

Lines changed: 46 additions & 38 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,27 @@ jobs:
3434
- "3.10"
3535
- "3.11"
3636
- "3.12"
37+
- "3.13"
38+
- "3.14"
3739

3840
steps:
39-
- uses: actions/checkout@v4
41+
- uses: actions/checkout@v6
4042
- name: Set up Python ${{ matrix.python-version }}
41-
uses: actions/setup-python@v5
43+
uses: actions/setup-python@v6
4244
with:
4345
python-version: ${{ matrix.python-version }}
4446
- name: Check Python version
4547
run: python --version --version
4648
- name: Install dependencies
4749
run: |
4850
python -m pip install --upgrade pip
49-
python -m pip install .[test] pytest-cov
51+
python -m pip install .[test]
5052
- name: Test with pytest
5153
run: >
5254
python -m pytest
5355
-vv
5456
--cov . --cov-append --cov-config pyproject.toml
5557
- name: Upload coverage to Codecov
56-
uses: codecov/codecov-action@v4
58+
uses: codecov/codecov-action@v5
5759
with:
5860
flags: unittests

.github/workflows/lint.yml

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,57 +16,47 @@ env:
1616
FORCE_COLOR: "1"
1717

1818
jobs:
19-
ruff:
19+
lint:
20+
name: "Ruff & MyPy"
2021
runs-on: ubuntu-latest
2122

2223
steps:
23-
- uses: actions/checkout@v4
24+
- uses: actions/checkout@v6
2425
- name: Set up Python
25-
uses: actions/setup-python@v5
26+
uses: actions/setup-python@v6
2627
with:
27-
python-version: "3"
28-
- name: Install pip
29-
run: python -m pip install --upgrade pip
30-
31-
- name: Install Ruff
32-
run: python -m pip install "ruff==0.5.2"
28+
python-version: "3.13"
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
python -m pip install .[lint] pytest
33+
# Also install pytest here, otherwise mypy will complain about our test files
3334

3435
- name: Lint with Ruff
3536
run: ruff check . --output-format github
3637

3738
- name: Format with Ruff
3839
run: ruff format . --diff
3940

40-
mypy:
41-
runs-on: ubuntu-latest
42-
43-
steps:
44-
- uses: actions/checkout@v4
45-
- name: Set up Python
46-
uses: actions/setup-python@v5
47-
with:
48-
python-version: "3"
49-
- name: Install dependencies
50-
run: |
51-
python -m pip install --upgrade pip
52-
python -m pip install ".[lint,test]"
53-
- name: Type check with mypy
54-
run: mypy
41+
# - name: Type check with MyPy
42+
# run: mypy
43+
# Skip MyPy check for now, see https://github.com/sphinx-doc/sphinx-argparse/issues/85
5544

5645
twine:
46+
name: "Check packing with Twine"
5747
runs-on: ubuntu-latest
5848

5949
steps:
60-
- uses: actions/checkout@v4
50+
- uses: actions/checkout@v6
6151
- name: Set up Python
62-
uses: actions/setup-python@v5
52+
uses: actions/setup-python@v6
6353
with:
64-
python-version: "3"
54+
python-version: "3.13"
6555
- name: Install dependencies
6656
run: |
6757
python -m pip install --upgrade pip
6858
python -m pip install --upgrade twine build
69-
- name: Lint with twine
59+
- name: Check with twine
7060
run: |
7161
python -m build .
7262
twine check dist/*

.readthedocs.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
version: 2
22

3+
sphinx:
4+
configuration: docs/conf.py
5+
36
build:
47
os: ubuntu-22.04
58
tools:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ lint = [
5353
]
5454
test = [
5555
"pytest>=8.0",
56-
"coverage>=6.5",
56+
"pytest-cov",
5757
"lxml>=4.9",
5858
"setuptools>=70.0", # for Cython compilation
5959
"typing_extensions>=4.9", # for typing_extensions.Unpack

sphinxarg/ext.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -764,15 +764,11 @@ def run(self):
764764
if 'prog' in self.options:
765765
parser.prog = self.options['prog']
766766

767-
# Argparse in Python 3.14 uses ANSI color codes by default (#72)
768-
if hasattr(parser, 'color'):
769-
parser.color = 'color' in self.options
770-
# Disable colors, unless a flag is present in the user-settings
771-
772767
result = parse_parser(
773768
parser,
774769
skip_default_values='nodefault' in self.options,
775770
skip_default_const_values='nodefaultconst' in self.options,
771+
color='color' in self.options,
776772
)
777773
result = parser_navigate(result, path)
778774
if 'manpage' in self.options:

sphinxarg/parser.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,18 @@ def _format_usage_without_prefix(parser):
5555

5656

5757
def parse_parser(parser, data=None, **kwargs):
58+
"""Take data from argparse argument parser.
59+
60+
Keyword arguments:
61+
- skip_default_values
62+
- skip_default_const_values
63+
- color
64+
"""
65+
# Argparse in Python 3.14 uses ANSI color codes by default (#72)
66+
if hasattr(parser, 'color'):
67+
parser.color = kwargs.get('color', False)
68+
# Disable colors, unless a flag is presented through user-settings
69+
5870
if data is None:
5971
data = {
6072
'name': '',
@@ -85,6 +97,11 @@ def parse_parser(parser, data=None, **kwargs):
8597
for name, subaction in action._name_parser_map.items():
8698
if name in subsection_alias_names:
8799
continue
100+
101+
if hasattr(subaction, 'color'):
102+
subaction.color = parser.color
103+
# Color is not inherited, must be set again
104+
88105
subalias = subsection_alias[subaction]
89106
subaction.prog = f'{parser.prog} {name}'
90107
subdata = {

0 commit comments

Comments
 (0)