Skip to content

Commit 5b1b90c

Browse files
committed
Update dependencies
1 parent 3f2dd51 commit 5b1b90c

File tree

11 files changed

+819
-652
lines changed

11 files changed

+819
-652
lines changed

.github/workflows/python-package.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
python-version: ['3.9', '3.10', '3.11', '3.12']
18-
poetry-version: [1.7.1]
19-
pandoc-version: [3.1.11.1]
17+
python-version: ['3.10', '3.11', '3.12']
18+
poetry-version: [1.8.3]
19+
pandoc-version: ['3.3']
2020
steps:
2121
- uses: actions/checkout@v4
2222
- name: Set up Python ${{ matrix.python-version }}
@@ -41,8 +41,8 @@ jobs:
4141
strategy:
4242
matrix:
4343
python-version: ['3.12']
44-
poetry-version: [1.2.2, 1.3.2, 1.4.2, 1.5.1, 1.6.1, 1.7.1]
45-
pandoc-version: [3.1.11.1]
44+
poetry-version: [1.2.2, 1.3.2, 1.4.2, 1.5.1, 1.6.1, 1.7.1, 1.8.3]
45+
pandoc-version: ['3.3']
4646
steps:
4747
- uses: actions/checkout@v3
4848
- name: Set up Python ${{ matrix.python-version }}
@@ -67,8 +67,8 @@ jobs:
6767
strategy:
6868
matrix:
6969
python-version: ['3.12']
70-
poetry-version: [1.7.1]
71-
pandoc-version: [2.11.4, '2.12', '2.13', 2.14.2, '2.15', 2.16.2, 2.17.1.1, '2.18', 2.19.2, 3.0.1, 3.1.11.1]
70+
poetry-version: [1.8.3]
71+
pandoc-version: [2.11.4, '2.12', '2.13', 2.14.2, '2.15', 2.16.2, 2.17.1.1, '2.18', 2.19.2, 3.0.1, 3.1.13, 3.2.1, '3.3']
7272
steps:
7373
- uses: actions/checkout@v4
7474
- name: Set up Python ${{ matrix.python-version }}
@@ -99,7 +99,7 @@ jobs:
9999
- name: Set up Poetry
100100
uses: abatilo/actions-poetry@v2
101101
with:
102-
poetry-version: 1.7.1
102+
poetry-version: 1.8.3
103103
- name: Install dependencies
104104
run: |
105105
poetry install
@@ -119,11 +119,11 @@ jobs:
119119
- name: Set up Poetry
120120
uses: abatilo/actions-poetry@v2
121121
with:
122-
poetry-version: 1.7.1
122+
poetry-version: 1.8.3
123123
- name: Install dependencies
124124
run: |
125-
wget https://github.com/jgm/pandoc/releases/download/3.1.11.1/pandoc-3.1.11.1-1-amd64.deb
126-
sudo dpkg -i ./pandoc-3.1.11.1-1-amd64.deb
125+
wget https://github.com/jgm/pandoc/releases/download/3.3/pandoc-3.3-1-amd64.deb
126+
sudo dpkg -i ./pandoc-3.3-1-amd64.deb
127127
poetry install
128128
- name: Test
129129
env:

.github/workflows/python-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Set up Poetry
2222
uses: abatilo/actions-poetry@v2
2323
with:
24-
poetry-version: 1.7.1
24+
poetry-version: 1.8.3
2525
- name: Set up poetry-dynamic-versioning
2626
run: |
2727
poetry self add "poetry-dynamic-versioning[plugin]"

.pre-commit-config.yaml

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.4.0
3+
rev: v4.6.0
44
hooks:
55
- id: check-toml
66
- id: check-yaml
@@ -11,7 +11,7 @@ repos:
1111
- id: check-poetry
1212

1313
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
14-
rev: v2.10.0
14+
rev: v2.14.0
1515
hooks:
1616
- id: pretty-format-toml
1717
exclude: ^poetry.lock$
@@ -25,14 +25,14 @@ repos:
2525
- id: tox-ini-fmt
2626

2727
- repo: https://github.com/ariebovenberg/slotscheck
28-
rev: v0.17.0
28+
rev: v0.19.0
2929
hooks:
3030
- id: slotscheck
3131
language: system
32-
exclude: ^(?!pandoc_codeblock_include.py)
32+
exclude: ^(?!pandoc_codeblock_include/)
3333

3434
- repo: https://github.com/dosisod/refurb
35-
rev: v1.20.0
35+
rev: v2.0.0
3636
hooks:
3737
- id: refurb
3838

@@ -42,17 +42,17 @@ repos:
4242
- id: teyit
4343

4444
- repo: https://github.com/astral-sh/ruff-pre-commit
45-
rev: v0.0.287
45+
rev: v0.5.5
4646
hooks:
4747
- id: ruff
4848
language: system
49-
exclude: ^(?!pandoc_codeblock_include.py)
49+
exclude: ^(?!pandoc_codeblock_include/)
5050

5151
- repo: https://github.com/psf/black
52-
rev: 23.7.0
52+
rev: 24.4.2
5353
hooks:
5454
- id: black-jupyter
55-
args: [--config=pyproject.toml, pandoc_codeblock_include.py, tests]
55+
args: [--config=pyproject.toml, pandoc_codeblock_include/, tests]
5656

5757
- repo: https://github.com/PyCQA/doc8/
5858
rev: v1.1.1
@@ -61,22 +61,30 @@ repos:
6161
args: [docs]
6262

6363
- repo: https://github.com/pre-commit/mirrors-mypy
64-
rev: v1.5.1
64+
rev: v1.11.0
6565
hooks:
6666
- id: mypy
6767
language: system
68-
exclude: ^(?!pandoc_codeblock_include.py)
68+
exclude: ^(?!pandoc_codeblock_include/)
6969

7070
- repo: https://github.com/pycqa/flake8
71-
rev: 6.1.0
71+
rev: 7.1.0
7272
hooks:
7373
- id: flake8
7474
language: system
75-
exclude: ^(?!pandoc_codeblock_include.py)
75+
exclude: ^(?!pandoc_codeblock_include/)
7676

7777
- repo: https://github.com/pre-commit/mirrors-pylint
7878
rev: v3.0.0a5
7979
hooks:
8080
- id: pylint
8181
language: system
82-
exclude: ^(?!pandoc_codeblock_include.py)
82+
exclude: ^(?!pandoc_codeblock_include/)
83+
84+
- repo: https://github.com/asottile/pyupgrade
85+
rev: v3.17.0
86+
hooks:
87+
- id: pyupgrade
88+
language: system
89+
args: [--py310-plus]
90+

.readthedocs.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ build:
2020
post_install:
2121
# Install dependencies with 'docs' dependency group
2222
# https://python-poetry.org/docs/managing-dependencies/#dependency-groups
23-
- poetry install --with docs
23+
# VIRTUAL_ENV needs to be set manually for now.
24+
# See https://github.com/readthedocs/readthedocs.org/pull/11152/
25+
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --with docs
2426

2527
# Build documentation in the "docs/" directory with Sphinx
2628
sphinx:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ Installation
1414
[![Last commit](https://img.shields.io/github/last-commit/chdemko/pandoc-codeblock-include/develop?logo=github)](https://github.com/chdemko/pandoc-codeblock-include/commit/develop/)
1515
[![License](https://img.shields.io/pypi/l/pandoc-codeblock-include.svg?logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gVXBsb2FkZWQgdG86IFNWRyBSZXBvLCB3d3cuc3ZncmVwby5jb20sIEdlbmVyYXRvcjogU1ZHIFJlcG8gTWl4ZXIgVG9vbHMgLS0+Cgo8c3ZnCiAgIGhlaWdodD0iODAwcHgiCiAgIHdpZHRoPSI4MDBweCIKICAgdmVyc2lvbj0iMS4xIgogICBpZD0iX3gzMl8iCiAgIHZpZXdCb3g9IjAgMCA1MTIgNTEyIgogICB4bWw6c3BhY2U9InByZXNlcnZlIgogICBzb2RpcG9kaTpkb2NuYW1lPSJiYWxhbmNlLTEtc3ZncmVwby1jb20uc3ZnIgogICBpbmtzY2FwZTp2ZXJzaW9uPSIxLjEuMiAoMGEwMGNmNTMzOSwgMjAyMi0wMi0wNCkiCiAgIHhtbG5zOmlua3NjYXBlPSJodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy9uYW1lc3BhY2VzL2lua3NjYXBlIgogICB4bWxuczpzb2RpcG9kaT0iaHR0cDovL3NvZGlwb2RpLnNvdXJjZWZvcmdlLm5ldC9EVEQvc29kaXBvZGktMC5kdGQiCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL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IuOTY5Yy03LjMwNSwwLTE2LjE1OSwwLTI0Ljg3NCwwdi0yMy44NThoLTEzLjIwM1YxNDEuM2gtOC41MDd2LTI0LjIzICAgYzQ1LjA3MiwzLjAxNSw5Ny40NTcsMjIuNjA0LDEzNC42NCwzNC4wNzJsLTYwLjM1OCwxNzEuMTM0aC0xMS4zODdjMTEuNDk2LDM4LjAyNSw0Ni44MDQsNjUuNzM2LDg4LjU5LDY1LjczNiAgIGM0MS43OSwwLDc3LjA5OC0yNy43MTEsODguNTk0LTY1LjczNkg1MDAuNjA5eiBNMTQxLjI0MywzMjIuMjc1SDM1Ljk0OEw4OC41OTUsMTczTDE0MS4yNDMsMzIyLjI3NXogTTM3MC43NTgsMzIyLjI3NUw0MjMuNDEsMTczICAgbDUyLjY0MywxNDkuMjc1SDM3MC43NTh6IgogICBpZD0icGF0aDMzNzkiCiAgIHN0eWxlPSJmaWxsOiNmZmZmZmYiIC8+CjwvZz4KPC9zdmc+Cg==)](https://raw.githubusercontent.com/chdemko/pandoc-codeblock-include/develop/LICENSE)
1616
[![Python version](https://img.shields.io/pypi/pyversions/pandoc-codeblock-include.svg?logo=Python&logoColor=white)](https://pypi.org/project/pandoc-codeblock-include/)
17-
[![Poetry version](https://img.shields.io/badge/poetry-1.2%20|%201.3%20|%201.4%20|%201.5%20|%201.6%20|%201.7-blue.svg?logo=poetry)](https://python-poetry.org/)
18-
[![Pandoc version](https://img.shields.io/badge/pandoc-2.11%20|%202.12%20|%202.13%20|%202.14%20|%202.15%20|%202.16%20|%202.17%20|%202.18%20|%202.19%20|%203.0%20|%203.1-blue.svg?logo=markdown)](https://pandoc.org/)
17+
[![Poetry version](https://img.shields.io/badge/poetry-1.2%20|%201.3%20|%201.4%20|%201.5%20|%201.6%20|%201.7%20|%201.8-blue.svg?logo=poetry)](https://python-poetry.org/)
18+
[![Pandoc version](https://img.shields.io/badge/pandoc-2.11%20|%202.12%20|%202.13%20|%202.14%20|%202.15%20|%202.16%20|%202.17%20|%202.18%20|%202.19%20|%203.0%20|%203.1%20|%203.2%20|%203.3-blue.svg?logo=markdown)](https://pandoc.org/)
1919
[![Downloads](https://img.shields.io/pypi/dm/pandoc-codeblock-include?logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gVXBsb2FkZWQgdG86IFNWRyBSZXBvLCB3d3cuc3ZncmVwby5jb20sIEdlbmVyYXRvcjogU1ZHIFJlcG8gTWl4ZXIgVG9vbHMgLS0+Cgo8c3ZnCiAgIHdpZHRoPSI4MDBweCIKICAgaGVpZ2h0PSI4MDBweCIKICAgdmlld0JveD0iMCAwIDI0IDI0IgogICBmaWxsPSJub25lIgogICB2ZXJzaW9uPSIxLjEiCiAgIGlkPSJzdmc0IgogICBzb2RpcG9kaTpkb2NuYW1lPSJkb3dubG9hZC1zdmdyZXBvLWNvbS5zdmciCiAgIGlua3NjYXBlOnZlcnNpb249IjEuMS4yICgwYTAwY2Y1MzM5LCAyMDIyLTAyLTA0KSIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjZmZmZmZmIgogICAgIGJvcmRlcmNvbG9yPSIjNjY2NjY2IgogICAgIGJvcmRlcm9wYWNpdHk9IjEuMCIKICAgICBpb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UxIDkuNTE5OTcgMS41IDExLjc3OTMgMS41IDE0LjVDMS41IDE3LjUzNzYgMy45NjI0MyAyMCA3IDIwSDcuMUM3LjY1MjI4IDIwIDguMSAxOS41NTIzIDguMSAxOUM4LjEgMTguNDQ3NyA3LjY1MjI4IDE4IDcuMSAxOEg3QzUuMDY3IDE4IDMuNSAxNi40MzMgMy41IDE0LjVDMy41IDEyLjU2NyA1LjA2NyAxMSA3IDExSDhWMTBaTTEzIDExQzEzIDEwLjQ0NzcgMTIuNTUyMyAxMCAxMiAxMEMxMS40NDc3IDEwIDExIDEwLjQ0NzcgMTEgMTFWMTYuNTg1OEw5LjcwNzExIDE1LjI5MjlDOS4zMTY1OCAxNC45MDI0IDguNjgzNDIgMTQuOTAyNCA4LjI5Mjg5IDE1LjI5MjlDNy45MDIzNyAxNS42ODM0IDcuOTAyMzcgMTYuMzE2NiA4LjI5Mjg5IDE2LjcwNzFMMTEuMjkyOSAxOS43MDcxQzExLjY4MzQgMjAuMDk3NiAxMi4zMTY2IDIwLjA5NzYgMTIuNzA3MSAxOS43MDcxTDE1LjcwNzEgMTYuNzA3MUMxNi4wOTc2IDE2LjMxNjYgMTYuMDk3NiAxNS42ODM0IDE1LjcwNzEgMTUuMjkyOUMxNS4zMTY2IDE0LjkwMjQgMTQuNjgzNCAxNC45MDI0IDE0LjI5MjkgMTUuMjkyOUwxMyAxNi41ODU4VjExWiIKICAgICBmaWxsPSIjMDAwMDAwIgogICAgIGlkPSJwYXRoMiIKICAgICBzdHlsZT0iZmlsbDojZmZmZmZmIiAvPgo8L3N2Zz4K)](https://pepy.tech/project/pandoc-codeblock-include)
2020
[![Development Status](https://img.shields.io/pypi/status/pandoc-codeblock-include.svg?logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgdmlld0JveD0iMCAwIDMyIDMyIgogICB2ZXJzaW9uPSIxLjEiCiA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TIwIgogICAgIGlua3NjYXBlOndpbmRvdy15PSIwIgogICAgIGlua3NjYXBlOndpbmRvdy1tYXhpbWl6ZWQ9IjEiCiAgICAgaW5rc2NhcGU6Y3VycmVudC1sYXllcj0ic3ZnMTA2NCIgLz4KICA8dGl0bGUKICAgICBpZD0idGl0bGUxMDU5IiAvPgogIDxnCiAgICAgZGF0YS1uYW1lPSIyNi1CYXR0ZXJ5IHN0YXR1cyIKICAgICBpZD0iXzI2LUJhdHRlcnlfc3RhdHVzIgogICAgIHN0eWxlPSJmaWxsOiNmZmZmZmYiPgogICAgPHBhdGgKICAgICAgIGQ9Ik0zMSwxM0gzMFYxMmExLDEsMCwwLDAtMS0xSDI4VjEwYTIsMiwwLDAsMC0yLTJIMmEyLDIsMCwwLDAtMiwyVjIyYTIsMiwwLDAsMCwyLDJIMjZhMiwyLDAsMCwwLDItMlYyMWgxYTEsMSwwLDAsMCwxLTFWMTloMWExLDEsMCwwLDAsMS0xVjE0QTEsMSwwLDAsMCwzMSwxM1ptLTUtMVYyMkgxOFYxMGg4WiIKICAgICAgIGlkPSJwYXRoMTA2MSIKICAgICAgIHN0eWxlPSJmaWxsOiNmZmZmZmYiIC8+CiAgPC9nPgo8L3N2Zz4K)](https://pypi.org/project/pandoc-codeblock-include/)
2121
[![Docs](https://img.shields.io/readthedocs/pandoc-codeblock-include.svg?logo=read-the-docs&logoColor=white)](https://pandoc-codeblock-include.readthedocs.io)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"""
2+
pandoc_codeblock_include package.
3+
"""
4+
5+
from ._main import main
6+
7+
__all__ = ("main",)
8+
9+
if __name__ == "__main__":
10+
main()

pandoc_codeblock_include.py renamed to pandoc_codeblock_include/_main.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@
44
Pandoc filter for including file in code block.
55
"""
66

7-
from panflute import CodeBlock, debug, run_filters
7+
from collections.abc import Iterable
8+
from typing import Any
89

10+
from panflute import CodeBlock, Doc, Element, debug, run_filters
911

10-
def parse_include(parsed, name, value):
12+
13+
def parse_include(parsed: dict[str, Any], name: str, value: str) -> None:
1114
"""
1215
Extract include information from attributes.
1316
@@ -22,11 +25,11 @@ def parse_include(parsed, name, value):
2225
"""
2326
if name == "include":
2427
try:
25-
with open(value, "r", encoding="utf-8") as stream:
28+
with open(value, encoding="utf-8") as stream:
2629
file_content = stream.readlines()
2730
parsed["content"] = file_content
2831
parsed["include"] = value
29-
except IOError:
32+
except OSError:
3033
debug("[WARNING] pandoc-codeblock-include: " + value + " not found")
3134
except UnicodeDecodeError:
3235
debug(
@@ -36,7 +39,7 @@ def parse_include(parsed, name, value):
3639
)
3740

3841

39-
def parse_start_from(parsed, name, value):
42+
def parse_start_from(parsed: dict[str, Any], name: str, value: str) -> None:
4043
"""
4144
Extract startFrom information from attributes.
4245
@@ -60,9 +63,9 @@ def parse_start_from(parsed, name, value):
6063
)
6164

6265

63-
def parse_end_at(parsed, name, value):
66+
def parse_end_at(parsed: dict[str, Any], name: str, value: str) -> None:
6467
"""
65-
Extract entAt information from attributes.
68+
Extract information from attributes.
6669
6770
Arguments
6871
---------
@@ -84,7 +87,7 @@ def parse_end_at(parsed, name, value):
8487
)
8588

8689

87-
def parse_attributes(items):
90+
def parse_attributes(items: Iterable[tuple[str, str]]) -> dict[str, str]:
8891
"""
8992
Extract usefull information from attributes.
9093
@@ -95,17 +98,18 @@ def parse_attributes(items):
9598
9699
Returns
97100
-------
101+
dict[str, str]
98102
a mapping containing possible 'content', 'start_from' and 'end_at'
99103
"""
100-
parsed = {}
104+
parsed: dict[str, Any] = {}
101105
for name, value in items:
102106
parse_include(parsed, name, value)
103107
parse_start_from(parsed, name, value)
104108
parse_end_at(parsed, name, value)
105109
return parsed
106110

107111

108-
def inject_content(elem, parsed):
112+
def inject_content(elem: Element, parsed: dict[str, Any]) -> None:
109113
"""
110114
Inject parsed attributes into element content.
111115
@@ -133,7 +137,7 @@ def inject_content(elem, parsed):
133137
)
134138

135139

136-
def clear_latex_attributes(elem):
140+
def clear_latex_attributes(elem: Element) -> None:
137141
"""
138142
Clear LaTeX attributes.
139143
@@ -148,7 +152,7 @@ def clear_latex_attributes(elem):
148152
del elem.attributes[attribute]
149153

150154

151-
def include(elem, doc):
155+
def include(elem: Element, doc: Doc) -> None:
152156
"""
153157
Transform CodeBlock element.
154158
@@ -168,7 +172,7 @@ def include(elem, doc):
168172
clear_latex_attributes(elem)
169173

170174

171-
def main(doc=None):
175+
def main(doc: Doc | None = None) -> Doc:
172176
"""
173177
Convert the pandoc document.
174178
@@ -179,6 +183,7 @@ def main(doc=None):
179183
180184
Returns
181185
-------
186+
Doc
182187
The modified pandoc document.
183188
"""
184189
return run_filters([include], doc=doc)

0 commit comments

Comments
 (0)