diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a382cf1..0ceb7936 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,11 +34,13 @@ 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 @@ -46,13 +48,13 @@ jobs: - 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 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 18d72289..3e276a26 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,20 +16,21 @@ 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 @@ -37,36 +38,24 @@ jobs: - 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/* diff --git a/pyproject.toml b/pyproject.toml index 4332e39b..d12979da 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 diff --git a/sphinxarg/ext.py b/sphinxarg/ext.py index d318b0ad..8846cdbb 100644 --- a/sphinxarg/ext.py +++ b/sphinxarg/ext.py @@ -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']) diff --git a/sphinxarg/parser.py b/sphinxarg/parser.py index cfb9b8ba..2a2400c1 100644 --- a/sphinxarg/parser.py +++ b/sphinxarg/parser.py @@ -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']: @@ -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) @@ -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),