Skip to content

Commit 17821dc

Browse files
committed
build: copier-auto-update
1 parent 8f72c9d commit 17821dc

File tree

12 files changed

+47
-68
lines changed

12 files changed

+47
-68
lines changed

.copier-answers.yml

Lines changed: 1 addition & 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/calcipy_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.10.7
5+
_commit: 2.0.3
66
_src_path: gh:KyleKing/calcipy_template
77
author_email: [email protected]
88
author_name: Kyle King

.github/workflows/ci_pipeline.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ name: CI Pipeline
1212
- poetry.lock
1313
- pyproject.toml
1414

15-
env:
16-
COLUMNS: 120
17-
PYTEST_ADDOPTS: "--snapshot-warn-unused"
18-
1915
jobs:
2016
lint:
2117
runs-on: ${{ matrix.os }}

.github/workflows/update_docs.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ jobs:
2929
with:
3030
os: ${{ matrix.os }}
3131
python-version: ${{ matrix.python-version }}
32-
- name: Setup Graphviz
33-
uses: ts-graphviz/setup-graphviz@v2
3432

3533
# https://github.com/mkdocs/mkdocs/discussions/2369#discussioncomment-625475
3634
- name: Configure git user

.pre-commit-config.yaml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ repos:
5050
hooks:
5151
- id: mdformat
5252
additional_dependencies:
53-
- "mdformat-mkdocs[recommended]>=2.1.0"
53+
- "mdformat-mkdocs[recommended]>=3.0.0"
5454
- "mdformat-gfm-alerts>=1.0.1"
5555
args: [--wrap=no]
5656
exclude: _.+\.md|CHANGELOG\.md|CODE_TAG_SUMMARY\.md
@@ -72,18 +72,11 @@ repos:
7272
exclude: \.copier-answers\.yml|tests/.*/cassettes/.*\.yaml|__snapshots__/.*\.json
7373
types_or: [html, javascript, json, shell, yaml]
7474
stages: ["pre-commit"]
75-
- repo: https://github.com/adrienverge/yamllint.git
76-
rev: v1.35.1
77-
hooks:
78-
- id: yamllint
79-
exclude: tests/.*/cassettes/.*\.yaml
80-
stages: ["pre-commit"]
8175
- repo: https://github.com/pappasam/toml-sort
8276
rev: v0.23.1
8377
hooks:
8478
- id: toml-sort-fix
85-
# Don't remove comments and sort order from test files
86-
exclude: poetry\.lock|config_default.toml|demo_config.toml
79+
exclude: poetry\.lock
8780
stages: ["pre-commit"]
8881
- repo: https://github.com/KyleKing/calcipy
8982
rev: 4.0.0

.tool-versions

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

.yamllint.yaml

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

docs/docs/Advanced_Documentation.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/gen_ref_nav.py

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,56 @@
1-
"""Generate the code reference pages and navigation.
1+
"""Generate the code reference pages.
22
3-
Copied from:
4-
https://github.com/pawamoy/copier-pdm/blob/79135565c4c7f756204a5f460e87129649f8b704/project/docs/gen_ref_nav.py
3+
Adapted without navigation from:
4+
https://github.com/pawamoy/copier-pdm/blob/adff9b64887d0b4c9ec0b42de1698b34858a511e/project/scripts/gen_ref_nav.py
55
66
"""
77

88
from pathlib import Path
99

1010
import mkdocs_gen_files
11+
from corallium.tomllib import tomllib
1112

12-
nav = mkdocs_gen_files.Nav()
1313

14-
for path in sorted(Path('tail_jsonl').rglob('*.py')):
14+
def has_public_code(line: str) -> bool:
15+
"""Determine if a given line contains code that will be documented.
16+
17+
Returns:
18+
bool: True if line appears to be a public function, class, or method
19+
20+
"""
21+
for key in ('def', 'async def', 'class'):
22+
starts = line.startswith(f'{key} ')
23+
if starts and not line.startswith(f'{key} _'):
24+
return True
25+
if starts:
26+
break
27+
return False
28+
29+
30+
_config = tomllib.loads(Path('pyproject.toml').read_text(encoding='utf-8'))
31+
_pkg_name = _config['tool']['poetry']['name']
32+
src = Path(_pkg_name)
33+
for path in sorted(src.rglob('*.py')):
34+
for line in path.read_text().split('\n'):
35+
if has_public_code(line):
36+
break
37+
else:
38+
continue # Do not include the file in generated documentation
39+
1540
module_path = path.with_suffix('')
1641
doc_path = path.with_suffix('.md')
1742
full_doc_path = Path('reference', doc_path)
1843

1944
parts = tuple(module_path.parts)
20-
2145
if parts[-1] == '__init__':
2246
parts = parts[:-1]
2347
doc_path = doc_path.with_name('index.md')
2448
full_doc_path = full_doc_path.with_name('index.md')
25-
elif parts[-1] == '__main__':
49+
elif parts[-1].startswith('_'):
2650
continue
2751

28-
nav[parts] = doc_path.as_posix()
29-
3052
with mkdocs_gen_files.open(full_doc_path, 'w') as fd:
3153
ident = '.'.join(parts)
3254
fd.write(f'::: {ident}')
3355

3456
mkdocs_gen_files.set_edit_path(full_doc_path, path)
35-
36-
# FYI, to add pages manually, use: `nav["package", "module"] = "path/to/file.md"`
37-
38-
with mkdocs_gen_files.open('reference/SUMMARY.md', 'w') as nav_file:
39-
nav_file.writelines(nav.build_literate_nav())

mkdocs.yml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,9 @@ watch:
2323
- tail_jsonl
2424

2525
plugins:
26-
- build_plantuml:
27-
render: server # or "local"
28-
bin_path: /usr/local/bin/plantuml # ignored when render: server
29-
server: http://www.plantuml.com/plantuml # official plantuml server
30-
output_format: svg
31-
diagram_root: docs/diagrams
32-
output_folder: out
33-
input_folder: src
34-
input_extensions: puml
3526
- gen-files:
3627
scripts:
3728
- docs/gen_ref_nav.py
38-
- git-revision-date-localized:
39-
enable_creation_date: true
40-
fallback_to_build_date: true
41-
strict: false
42-
type: date
43-
- literate-nav:
44-
nav_file: SUMMARY.md
4529
- mkdocstrings:
4630
handlers:
4731
python:
@@ -51,7 +35,6 @@ plugins:
5135
separate_signature: true
5236
show_category_heading: true
5337
- search
54-
- section-index
5538

5639
markdown_extensions:
5740
- abbr

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ classifiers = [
3939
] # https://pypi.org/classifiers/
4040
description = "Pretty Print Tailed JSONL Logs"
4141
documentation = "https://tail-jsonl.kyleking.me"
42-
include = ["LICENSE"]
4342
keywords = ["calcipy_template"]
4443
license = "MIT"
4544
maintainers = []
@@ -140,13 +139,17 @@ known-first-party = ['tail_jsonl']
140139
'ANN001', # Missing type annotation for function argument
141140
'ANN201', # Missing return type annotation for public function
142141
'ANN202', # Missing return type annotation for private function `test_make_diffable`
142+
'ARG001', # Unused function argument: `line`
143143
'D100', # Missing docstring in public module
144144
'D103', # Missing docstring in public function
145145
'PLC2701', # Private name import `_<>` from external module
146146
'PT004', # flake8-pytest-style: fixture does not return
147147
'S101', # Use of `assert` detected
148148
]
149149

150+
[tool.ruff.lint.pydocstyle]
151+
convention = "google"
152+
150153
[tool.tomlsort]
151154
all = true
152155
in_place = true

0 commit comments

Comments
 (0)