Skip to content

Commit c5401a2

Browse files
authored
Introduce yamlfmt (#836)
1 parent 953e28e commit c5401a2

5 files changed

Lines changed: 111 additions & 101 deletions

File tree

.github/dependabot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ updates:
99
groups:
1010
python-packages:
1111
patterns:
12-
- "*"
12+
- '*'
1313
- package-ecosystem: github-actions
1414
directory: /
1515
schedule:
1616
interval: weekly
1717
groups:
1818
github-actions:
1919
patterns:
20-
- "*"
20+
- '*'

.github/workflows/ci.yml

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,22 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- uses: actions/checkout@v6
16+
- uses: actions/checkout@v6
1717

18-
- name: set up uv
19-
uses: astral-sh/setup-uv@v7
20-
with:
21-
python-version: '3.12'
18+
- name: set up uv
19+
uses: astral-sh/setup-uv@v7
20+
with:
21+
python-version: '3.12'
2222

23-
- name: Install dependencies
24-
# Installing pip is required for the pre-commit action:
25-
run: |
26-
uv sync --group linting --all-extras
27-
uv pip install pip
23+
- name: Install dependencies
24+
# Installing pip is required for the pre-commit action:
25+
run: |
26+
uv sync --group linting --all-extras
27+
uv pip install pip
2828
29-
- uses: pre-commit/action@v3.0.1
30-
with:
31-
extra_args: --all-files
29+
- uses: pre-commit/action@v3.0.1
30+
with:
31+
extra_args: --all-files
3232

3333
test:
3434
name: test py${{ matrix.python }} on ${{ matrix.os }}
@@ -46,40 +46,40 @@ jobs:
4646
runs-on: ${{ matrix.os }}
4747

4848
steps:
49-
- uses: actions/checkout@v6
49+
- uses: actions/checkout@v6
5050

51-
- name: set up uv
52-
uses: astral-sh/setup-uv@v7
53-
with:
54-
python-version: ${{ matrix.python }}
51+
- name: set up uv
52+
uses: astral-sh/setup-uv@v7
53+
with:
54+
python-version: ${{ matrix.python }}
5555

56-
- name: Install dependencies
57-
run: |
58-
uv sync --group testing --all-extras
56+
- name: Install dependencies
57+
run: |
58+
uv sync --group testing --all-extras
5959
60-
- run: mkdir coverage
60+
- run: mkdir coverage
6161

62-
- name: test
63-
run: make test
64-
env:
65-
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python }}
66-
CONTEXT: ${{ runner.os }}-py${{ matrix.python }}
62+
- name: test
63+
run: make test
64+
env:
65+
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python }}
66+
CONTEXT: ${{ runner.os }}-py${{ matrix.python }}
6767

68-
- name: uninstall deps
69-
run: uv pip uninstall PyYAML
68+
- name: uninstall deps
69+
run: uv pip uninstall PyYAML
7070

71-
- name: test without deps
72-
run: make test
73-
env:
74-
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python }}-without-deps
75-
CONTEXT: ${{ runner.os }}-py${{ matrix.python }}-without-deps
71+
- name: test without deps
72+
run: make test
73+
env:
74+
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python }}-without-deps
75+
CONTEXT: ${{ runner.os }}-py${{ matrix.python }}-without-deps
7676

77-
- name: store coverage files
78-
uses: actions/upload-artifact@v7
79-
with:
80-
name: coverage-${{ matrix.python }}-${{ runner.os }}
81-
path: coverage
82-
include-hidden-files: true
77+
- name: store coverage files
78+
uses: actions/upload-artifact@v7
79+
with:
80+
name: coverage-${{ matrix.python }}-${{ runner.os }}
81+
path: coverage
82+
include-hidden-files: true
8383

8484
coverage:
8585
runs-on: ubuntu-latest
@@ -125,7 +125,7 @@ jobs:
125125

126126
- run: uv run coverage report --fail-under 98
127127

128-
check: # This job does nothing and is only used for the branch protection
128+
check: # This job does nothing and is only used for the branch protection
129129
if: always()
130130
needs: [lint, test, coverage]
131131
runs-on: ubuntu-latest

.pre-commit-config.yaml

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
11
repos:
2-
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.3.0
4-
hooks:
5-
- id: check-yaml
6-
args: ['--unsafe']
7-
- id: check-toml
8-
- id: end-of-file-fixer
9-
- id: trailing-whitespace
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.3.0
4+
hooks:
5+
- id: check-yaml
6+
args: ['--unsafe']
7+
- id: check-toml
8+
- id: end-of-file-fixer
9+
- id: trailing-whitespace
1010

11-
- repo: local
12-
hooks:
13-
- id: lint
14-
name: Lint
15-
entry: make lint
16-
types: [python]
17-
language: system
18-
pass_filenames: false
19-
- id: mypy
20-
name: Mypy
21-
entry: make mypy
22-
types: [python]
23-
language: system
24-
pass_filenames: false
11+
- repo: https://github.com/google/yamlfmt
12+
rev: v0.21.0
13+
hooks:
14+
- id: yamlfmt
15+
16+
- repo: local
17+
hooks:
18+
- id: lint
19+
name: Lint
20+
entry: make lint
21+
types: [python]
22+
language: system
23+
pass_filenames: false
24+
- id: mypy
25+
name: Mypy
26+
entry: make mypy
27+
types: [python]
28+
language: system
29+
pass_filenames: false

.yamlfmt.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
formatter:
2+
type: basic
3+
retain_line_breaks_single: true
4+
scan_folded_as_literal: true
5+
force_quote_style: single

mkdocs.yml

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ theme:
77
name: 'material'
88
custom_dir: 'docs/theme'
99
palette:
10-
- media: "(prefers-color-scheme: light)"
11-
scheme: default
12-
primary: pink
13-
accent: pink
14-
toggle:
15-
icon: material/lightbulb-outline
16-
name: "Switch to dark mode"
17-
- media: "(prefers-color-scheme: dark)"
18-
scheme: slate
19-
primary: pink
20-
accent: pink
21-
toggle:
22-
icon: material/lightbulb
23-
name: "Switch to light mode"
10+
- media: '(prefers-color-scheme: light)'
11+
scheme: default
12+
primary: pink
13+
accent: pink
14+
toggle:
15+
icon: material/lightbulb-outline
16+
name: 'Switch to dark mode'
17+
- media: '(prefers-color-scheme: dark)'
18+
scheme: slate
19+
primary: pink
20+
accent: pink
21+
toggle:
22+
icon: material/lightbulb
23+
name: 'Switch to light mode'
2424
features:
2525
- content.tabs.link
2626
- content.code.annotate
@@ -34,35 +34,35 @@ repo_url: https://github.com/pydantic/pydantic
3434
edit_uri: edit/main/docs/
3535

3636
extra_css:
37-
- 'extra/terminal.css'
38-
- 'extra/tweaks.css'
37+
- 'extra/terminal.css'
38+
- 'extra/tweaks.css'
3939

4040
nav:
41-
- index.md
41+
- index.md
4242

4343
markdown_extensions:
44-
- tables
45-
- toc:
46-
permalink: true
47-
title: Page contents
48-
- admonition
49-
- pymdownx.highlight
50-
- pymdownx.extra
51-
- pymdownx.emoji:
52-
emoji_index: !!python/name:materialx.emoji.twemoji
53-
emoji_generator: !!python/name:materialx.emoji.to_svg
54-
- pymdownx.tabbed:
55-
alternate_style: true
44+
- tables
45+
- toc:
46+
permalink: true
47+
title: Page contents
48+
- admonition
49+
- pymdownx.highlight
50+
- pymdownx.extra
51+
- pymdownx.emoji:
52+
emoji_index: !!python/name:materialx.emoji.twemoji
53+
emoji_generator: !!python/name:materialx.emoji.to_svg
54+
- pymdownx.tabbed:
55+
alternate_style: true
5656

5757
extra:
5858
version:
5959
provider: mike
6060

6161
plugins:
62-
- mike:
63-
alias_type: symlink
64-
canonical_version: latest
65-
- search
66-
- exclude:
67-
glob:
68-
- __pycache__/*
62+
- mike:
63+
alias_type: symlink
64+
canonical_version: latest
65+
- search
66+
- exclude:
67+
glob:
68+
- __pycache__/*

0 commit comments

Comments
 (0)