Skip to content

Commit 22b1ae9

Browse files
committed
build: copier-auto-update
1 parent f53cb77 commit 22b1ae9

File tree

14 files changed

+114
-98
lines changed

14 files changed

+114
-98
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: 0.2.6
5+
_commit: 1.1.5
66
_src_path: gh:KyleKing/mdformat-plugin-template
77
author_email: [email protected]
88
author_name: Kyle King
@@ -13,4 +13,5 @@ plugin_name: obsidian
1313
repository_namespace: kyleking
1414
repository_provider: https://github.com
1515
repository_url: https://github.com/kyleking/mdformat-obsidian
16+
sync_admon_factories: false
1617

.github/workflows/tests.yml

Lines changed: 20 additions & 18 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,11 +17,12 @@ jobs:
1517
with:
1618
python-version: 3.12
1719
- uses: pre-commit/[email protected]
20+
1821
tests:
1922
runs-on: ${{ matrix.os }}
2023
strategy:
2124
matrix:
22-
python-version: [3.8, 3.12]
25+
python-version: [3.9, 3.12]
2326
os: [ubuntu-latest, windows-latest]
2427
steps:
2528
- uses: actions/checkout@v4
@@ -28,22 +31,22 @@ jobs:
2831
with:
2932
python-version: ${{ matrix.python-version }}
3033
- name: Installation (deps and package)
31-
# we install with flit --pth-file,
32-
# so that coverage will be recorded for the module
34+
# We install with flit --pth-file, so that coverage will be recorded for the module
35+
# Flit could be installed with pipx and use '--python=$(which python)', but
36+
# there were issues with the Windows Runner
3337
run: |
34-
pip install flit
38+
pip install flit~=3.10.1
3539
flit install --deps=production --extras=test --pth-file
3640
- name: Run pytest
3741
run: |
38-
pytest --cov=$(ls | grep "mdformat_" | head) --cov-report=xml --cov-report=term-missing
39-
# - name: Upload to Codecov
40-
# if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.12
41-
# 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
4247
# with:
43-
# name: pytests-py3.12
44-
# flags: pytests
45-
# file: ./coverage.xml
46-
# fail_ci_if_error: true
48+
# token: ${{ secrets.CODECOV_TOKEN }}
49+
4750
pre-commit-hook:
4851
runs-on: ubuntu-latest
4952
steps:
@@ -54,11 +57,12 @@ jobs:
5457
python-version: 3.12
5558
- name: Installation (deps and package)
5659
run: |
57-
pip install pre-commit
60+
pipx install pre-commit
5861
pip install .
5962
- name: run pre-commit with plugin
6063
run: |
6164
pre-commit run --config .pre-commit-test.yaml --all-files --verbose --show-diff-on-failure
65+
6266
publish:
6367
name: Publish to PyPi
6468
needs: [pre-commit, tests, pre-commit-hook]
@@ -70,13 +74,9 @@ jobs:
7074
steps:
7175
- name: Checkout source
7276
uses: actions/checkout@v4
73-
- name: Set up Python
74-
uses: actions/setup-python@v5
75-
with:
76-
python-version: 3.12
7777
- name: install flit
7878
run: |
79-
pip install flit~=3.0
79+
pipx install flit~=3.10.1
8080
- name: Build and publish
8181
run: |
8282
flit publish
@@ -85,3 +85,5 @@ jobs:
8585
FLIT_PASSWORD: ${{ secrets.PYPI_KEY }}
8686
- name: Generate GitHub Release Notes
8787
uses: softprops/action-gh-release@v2
88+
with:
89+
generate_release_notes: true

.pre-commit-config.yaml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
repos:
33
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v4.6.0
4+
rev: v5.0.0
55
hooks:
66
- id: check-added-large-files
77
- id: check-executables-have-shebangs
@@ -18,23 +18,15 @@ 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]
2624
- id: pretty-format-json
2725
args: [--autofix, --indent=4]
2826
- id: trailing-whitespace
29-
exclude: tests/.*fixtures.*\.md|__snapshots__/.*\.ambr
30-
- repo: https://github.com/astral-sh/ruff-pre-commit
31-
rev: v0.6.1
32-
hooks:
33-
- id: ruff
34-
args: [--fix]
35-
- id: ruff-format
27+
exclude: __snapshots__/.*\.ambr
3628
- repo: https://github.com/executablebooks/mdformat
37-
rev: 0.7.17
29+
rev: 0.7.18
3830
hooks:
3931
- id: mdformat
4032
additional_dependencies:

.pre-commit-test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
# A pre-commit hook for testing unreleased changes
3-
# Run from tox with: tox -e py38-hook
3+
# Run from tox with: tox -e py39-hook
44
repos:
55
- repo: local
66
hooks:

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
python 3.8.12 3.12.5
1+
python 3.9.13 3.12.5

CONTRIBUTING.md

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ To install these development dependencies:
1515

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

2021
To run the tests:
@@ -26,7 +27,7 @@ tox
2627
and with test coverage:
2728

2829
```bash
29-
tox -e py38-cov
30+
tox -e py39-cov
3031
```
3132

3233
The easiest way to write tests, is to edit `tests/fixtures.md`
@@ -40,14 +41,15 @@ tox -e py312-pre-commit
4041
or directly
4142

4243
```bash
43-
pip install pre-commit
44+
pipx install pre-commit
45+
# or: uv tool install pre-commit
4446
pre-commit run --all
4547
```
4648

4749
To run the pre-commit hook test:
4850

4951
```bash
50-
tox -e py38-hook
52+
tox -e py39-hook
5153
```
5254

5355
## `ptw` testing
@@ -68,20 +70,27 @@ Run the latest local code anywhere with pipx.
6870
pipx install . --include-deps --force --editable
6971
```
7072

73+
Or with uv:
74+
75+
```sh
76+
uv tool install mdformat --force --with-editable=.
77+
```
78+
7179
## Publish to PyPi
7280

73-
Either use flit directly:
81+
First, update the version in `mdformat_obsidian/__init__.py`
7482

75-
```bash
76-
pipx install flit
83+
Then, either use the Github Action by committing the new version in `__init__.py` and pushing an associated tag in format: `v#.#.#` (e.g. `v1.3.2` for `__version__ = '1.3.2'`)
84+
85+
Or run flit locally:
7786

87+
```bash
7888
# envchain --set FLIT FLIT_PASSWORD
7989
export FLIT_USERNAME=__token__
8090
export eval $(envchain FLIT env | grep FLIT_PASSWORD=)
8191

8292
flit publish
8393
```
8494

85-
or trigger the GitHub Action job, by creating a release with a tag equal to the version, e.g. `v0.0.1` and updating the version in `mdformat_obsidian/__init__.py`.
86-
87-
Note, this requires generating an API key on PyPi and adding it to the repository `Settings/Secrets`, under the name `PYPI_KEY`.
95+
> [!NOTE]
96+
> The Github Action requires generating an API key on PyPi and adding it to the repository `Settings/Secrets`, under the name `PYPI_KEY`

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 Executable Books
3+
Copyright (c) 2024 Kyle King
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Add this package wherever you use `mdformat` and the plugin will be auto-recogni
3434
```yaml
3535
repos:
3636
- repo: https://github.com/executablebooks/mdformat
37-
rev: 0.7.16
37+
rev: 0.7.18
3838
hooks:
3939
- id: mdformat
4040
additional_dependencies:

mdformat_obsidian/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
__version__ = "0.1.0"
44

5+
# FYI see source code for available interfaces:
6+
# https://github.com/executablebooks/mdformat/blob/5d9b573ce33bae219087984dd148894c774f41d4/src/mdformat/plugins.py
57
from .plugin import RENDERERS, update_mdit
68

7-
__all__ = ("RENDERERS", "__version__", "update_mdit")
9+
__all__ = ("RENDERERS", "update_mdit")

mdformat_obsidian/plugin.py

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

33
from __future__ import annotations
44

5-
from typing import Mapping
5+
from collections.abc import Mapping
66

77
from markdown_it import MarkdownIt
88
from mdformat.renderer import RenderContext, RenderTreeNode

0 commit comments

Comments
 (0)