Skip to content

Commit c2e89d0

Browse files
committed
build: copier-auto-update
1 parent 5546adf commit c2e89d0

File tree

9 files changed

+79
-70
lines changed

9 files changed

+79
-70
lines changed

.copier-answers.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Answer file maintained by Copier for: https://github.com/KyleKing/mdformat-plugin-template
33
# DO NOT MODIFY THIS FILE. Edit by re-running copier and changing responses to the questions
44
# Check into version control.
5-
_commit: 1.0.2
5+
_commit: 1.1.1
66
_src_path: gh:KyleKing/mdformat-plugin-template
77
author_email: [email protected]
88
author_name: Kyle King
@@ -13,4 +13,5 @@ plugin_name: admon
1313
repository_namespace: kyleking
1414
repository_provider: https://github.com
1515
repository_url: https://github.com/kyleking/mdformat-admon
16+
sync_admon_factories: true
1617

.github/workflows/tests.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
---
22
name: CI
3+
34
"on":
45
push:
56
branches: [main]
67
tags: [v*]
78
pull_request: null
9+
810
jobs:
911
pre-commit:
1012
runs-on: ubuntu-latest
@@ -15,6 +17,7 @@ jobs:
1517
with:
1618
python-version: 3.12
1719
- uses: pre-commit/[email protected]
20+
1821
tests:
1922
runs-on: ${{ matrix.os }}
2023
strategy:
@@ -30,22 +33,20 @@ jobs:
3033
- name: Installation (deps and package)
3134
# We install with flit --pth-file, so that coverage will be recorded for the module
3235
# Flit could be installed with pipx and use '--python=$(which python)', but
33-
# there are issues with the Windows Runner
36+
# there were issues with the Windows Runner
3437
run: |
35-
pip install flit~=3.9
38+
pip install flit~=3.10.1
3639
flit install --deps=production --extras=test --pth-file
3740
- name: Run pytest
3841
run: |
39-
pytest --cov=$(ls | grep "mdformat_" | head) --cov-report=xml --cov-report=term-missing
40-
# Not currently configured
41-
# - name: Upload to Codecov
42-
# if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.12
43-
# uses: codecov/codecov-action@v1
42+
pytest --cov
43+
# # Not currently configured
44+
# - name: Report coverage
45+
# if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
46+
# uses: codecov/codecov-action@v4
4447
# with:
45-
# name: pytests-py3.12
46-
# flags: pytests
47-
# file: ./coverage.xml
48-
# fail_ci_if_error: true
48+
# token: ${{ secrets.CODECOV_TOKEN }}
49+
4950
pre-commit-hook:
5051
runs-on: ubuntu-latest
5152
steps:
@@ -61,6 +62,7 @@ jobs:
6162
- name: run pre-commit with plugin
6263
run: |
6364
pre-commit run --config .pre-commit-test.yaml --all-files --verbose --show-diff-on-failure
65+
6466
publish:
6567
name: Publish to PyPi
6668
needs: [pre-commit, tests, pre-commit-hook]
@@ -74,7 +76,7 @@ jobs:
7476
uses: actions/checkout@v4
7577
- name: install flit
7678
run: |
77-
pipx install flit~=3.9
79+
pipx install flit~=3.10.1
7880
- name: Build and publish
7981
run: |
8082
flit publish

.pre-commit-config.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ repos:
1818
- id: end-of-file-fixer
1919
exclude: \.copier-answers\.yml|__snapshots__/.*\.ambr
2020
- id: fix-byte-order-marker
21-
- id: fix-encoding-pragma
22-
args: [--remove]
2321
- id: forbid-new-submodules
2422
- id: mixed-line-ending
2523
args: [--fix=auto]

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ To install these development dependencies:
1515

1616
```bash
1717
pipx install tox
18-
# or: uv tool install tox
18+
# or: uv tool install tox --with tox-uv
1919
```
2020

2121
To run the tests:

mdformat_admon/_synced/factores/_whitespace_admon_factories.py renamed to mdformat_admon/_synced/admon_factories/_whitespace_admon_factories.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@
1818

1919

2020
def _get_multiple_tags(meta_text: str) -> tuple[list[str], str]:
21-
"""Check for multiple tags when the title is double quoted."""
21+
"""Check for multiple tags when the title is double quoted.
22+
23+
Raises:
24+
ValueError: if no tags matched
25+
26+
"""
2227
re_tags = re.compile(r'^\s*(?P<tokens>[^"]+)\s+"(?P<title>.*)"\S*$')
2328
if match := re_tags.match(meta_text):
2429
tags = match["tokens"].strip().split(" ")
@@ -34,8 +39,8 @@ def parse_tag_and_title(admon_meta_text: str) -> tuple[list[str], str]:
3439
with suppress(ValueError):
3540
return _get_multiple_tags(meta_text)
3641

37-
tag, *_title = meta_text.split(" ")
38-
joined = " ".join(_title)
42+
tag, *title_ = meta_text.split(" ")
43+
joined = " ".join(title_)
3944

4045
title = ""
4146
if not joined:
@@ -54,9 +59,9 @@ def validate_admon_meta(meta_text: str) -> bool:
5459
class AdmonState(NamedTuple):
5560
"""Frozen state using the same variable case."""
5661

57-
parentType: str # noqa: N815
58-
lineMax: int # noqa: N815
59-
blkIndent: int # noqa: N815
62+
parentType: str
63+
lineMax: int
64+
blkIndent: int
6065

6166

6267
class AdmonitionData(NamedTuple):
@@ -205,8 +210,8 @@ def default_render(
205210
def admon_plugin_factory(
206211
prefix: str,
207212
logic: Callable[[StateBlock, int, int, bool], bool],
208-
) -> Callable[[MarkdownIt, None | RenderType], None]:
209-
def admon_plugin(md: MarkdownIt, render: None | RenderType = None) -> None:
213+
) -> Callable[[MarkdownIt, RenderType | None], None]:
214+
def admon_plugin(md: MarkdownIt, render: RenderType | None = None) -> None:
210215
render = render or default_render
211216

212217
md.add_render_rule(f"{prefix}_open", render)

mdformat_admon/mdit_plugins/_python_markdown_admon.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from markdown_it.rules_block import StateBlock
44

5-
from mdformat_admon._synced.factories import (
5+
from mdformat_admon._synced.admon_factories import (
66
AdmonitionData,
77
admon_plugin_factory,
88
new_token,

pyproject.toml

Lines changed: 48 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ classifiers = [
1313
"Topic :: Software Development :: Libraries :: Python Modules",
1414
]
1515
dependencies = [
16-
"mdformat >= 0.7.18",
16+
"mdformat == 0.7.18",
1717
"mdit-py-plugins >= 0.4.1",
1818
]
1919
dynamic = ["description", "version"]
@@ -26,11 +26,10 @@ requires-python = ">=3.9.0"
2626
admon = "mdformat_admon"
2727

2828
[project.optional-dependencies]
29-
dev = ["pre-commit"]
3029
test = [
31-
"pytest >= 8.3.3",
32-
"pytest-beartype >= 0.1.0",
33-
"pytest-cov >= 5.0.0",
30+
"pytest >= 8.3.4",
31+
"pytest-beartype >= 0.1.1",
32+
"pytest-cov >= 6.0.0",
3433
]
3534

3635
[project.urls]
@@ -80,8 +79,6 @@ target-version = 'py39'
8079
ignore = [
8180
'ANN002', # Missing type annotation for `*args`
8281
'ANN003', # Missing type annotation for `**kwargs`
83-
'ANN101', # Missing type annotation for `self` in method (automatically inferred)
84-
'ANN102', # Missing type annotation for `cls` in classmethod (automatically inferred)
8582
'BLE001', # Do not catch blind exception: `Exception`
8683
'CPY001', # Missing copyright notice at top of file
8784
'D203', # "1 blank line required before class docstring" (Conflicts with D211)
@@ -97,8 +94,8 @@ ignore = [
9794
'N815', # Variable `lineMax` in class scope should not be mixedCase
9895
'PLR0913', # Too many arguments in function definition (6 > 5)
9996
'S101', # Use of `assert` detected
100-
'TCH002', # Move third-party import `mdformat.renderer.typing.Postprocess` into a type-checking block (for beartype)
101-
'TCH003', # Move standard library import `argparse` into a type-checking block (for beartype)
97+
'TC002', # Move third-party import `mdformat.renderer.typing.Postprocess` into a type-checking block (for beartype)
98+
'TC003', # Move standard library import `argparse` into a type-checking block (for beartype)
10299
'TD001', # Invalid TODO tag: `FIXME`
103100
'TD002', # Missing author in TODO; try: `# TODO(<author_name>): ...`
104101
'TD003', # Missing issue link on the line following this TODO
@@ -136,3 +133,45 @@ convention = "google"
136133
all = true
137134
in_place = true
138135
trailing_comma_inline_array = true
136+
137+
[tool.tox]
138+
# Docs: https://tox.wiki/en/4.23.2/config.html#core
139+
envlist = [
140+
"py312-beartype",
141+
"py312-mypy",
142+
"py312-pre-commit",
143+
"py312-ruff",
144+
"py39-cov",
145+
"py39-hook",
146+
]
147+
isolated_build = true
148+
requires = ["tox>=4.20.0"]
149+
skip_missing_interpreters = false
150+
151+
[tool.tox."py312-beartype"]
152+
commands = ["pytest posargs --ff --nf -vv --exitfirst --beartype-packages='mdformat_admon'"]
153+
extras = "test"
154+
155+
[tool.tox."py312-mypy"]
156+
commands = ["mypy ./mdformat_admon"]
157+
deps = "mypy>=1.13.0"
158+
159+
[tool.tox."py312-pre-commit"]
160+
commands = ["pre-commit run posargs:--all-files"]
161+
deps = "pre-commit>=4.0.1"
162+
163+
[tool.tox."py312-ruff"]
164+
commands = [
165+
"ruff check . --fix --unsafe-fixes",
166+
"ruff format .",
167+
]
168+
deps = "ruff>=0.8.3"
169+
skip_install = true
170+
171+
[tool.tox."py39-cov"]
172+
commands = ["pytest --cov=mdformat_admon posargs"]
173+
extras = "test"
174+
175+
[tool.tox."py39-hook"]
176+
commands = ["pre-commit run --config .pre-commit-test.yaml posargs:--all-files --verbose --show-diff-on-failure"]
177+
deps = "pre-commit>=4.0.1"

tox.ini

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)