Skip to content

Commit c57d586

Browse files
Release v0.5.10 (#36)
* Bump abatilo/actions-poetry from 2.1.6 to 2.3.0 Bumps [abatilo/actions-poetry](https://github.com/abatilo/actions-poetry) from 2.1.6 to 2.3.0. - [Release notes](https://github.com/abatilo/actions-poetry/releases) - [Changelog](https://github.com/abatilo/actions-poetry/blob/master/.releaserc) - [Commits](abatilo/actions-poetry@v2.1.6...v2.3.0) --- updated-dependencies: - dependency-name: abatilo/actions-poetry dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * Bump mkdocstrings from 0.19.1 to 0.25.1 Bumps [mkdocstrings](https://github.com/mkdocstrings/mkdocstrings) from 0.19.1 to 0.25.1. - [Release notes](https://github.com/mkdocstrings/mkdocstrings/releases) - [Changelog](https://github.com/mkdocstrings/mkdocstrings/blob/main/CHANGELOG.md) - [Commits](mkdocstrings/mkdocstrings@0.19.1...0.25.1) --- updated-dependencies: - dependency-name: mkdocstrings dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * (chore) lock update and update in CICD (#35) * (chore) lock update and update in CICD * (chore) updated preprocessor and added testing * (chore) updated pre commit hooks and versions * (chore) updated test to match boostrap distro, improved test error msg. * (chore) upgraded missing versions of checkout and python setup in cicd --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 82250d3 commit c57d586

14 files changed

+1766
-1394
lines changed

.github/workflows/CICD.yml

+10-10
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
cheap_checks:
1313
runs-on: 'ubuntu-latest'
1414
steps:
15-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v4
1616

1717
# Python setup
18-
- uses: actions/setup-python@v4
18+
- uses: actions/setup-python@v5
1919
with:
2020
python-version: '3.x'
2121

@@ -39,7 +39,7 @@ jobs:
3939
- name: Black
4040
run: poetry run python -m black . --check --diff
4141
- name: ruff
42-
run: poetry run ruff .
42+
run: poetry run ruff check .
4343
- name: isort
4444
run: poetry run isort . --check
4545

@@ -54,7 +54,7 @@ jobs:
5454
runs-on: ${{ matrix.os }}
5555
steps:
5656
# Initial Setup
57-
- uses: actions/checkout@v3
57+
- uses: actions/checkout@v4
5858

5959
# Documentation setup
6060
- name: Setup Quarto
@@ -63,7 +63,7 @@ jobs:
6363
run: quarto --version
6464

6565
# Python setup
66-
- uses: actions/setup-python@v4
66+
- uses: actions/setup-python@v5
6767
with:
6868
python-version: ${{ matrix.python-version }}
6969
- name: View Python --version
@@ -88,7 +88,7 @@ jobs:
8888
- name: mkdocs
8989
run: poetry run python -m mkdocs build --strict
9090

91-
- uses: codecov/codecov-action@v3
91+
- uses: codecov/codecov-action@v4
9292
with:
9393
verbose: true # optional (default = false)
9494

@@ -98,9 +98,9 @@ jobs:
9898
needs: ci
9999
if: endsWith(github.ref, 'heads/release') && (github.event_name == 'push')
100100
steps:
101-
- uses: actions/checkout@v3
101+
- uses: actions/checkout@v4
102102
- name: Release
103-
uses: softprops/action-gh-release@v1
103+
uses: softprops/action-gh-release@v2
104104
if: startsWith(github.ref, 'refs/tags/')
105105

106106
# Documentation setup
@@ -110,15 +110,15 @@ jobs:
110110
run: quarto --version
111111

112112
# Python setup
113-
- uses: actions/setup-python@v4
113+
- uses: actions/setup-python@v5
114114
with:
115115
python-version: '3.x'
116116
- name: View Python --version
117117
run: python --version
118118

119119
# Poetry Setup
120120
- name: Python Poetry Action
121-
uses: abatilo/actions-poetry@v2.1.6
121+
uses: abatilo/actions-poetry@v2.3.0
122122
with:
123123
poetry-version: '1.7.1'
124124
- name: View poetry --version

.github/workflows/lint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ jobs:
66
lint:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v3
9+
- uses: actions/checkout@v4
1010
- name: Black
1111
uses: psf/black@stable
1212
- name: Set up Python environment
13-
uses: actions/setup-python@v4
13+
uses: actions/setup-python@v5
1414
with:
1515
python-version: "3.9"

.pre-commit-config.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ repos:
1010
exclude: "(.*tests/data/.*/.*.md)"
1111
- id: debug-statements
1212
- repo: https://github.com/asottile/pyupgrade
13-
rev: v3.15.2
13+
rev: v3.17.0
1414
hooks:
1515
- id: pyupgrade
1616
- repo: https://github.com/PyCQA/autoflake
1717
rev: v2.3.1
1818
hooks:
1919
- id: autoflake
2020
- repo: https://github.com/psf/black
21-
rev: 24.4.0
21+
rev: 24.8.0
2222
hooks:
2323
- id: black
24-
language_version: python3.8
24+
language_version: python3.9
2525
- repo: https://github.com/charliermarsh/ruff-pre-commit
26-
rev: v0.3.7
26+
rev: v0.6.3
2727
hooks:
2828
- id: ruff
2929
- repo: https://github.com/pycqa/pydocstyle

docs/README.md

+26-16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
---
2+
toc-title: Table of contents
3+
---
14

25
![Pypi
36
version](https://img.shields.io/pypi/v/mkquartodocs?style=flat-square.png)
@@ -42,28 +45,32 @@ copying outpus.
4245
This will render code chunks and save the outputs! Check out
4346
https://quarto.org/ for more examples on how to use the format.
4447

45-
This .
48+
This ....
4649

4750
```` markdown
4851

4952
```{python}
50-
print(1+1)
53+
print(1+2)
5154
```
5255
````
5356

54-
Will become this
57+
Will become this ...
5558

56-
``` python
57-
print(1+1)
59+
:::: {.cell execution_count="1"}
60+
``` {.python .cell-code}
61+
print(1+2)
5862
```
5963

60-
2
64+
::: {.cell-output .cell-output-stdout}
65+
3
66+
:::
67+
::::
6168

6269
## Installation
6370

6471
1. Make sure you have quarto installed in your computer.
6572

66-
- https://quarto.org/docs/get-started/
73+
- https://quarto.org/docs/get-started/
6774

6875
2. Install `mkquartodocs`
6976

@@ -85,11 +92,11 @@ plugins:
8592
8693
Available configuration options:
8794
88-
- **quarto_path**: Specifies where to look for the quarto executable.
89-
- **keep_output**: If true it will skip the cleanup step in the
90-
directory.
91-
- **ignore**: a python regular expressions that if matched will mark the
92-
file to not be rendered. Note that they need to be full matches
95+
- **quarto_path**: Specifies where to look for the quarto executable.
96+
- **keep_output**: If true it will skip the cleanup step in the
97+
directory.
98+
- **ignore**: a python regular expressions that if matched will mark
99+
the file to not be rendered. Note that they need to be full matches
93100
94101
``` yaml
95102
# Whatever is in your mkdocs.yml configuration file....
@@ -113,7 +120,10 @@ files, render them, generate the output and clean after itself.
113120

114121
The things that need to/could be added to the project:
115122

116-
- [ ] quarto project support
117-
- [ ] render in temporary directory, posibly with a ‘safe’ argument
118-
- [ ] addition of files not in the docs directory, ‘include’ argument
119-
- [ ] add readme to testing data
123+
- [ ] quarto project support
124+
- [ ] render in temporary directory, posibly with a 'safe' argument
125+
- [ ] addition of files not in the docs directory, 'include' argument
126+
- [ ] add readme to testing data
127+
- [ ] move
128+
`INFO - mkquartodocs: Running RemoveCellDataPreprocessor` to
129+
debug log

docs/README.qmd

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ This ....
3737
````
3838
3939
```{{python}}
40-
print(1+1)
40+
print(1+2)
4141
```
4242
4343
````
4444

4545
Will become this ...
4646

4747
```{python}
48-
print(1+1)
48+
print(1+2)
4949
```
5050

5151
## Installation

mkquartodocs/extension.py

+11-7
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

1616
class AdmotionCellDataPreprocessor(Preprocessor):
1717
CELL_REGEX: Final = re.compile(r"^::: \{\.cell .*}\s*$")
18-
CELL_END: Final = re.compile(r"^:::$")
18+
CELL_END: Final = re.compile(r"^:{3,4}?$")
1919
CELL_ELEM_REGEX: Final = re.compile(
20-
r"^::: \{(.cell-\w+) (\.cell-[\w-]+)( execution_count=\"\d+\")?\}$"
20+
r"^:{3,4} \{(\.cell(-\w+)?)\s?(\.cell-[\w-]+)?( execution_count=\"\d+\")?\}"
2121
)
2222
CODEBLOCK_REGEX: Final = re.compile(r"^```{\.(\w+) .*}")
2323

@@ -34,7 +34,6 @@ def run(self, lines):
3434
outs = [self._process_line(x) for x in lines]
3535
log.debug(f"Removing {sum(1 for x in outs if x is None)} lines")
3636
out = [x for x in outs if x is not None]
37-
3837
return out
3938

4039
def _process_line(self, line):
@@ -47,12 +46,17 @@ def _process_line(self, line):
4746
out = "\n\n"
4847

4948
elif sr := self.CELL_ELEM_REGEX.search(line):
50-
log.debug(f"Matched Cell element: {line}")
51-
output_type = sr.groups()[1]
52-
out = self.TYPE_MAPPING[output_type]
49+
groups = {i: x for i, x in enumerate(sr.groups())}
50+
log.debug(f"Matched Cell element: {line}, groups: {groups}")
51+
if groups[3]:
52+
out = "\n\n"
53+
else:
54+
output_type = groups[2]
55+
out = self.TYPE_MAPPING[output_type]
5356

5457
elif sr := self.CODEBLOCK_REGEX.search(line):
55-
log.debug(f"Matched codeblock: {line}")
58+
groups = {i: x for i, x in enumerate(sr.groups())}
59+
log.debug(f"Matched codeblock: {line} -> {groups}")
5660
lang = sr.groups(1)
5761
out = f"```{lang}"
5862
else:

mkquartodocs/plugin.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,12 @@ def on_pre_build(self, config):
8585
[quarto, "render", str(x), "--to=markdown"], check=True
8686
)
8787
break
88-
except subprocess.CalledProcessError:
88+
except subprocess.CalledProcessError as e:
8989
# ERROR: Couldn't find open server
9090
# it ocasionally fails with that error ...
9191
if i == 4:
92+
log.error(f"Quarto failed to render {x} after 5 tries")
93+
log.error(f"Quarto failed with error: {e}")
9294
raise
9395
warnings.warn(f"Quarto failed to render {x}, retrying")
9496
else:

0 commit comments

Comments
 (0)