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
10 changes: 6 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,27 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Check Python version
run: python --version --version
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[test] pytest-cov
python -m pip install .[test]
- name: Test with pytest
run: >
python -m pytest
-vv
--cov . --cov-append --cov-config pyproject.toml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
flags: unittests
43 changes: 16 additions & 27 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,57 +16,46 @@ env:
FORCE_COLOR: "1"

jobs:
ruff:
lint:
name: "Ruff & MyPy"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: "3"
- name: Install pip
run: python -m pip install --upgrade pip

- name: Install Ruff
run: python -m pip install "ruff==0.5.2"
python-version: "3.13"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[lint] pytest
# Also install pytest here, otherwise mypy will complain about our test files

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

- name: Format with Ruff
run: ruff format . --diff

mypy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install ".[lint,test]"
- name: Type check with mypy
- name: Type check with MyPy
run: mypy

twine:
name: "Check packing with Twine"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: "3"
python-version: "3.13"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade twine build
- name: Lint with twine
- name: Check with twine
run: |
python -m build .
twine check dist/*
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ lint = [
]
test = [
"pytest>=8.0",
"coverage>=6.5",
"pytest-cov",
"lxml>=4.9",
"setuptools>=70.0", # for Cython compilation
"typing_extensions>=4.9", # for typing_extensions.Unpack
Expand Down
2 changes: 1 addition & 1 deletion sphinxarg/ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def print_action_groups(
arg = []
if 'choices' in entry:
arg.append(
f"Possible choices: {', '.join(str(c) for c in entry['choices'])}\n"
f'Possible choices: {", ".join(str(c) for c in entry["choices"])}\n'
)
if 'help' in entry:
arg.append(entry['help'])
Expand Down
8 changes: 4 additions & 4 deletions sphinxarg/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def parser_navigate(parser_result, path, current_path=None):
if len(path) == 0:
return parser_result
if 'children' not in parser_result:
msg = f"Current parser has no child elements. (path: {' '.join(current_path)})"
msg = f'Current parser has no child elements. (path: {" ".join(current_path)})'
raise NavigationException(msg)
next_hop = path.pop(0)
for child in parser_result['children']:
Expand All @@ -28,8 +28,8 @@ def parser_navigate(parser_result, path, current_path=None):
current_path.append(next_hop)
return parser_navigate(child, path, current_path)
msg = (
f"Current parser has no child element with name: {next_hop} "
f"(path: {' '.join(current_path)})"
f'Current parser has no child element with name: {next_hop} '
f'(path: {" ".join(current_path)})'
)
raise NavigationException(msg)

Expand Down Expand Up @@ -88,7 +88,7 @@ def parse_parser(parser, data=None, **kwargs):
subalias = subsection_alias[subaction]
subaction.prog = f'{parser.prog} {name}'
subdata = {
'name': name if not subalias else f"{name} ({', '.join(subalias)})",
'name': name if not subalias else f'{name} ({", ".join(subalias)})',
'help': helps.get(name, ''),
'usage': subaction.format_usage().strip(),
'bare_usage': _format_usage_without_prefix(subaction),
Expand Down
Loading