sanitism 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sanitism-0.1.0/.gitignore +12 -0
- sanitism-0.1.0/PKG-INFO +56 -0
- sanitism-0.1.0/PYPI.md +33 -0
- sanitism-0.1.0/pyproject.toml +53 -0
- sanitism-0.1.0/src/sanitism/__init__.py +3 -0
- sanitism-0.1.0/src/sanitism/__main__.py +5 -0
- sanitism-0.1.0/src/sanitism/cli.py +197 -0
- sanitism-0.1.0/src/sanitism/overlay/AGENTS.md.tmpl +41 -0
- sanitism-0.1.0/src/sanitism/overlay/Makefile.tmpl +53 -0
- sanitism-0.1.0/src/sanitism/overlay/README.md.tmpl +97 -0
- sanitism-0.1.0/src/sanitism/overlay/gitignore.tmpl +12 -0
- sanitism-0.1.0/src/sanitism/overlay/pages.yml.tmpl +73 -0
- sanitism-0.1.0/src/sanitism/overlay/pyproject.toml.tmpl +31 -0
- sanitism-0.1.0/src/sanitism/overlay/shared/README.md.tmpl +26 -0
- sanitism-0.1.0/src/sanitism/overlay/shared/manifest.yaml.tmpl +35 -0
- sanitism-0.1.0/src/sanitism/overlay/shared/tables/example.csv +3 -0
- sanitism-0.1.0/src/sanitism/project.py +468 -0
- sanitism-0.1.0/tests/test_init.py +223 -0
sanitism-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: sanitism
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: One repository for a paper, its talks and what they share: `uvx sanitism init` sets up document-sanity and presentation-sanity side by side, with a shared manifest both import from.
|
|
5
|
+
Project-URL: Homepage, https://sanitism.dev
|
|
6
|
+
Project-URL: Repository, https://github.com/yakaboskic/sanitism
|
|
7
|
+
Project-URL: Issues, https://github.com/yakaboskic/sanitism/issues
|
|
8
|
+
Author: Chase Yakaboski
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
Keywords: document-sanity,manuscripts,presentation-sanity,provenance,sanitism,slides
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Requires-Dist: document-sanity<0.4,>=0.3.0
|
|
20
|
+
Requires-Dist: presentation-sanity<0.6,>=0.5.0
|
|
21
|
+
Requires-Dist: pyyaml>=6.0
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# sanitism
|
|
25
|
+
|
|
26
|
+
One repository for a piece of work and everything written about it: the
|
|
27
|
+
paper, the talks, the blog posts, and the numbers, figures and tables they
|
|
28
|
+
share.
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
uvx sanitism init my-project
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
my-project/
|
|
36
|
+
├── docs/ papers and proposals (document-sanity)
|
|
37
|
+
├── present/ slide decks and blog posts (presentation-sanity)
|
|
38
|
+
├── shared/ manifest.yaml, figures/, tables/: what both sides quote
|
|
39
|
+
├── pyproject.toml one environment and one lock for the whole repo
|
|
40
|
+
└── Makefile check, site, and shortcuts into each side
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
A number declared once in `shared/manifest.yaml` is `{{cohort_size}}` in the
|
|
44
|
+
paper and `<DataValue var="cohort_size" />` in the deck, with the same
|
|
45
|
+
provenance behind both. Change it there and every output follows.
|
|
46
|
+
|
|
47
|
+
- [sanitism.dev](https://sanitism.dev)
|
|
48
|
+
- [document-sanity](https://github.com/yakaboskic/document-sanity): Markdown and one manifest to PDF, HTML and Word
|
|
49
|
+
- [presentation-sanity](https://github.com/yakaboskic/presentation-sanity): one manifest to Slidev decks and VitePress posts
|
|
50
|
+
- [How imports work](https://github.com/yakaboskic/document-sanity/blob/main/docs/imports.md)
|
|
51
|
+
|
|
52
|
+
`uvx sanitism@latest update` brings an existing project up to the newest
|
|
53
|
+
releases of both tools: the version pins, the one lock, the agent skills.
|
|
54
|
+
|
|
55
|
+
`sanitism pages init` writes one GitHub Pages workflow that publishes both
|
|
56
|
+
sides (a Pages site is public, even from a private repository).
|
sanitism-0.1.0/PYPI.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# sanitism
|
|
2
|
+
|
|
3
|
+
One repository for a piece of work and everything written about it: the
|
|
4
|
+
paper, the talks, the blog posts, and the numbers, figures and tables they
|
|
5
|
+
share.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
uvx sanitism init my-project
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
my-project/
|
|
13
|
+
├── docs/ papers and proposals (document-sanity)
|
|
14
|
+
├── present/ slide decks and blog posts (presentation-sanity)
|
|
15
|
+
├── shared/ manifest.yaml, figures/, tables/: what both sides quote
|
|
16
|
+
├── pyproject.toml one environment and one lock for the whole repo
|
|
17
|
+
└── Makefile check, site, and shortcuts into each side
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
A number declared once in `shared/manifest.yaml` is `{{cohort_size}}` in the
|
|
21
|
+
paper and `<DataValue var="cohort_size" />` in the deck, with the same
|
|
22
|
+
provenance behind both. Change it there and every output follows.
|
|
23
|
+
|
|
24
|
+
- [sanitism.dev](https://sanitism.dev)
|
|
25
|
+
- [document-sanity](https://github.com/yakaboskic/document-sanity): Markdown and one manifest to PDF, HTML and Word
|
|
26
|
+
- [presentation-sanity](https://github.com/yakaboskic/presentation-sanity): one manifest to Slidev decks and VitePress posts
|
|
27
|
+
- [How imports work](https://github.com/yakaboskic/document-sanity/blob/main/docs/imports.md)
|
|
28
|
+
|
|
29
|
+
`uvx sanitism@latest update` brings an existing project up to the newest
|
|
30
|
+
releases of both tools: the version pins, the one lock, the agent skills.
|
|
31
|
+
|
|
32
|
+
`sanitism pages init` writes one GitHub Pages workflow that publishes both
|
|
33
|
+
sides (a Pages site is public, even from a private repository).
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "sanitism"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "One repository for a paper, its talks and what they share: `uvx sanitism init` sets up document-sanity and presentation-sanity side by side, with a shared manifest both import from."
|
|
5
|
+
readme = "PYPI.md"
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
authors = [{ name = "Chase Yakaboski" }]
|
|
9
|
+
keywords = ["sanitism", "document-sanity", "presentation-sanity", "manuscripts", "slides", "provenance"]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Development Status :: 4 - Beta",
|
|
12
|
+
"Environment :: Console",
|
|
13
|
+
"Intended Audience :: Science/Research",
|
|
14
|
+
"Operating System :: OS Independent",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
17
|
+
"Topic :: Scientific/Engineering",
|
|
18
|
+
]
|
|
19
|
+
# `init` runs each tool's own `init`, so the project it makes carries the
|
|
20
|
+
# template and the version pin of the tools installed next to this package.
|
|
21
|
+
# Both need the releases that read `imports:` (document-sanity 0.3,
|
|
22
|
+
# presentation-sanity 0.5).
|
|
23
|
+
dependencies = [
|
|
24
|
+
"document-sanity>=0.3.0,<0.4",
|
|
25
|
+
"presentation-sanity>=0.5.0,<0.6",
|
|
26
|
+
"pyyaml>=6.0",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Homepage = "https://sanitism.dev"
|
|
31
|
+
Repository = "https://github.com/yakaboskic/sanitism"
|
|
32
|
+
Issues = "https://github.com/yakaboskic/sanitism/issues"
|
|
33
|
+
|
|
34
|
+
[project.scripts]
|
|
35
|
+
sanitism = "sanitism.cli:main"
|
|
36
|
+
|
|
37
|
+
[dependency-groups]
|
|
38
|
+
dev = ["pytest>=8"]
|
|
39
|
+
|
|
40
|
+
[build-system]
|
|
41
|
+
requires = ["hatchling>=1.27"]
|
|
42
|
+
build-backend = "hatchling.build"
|
|
43
|
+
|
|
44
|
+
# The repo also holds the landing page (site/, figures/, media/); only the
|
|
45
|
+
# package and its tests go into a release.
|
|
46
|
+
[tool.hatch.build.targets.sdist]
|
|
47
|
+
include = ["/PYPI.md", "/src", "/tests"]
|
|
48
|
+
|
|
49
|
+
[tool.hatch.build.targets.wheel]
|
|
50
|
+
packages = ["src/sanitism"]
|
|
51
|
+
|
|
52
|
+
[tool.pytest.ini_options]
|
|
53
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"""`sanitism`: set up one repository for a paper, its talks and what they share."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
import sys
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
from . import __version__
|
|
10
|
+
from . import project as pj
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _ask(prompt: str, default: str | None) -> str | None:
|
|
14
|
+
shown = f" [{default}]" if default else ""
|
|
15
|
+
try:
|
|
16
|
+
answer = input(f" {prompt}{shown}: ").strip()
|
|
17
|
+
except EOFError:
|
|
18
|
+
answer = ""
|
|
19
|
+
return answer or default
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def cmd_init(args: argparse.Namespace) -> int:
|
|
23
|
+
dest = Path(args.dir).resolve()
|
|
24
|
+
interactive = not args.yes and sys.stdin.isatty()
|
|
25
|
+
slug = args.name or pj.slugify(dest.name)
|
|
26
|
+
title = args.title or (
|
|
27
|
+
_ask("Title", slug.replace("-", " ").title()) if interactive
|
|
28
|
+
else slug.replace("-", " ").title()
|
|
29
|
+
)
|
|
30
|
+
author = args.author or pj.git_config("user.name")
|
|
31
|
+
email = args.email or pj.git_config("user.email")
|
|
32
|
+
if interactive:
|
|
33
|
+
author = args.author or _ask("Author", author)
|
|
34
|
+
email = args.email or _ask("Email", email)
|
|
35
|
+
answers = pj.Answers(slug, title or slug, author, email, args.description)
|
|
36
|
+
|
|
37
|
+
starters = [s for group in (args.starter or []) for s in group.split(",") if s]
|
|
38
|
+
try:
|
|
39
|
+
result = pj.create_project(
|
|
40
|
+
dest, answers,
|
|
41
|
+
starters=starters or None, first=args.first,
|
|
42
|
+
skills=not args.no_skills, force=args.force, git=args.git,
|
|
43
|
+
)
|
|
44
|
+
except pj.InitError as e:
|
|
45
|
+
print(f" error: {e}", file=sys.stderr)
|
|
46
|
+
return 1
|
|
47
|
+
|
|
48
|
+
here = Path.cwd().resolve()
|
|
49
|
+
shown = dest.relative_to(here) if dest.is_relative_to(here) else dest
|
|
50
|
+
tools = ", ".join(f"{name} {version}" for name, version in result.tools.items())
|
|
51
|
+
print(f" → {shown} ({answers.slug}, {tools})")
|
|
52
|
+
print(f" docs/ {', '.join('src/' + d + '/' for d in result.documents)}")
|
|
53
|
+
print(f" present/ {', '.join('presentations/' + p + '/' for p in result.presentations)}")
|
|
54
|
+
print(" shared/ manifest.yaml, imported by every manifest above")
|
|
55
|
+
if result.git:
|
|
56
|
+
print(f" git: {result.git}")
|
|
57
|
+
first_doc = "manuscript" if "manuscript" in result.documents else result.documents[0]
|
|
58
|
+
first_talk = result.presentations[0] if result.presentations else "kickoff"
|
|
59
|
+
print("\n next:")
|
|
60
|
+
if dest != here:
|
|
61
|
+
print(f" cd {shown}")
|
|
62
|
+
print(" make install # uv sync (one .venv), npm install in present/")
|
|
63
|
+
print(" # manim needs ffmpeg, cairo, pango, LaTeX;")
|
|
64
|
+
print(" # `uv sync --no-default-groups` skips it")
|
|
65
|
+
print(f" make docs-html VERSION={first_doc} # → docs/out/{first_doc}/html/index.html")
|
|
66
|
+
print(f" make dev TARGET={first_talk}:slides # the deck, with live reload")
|
|
67
|
+
print(" make check # both sides, before you share")
|
|
68
|
+
return 0
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def cmd_pages_init(args: argparse.Namespace) -> int:
|
|
72
|
+
root = pj.find_root(Path(args.root))
|
|
73
|
+
if root is None:
|
|
74
|
+
print(
|
|
75
|
+
f" error: no sanitism project at or above {Path(args.root).resolve()} "
|
|
76
|
+
f"(a folder with {pj.DOCS}/, {pj.PRESENT}/ and a Makefile)",
|
|
77
|
+
file=sys.stderr,
|
|
78
|
+
)
|
|
79
|
+
return 1
|
|
80
|
+
try:
|
|
81
|
+
path, notes = pj.pages_init(
|
|
82
|
+
root, branch=args.branch, pdf=not args.no_pdf, force=args.force
|
|
83
|
+
)
|
|
84
|
+
except pj.InitError as e:
|
|
85
|
+
print(f" error: {e}", file=sys.stderr)
|
|
86
|
+
return 1
|
|
87
|
+
print(f" → {path.relative_to(root)}")
|
|
88
|
+
print(" A Pages site is PUBLIC, even when the repository is private: every")
|
|
89
|
+
print(" document under docs/ and every presentation under present/ is published.")
|
|
90
|
+
print(" One-time setup: Settings → Pages → Build and deployment → Source: GitHub Actions.")
|
|
91
|
+
for note in notes:
|
|
92
|
+
print(f" note: {note}")
|
|
93
|
+
return 0
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def cmd_update(args: argparse.Namespace) -> int:
|
|
97
|
+
root = pj.find_root(Path(args.root))
|
|
98
|
+
if root is None:
|
|
99
|
+
print(
|
|
100
|
+
f" error: no sanitism project at or above {Path(args.root).resolve()} "
|
|
101
|
+
f"(a folder with {pj.DOCS}/, {pj.PRESENT}/ and a Makefile)",
|
|
102
|
+
file=sys.stderr,
|
|
103
|
+
)
|
|
104
|
+
return 1
|
|
105
|
+
if args.dry_run:
|
|
106
|
+
print(" (dry run: nothing is written)")
|
|
107
|
+
return pj.update_project(
|
|
108
|
+
root, shared=args.shared, lock=not args.no_lock, dry_run=args.dry_run
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
113
|
+
parser = argparse.ArgumentParser(
|
|
114
|
+
prog="sanitism",
|
|
115
|
+
description="One repository for a paper, its talks and what they share.",
|
|
116
|
+
)
|
|
117
|
+
parser.add_argument("--version", action="version", version=f"%(prog)s {__version__}")
|
|
118
|
+
sub = parser.add_subparsers(dest="command")
|
|
119
|
+
|
|
120
|
+
p_init = sub.add_parser(
|
|
121
|
+
"init",
|
|
122
|
+
help="Set up DIR with docs/ (document-sanity), present/ (presentation-sanity) and shared/",
|
|
123
|
+
description=(
|
|
124
|
+
"Run each tool's own `init` into DIR/docs and DIR/present, then add what "
|
|
125
|
+
"makes them one repository: shared/manifest.yaml (imported by every starter "
|
|
126
|
+
"manifest), a uv workspace so there is one environment, a Makefile, README, "
|
|
127
|
+
"AGENTS.md and both agent skills. Existing files are never overwritten "
|
|
128
|
+
"without --force."
|
|
129
|
+
),
|
|
130
|
+
)
|
|
131
|
+
p_init.add_argument("dir", nargs="?", default=".", metavar="DIR", help="Default: the current folder")
|
|
132
|
+
p_init.add_argument("--name", help="Project name (kebab-case; default: DIR's name)")
|
|
133
|
+
p_init.add_argument("--title", help="Title of the work (documents and the presentation project)")
|
|
134
|
+
p_init.add_argument("--author", help="Author name (default: git config user.name)")
|
|
135
|
+
p_init.add_argument("--email", help="Author email (default: git config user.email)")
|
|
136
|
+
p_init.add_argument("--description", help="One-line description")
|
|
137
|
+
p_init.add_argument("--starter", action="append", metavar="NAME",
|
|
138
|
+
help="Starter documents to keep in docs/: manuscript, proposal, or both "
|
|
139
|
+
"(default: both; repeat or comma-separate)")
|
|
140
|
+
p_init.add_argument("--first", metavar="FOLDER",
|
|
141
|
+
help="First presentation's folder under present/presentations/ (default: kickoff)")
|
|
142
|
+
p_init.add_argument("-y", "--yes", action="store_true", help="Don't prompt; use defaults")
|
|
143
|
+
p_init.add_argument("--git", action="store_true", help="git init and make a first commit")
|
|
144
|
+
p_init.add_argument("--force", action="store_true", help="Overwrite files that already exist")
|
|
145
|
+
p_init.add_argument("--no-skills", action="store_true", help="Don't install the agent skills")
|
|
146
|
+
p_init.set_defaults(func=cmd_init)
|
|
147
|
+
|
|
148
|
+
p_update = sub.add_parser(
|
|
149
|
+
"update",
|
|
150
|
+
help="Bring docs/ and present/ up to the current releases of both tools",
|
|
151
|
+
description=(
|
|
152
|
+
"Run `document-sanity update` in docs/ and `presentation-sanity update` in "
|
|
153
|
+
"present/, with the tools installed next to this package: each moves its "
|
|
154
|
+
"version pin, refreshes its agent skill at the repository root, and "
|
|
155
|
+
"present/ gets the files its shared/ Vue layer lacks. Then re-resolve "
|
|
156
|
+
"the one uv.lock. Run the newest release to update to it: "
|
|
157
|
+
"`uvx sanitism@latest update`."
|
|
158
|
+
),
|
|
159
|
+
)
|
|
160
|
+
p_update.add_argument("--root", "-r", default=".", help="Where to start (the root is found by walking up)")
|
|
161
|
+
p_update.add_argument("--shared", action="store_true",
|
|
162
|
+
help="Also take the template's version of present/shared/ files that differ")
|
|
163
|
+
p_update.add_argument("--no-lock", action="store_true", help="Don't run `uv lock`")
|
|
164
|
+
p_update.add_argument("--dry-run", action="store_true", help="Say what would change; write nothing")
|
|
165
|
+
p_update.set_defaults(func=cmd_update)
|
|
166
|
+
|
|
167
|
+
p_pages = sub.add_parser("pages", help="Publish on GitHub Pages")
|
|
168
|
+
pages_sub = p_pages.add_subparsers(dest="pages_command")
|
|
169
|
+
p_pages_init = pages_sub.add_parser(
|
|
170
|
+
"init",
|
|
171
|
+
help="Write the one workflow that builds docs/ and present/ into a single site",
|
|
172
|
+
description=(
|
|
173
|
+
"Write .github/workflows/pages.yml at the repository root. It runs "
|
|
174
|
+
"`make site` and deploys site/: docs/ under /docs/, present/ under "
|
|
175
|
+
"/present/. A Pages site is public, even from a private repository."
|
|
176
|
+
),
|
|
177
|
+
)
|
|
178
|
+
p_pages_init.add_argument("--root", "-r", default=".", help="Where to start (the root is found by walking up)")
|
|
179
|
+
p_pages_init.add_argument("--branch", default="main", help="Branch that deploys (default: main)")
|
|
180
|
+
p_pages_init.add_argument("--no-pdf", action="store_true", help="Publish HTML and Word only (no TeX on the runner)")
|
|
181
|
+
p_pages_init.add_argument("--force", action="store_true", help="Replace an existing workflow")
|
|
182
|
+
p_pages_init.set_defaults(func=cmd_pages_init)
|
|
183
|
+
p_pages.set_defaults(func=lambda args: (p_pages.print_help(), 0)[1])
|
|
184
|
+
return parser
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
def main(argv: list[str] | None = None) -> int:
|
|
188
|
+
parser = build_parser()
|
|
189
|
+
args = parser.parse_args(argv)
|
|
190
|
+
if not getattr(args, "func", None):
|
|
191
|
+
parser.print_help()
|
|
192
|
+
return 0
|
|
193
|
+
return args.func(args)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
if __name__ == "__main__":
|
|
197
|
+
sys.exit(main())
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
This repository holds one piece of work and everything written about it.
|
|
4
|
+
|
|
5
|
+
| Folder | What it is | Tool, and its project root |
|
|
6
|
+
|---|---|---|
|
|
7
|
+
| `docs/` | papers and proposals: `src/<doc>/manifest.yaml` + Markdown → PDF, HTML, Word | document-sanity; its ROOT is `docs/` |
|
|
8
|
+
| `present/` | talks and posts: `manifest.yaml` + `presentations/<id>/` → Slidev decks, VitePress blogs | presentation-sanity; its ROOT is `present/` |
|
|
9
|
+
| `shared/` | `manifest.yaml`, `figures/`, `tables/`: what both sides quote | imported by the manifests on both sides |
|
|
10
|
+
|
|
11
|
+
How to work on each side is in that tool's agent skill, installed at this
|
|
12
|
+
root: `.claude/skills/document-sanity/` and
|
|
13
|
+
`.claude/skills/presentation-sanity/` (also under `.agents/skills/`). Start
|
|
14
|
+
with the skill's `SKILL.md`. Both skills look for their project root by
|
|
15
|
+
walking up from the current folder; **here it is the subfolder above, not this
|
|
16
|
+
root**, and `init` is never the answer in this repository.
|
|
17
|
+
|
|
18
|
+
## Rules for this repository
|
|
19
|
+
|
|
20
|
+
- **The repository root is not a project of either tool.** Run
|
|
21
|
+
`uv run document-sanity … --root docs` and
|
|
22
|
+
`uv run presentation-sanity … --root present` (or `cd` into the folder).
|
|
23
|
+
Never create `manifest.yaml`, `presentations/` or `src/` at the root.
|
|
24
|
+
- **Anything quoted on both sides lives in `shared/manifest.yaml`** and is
|
|
25
|
+
imported. Before adding a variable, figure or table to a document or to
|
|
26
|
+
`present/manifest.yaml`, look there, and in the other side's manifest. If it
|
|
27
|
+
exists, use it; if the other side now needs something that is defined
|
|
28
|
+
locally, move the definition to `shared/` and delete the local one. A name
|
|
29
|
+
defined in both places is a build error by design. Never retype a number.
|
|
30
|
+
- **Never invent provenance.** `source`, `data`, `command` and `updated` say
|
|
31
|
+
where a value came from. Leave them out rather than guess.
|
|
32
|
+
- **One environment.** Python packages go in the root `pyproject.toml`
|
|
33
|
+
(`uv add` at the root); `uv sync` at the root installs both tools.
|
|
34
|
+
- **`make check` before you say done.** It runs both tools' checks.
|
|
35
|
+
- Each folder's own `AGENTS.md` or `README.md` has that side's ground rules;
|
|
36
|
+
they apply inside it.
|
|
37
|
+
|
|
38
|
+
## This project
|
|
39
|
+
|
|
40
|
+
<!-- What this work is, who the audience is, target venues, deadlines,
|
|
41
|
+
conventions the documents and talks should follow. -->
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
.PHONY: help install check dev site clean
|
|
2
|
+
|
|
3
|
+
# Where the site will be served from: empty at a domain root, "/<repo>" for a
|
|
4
|
+
# GitHub project site. The Pages workflow passes it.
|
|
5
|
+
BASE ?=
|
|
6
|
+
# Extra flags for each side of `make site`, e.g. DOCS_FLAGS=--no-pdf on a
|
|
7
|
+
# machine without TeX.
|
|
8
|
+
DOCS_FLAGS ?=
|
|
9
|
+
PRESENT_FLAGS ?=
|
|
10
|
+
UV_RUN ?= uv run
|
|
11
|
+
|
|
12
|
+
help:
|
|
13
|
+
@echo "Targets:"
|
|
14
|
+
@echo " install One environment for the repo (uv sync) and present/'s Node packages"
|
|
15
|
+
@echo " check Every document and every presentation: do all references resolve?"
|
|
16
|
+
@echo " docs-<x> A target of docs/Makefile, from here: make docs-pdf VERSION=manuscript"
|
|
17
|
+
@echo " dev A deck or post with live reload: make dev TARGET=kickoff:slides"
|
|
18
|
+
@echo " site docs/ and present/ built into site/ (what Pages publishes)"
|
|
19
|
+
@echo " clean Remove the built site/ folders"
|
|
20
|
+
@echo ""
|
|
21
|
+
@echo "Each side also works on its own: cd docs (document-sanity), cd present"
|
|
22
|
+
@echo "(presentation-sanity). What they share is declared in shared/manifest.yaml."
|
|
23
|
+
|
|
24
|
+
install:
|
|
25
|
+
uv sync
|
|
26
|
+
cd present && npm install
|
|
27
|
+
|
|
28
|
+
check:
|
|
29
|
+
$(UV_RUN) document-sanity check --root docs
|
|
30
|
+
$(UV_RUN) presentation-sanity check --root present
|
|
31
|
+
|
|
32
|
+
# Everything in docs/Makefile, without leaving the root:
|
|
33
|
+
# make docs-html VERSION=manuscript make docs-word make docs-preview
|
|
34
|
+
docs-%:
|
|
35
|
+
$(MAKE) -C docs $*
|
|
36
|
+
|
|
37
|
+
dev:
|
|
38
|
+
$(UV_RUN) presentation-sanity dev --root present $(TARGET)
|
|
39
|
+
|
|
40
|
+
# docs/ → site/docs/, present/ → site/present/, and an index linking both.
|
|
41
|
+
# A blog needs to know its final URL, hence BASE.
|
|
42
|
+
site:
|
|
43
|
+
$(UV_RUN) document-sanity site --root docs $(DOCS_FLAGS)
|
|
44
|
+
$(UV_RUN) presentation-sanity build --root present $(PRESENT_FLAGS) --base "$(BASE)/present/"
|
|
45
|
+
rm -rf site
|
|
46
|
+
mkdir -p site
|
|
47
|
+
cp -R docs/site site/docs
|
|
48
|
+
cp -R present/site site/present
|
|
49
|
+
@printf '%s\n' '@@INDEX_HTML@@' > site/index.html
|
|
50
|
+
@echo " → site/index.html"
|
|
51
|
+
|
|
52
|
+
clean:
|
|
53
|
+
rm -rf site docs/site present/site
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# @@TITLE@@
|
|
2
|
+
|
|
3
|
+
@@DESCRIPTION@@
|
|
4
|
+
|
|
5
|
+
One repository for the work and everything written about it, set up by
|
|
6
|
+
[sanitism](https://sanitism.dev).
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
@@SLUG@@/
|
|
10
|
+
├── docs/ papers and proposals: Markdown + one manifest per document
|
|
11
|
+
│ → PDF, HTML and Word (document-sanity)
|
|
12
|
+
├── present/ talks and posts: one manifest, many presentations
|
|
13
|
+
│ → Slidev decks and VitePress blogs (presentation-sanity)
|
|
14
|
+
├── shared/ manifest.yaml, figures/, tables/: what both sides quote
|
|
15
|
+
├── pyproject.toml one environment and one uv.lock for the whole repo
|
|
16
|
+
└── Makefile install, check, site, and shortcuts into each side
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Start
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
make install # uv sync, and npm install in present/
|
|
23
|
+
make docs-html VERSION=@@FIRST_DOC@@ # → docs/out/@@FIRST_DOC@@/html/index.html
|
|
24
|
+
make dev TARGET=@@FIRST_PRESENTATION@@:slides # the deck, with live reload
|
|
25
|
+
make check # before you share anything
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`uv sync` needs manim's system libraries (ffmpeg, cairo, pango, LaTeX) for
|
|
29
|
+
`present/scenes/`; `uv sync --no-default-groups` skips manim. Commit the
|
|
30
|
+
`uv.lock` the first sync writes.
|
|
31
|
+
|
|
32
|
+
Each side is a complete project of its tool, so its own README and commands
|
|
33
|
+
apply inside it: `cd docs` and `uv run document-sanity …`, or `cd present` and
|
|
34
|
+
`uv run presentation-sanity …`. From the root, pass `--root docs` or
|
|
35
|
+
`--root present`.
|
|
36
|
+
|
|
37
|
+
## One number, everywhere
|
|
38
|
+
|
|
39
|
+
Anything the paper and a talk both quote is declared once in
|
|
40
|
+
[`shared/manifest.yaml`](shared/manifest.yaml):
|
|
41
|
+
|
|
42
|
+
```yaml
|
|
43
|
+
variables:
|
|
44
|
+
cohort_size:
|
|
45
|
+
value: 12453
|
|
46
|
+
format: ","
|
|
47
|
+
description: "Participants after QC filtering"
|
|
48
|
+
source: "data/results.csv"
|
|
49
|
+
command: "python scripts/qc.py data/raw/ --out data/results.csv"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
| | In `docs/` | In `present/` |
|
|
53
|
+
|---|---|---|
|
|
54
|
+
| a variable | `{{cohort_size}}` | `<DataValue var="cohort_size" />` |
|
|
55
|
+
| a figure in `shared/figures/<id>/` | `{{fig:id}}` | `<FigureImage figure="id" />` |
|
|
56
|
+
| a table in `shared/tables/` | `{{tab:id}}` | `<DataTable table="id" />` |
|
|
57
|
+
|
|
58
|
+
Change the value there and the PDF, the Word file, the HTML viewer, the deck
|
|
59
|
+
and the post all follow on the next build, each showing the same provenance.
|
|
60
|
+
The manifests under `docs/src/` and `present/manifest.yaml` already import
|
|
61
|
+
everything `shared/` declares; a manifest can import from another document or
|
|
62
|
+
from the presentation project the same way. See [shared/README.md](shared/README.md).
|
|
63
|
+
|
|
64
|
+
## Python packages
|
|
65
|
+
|
|
66
|
+
The root `pyproject.toml` is a uv workspace over `docs/` and `present/`, so
|
|
67
|
+
there is one `.venv` and one `uv.lock`. Add what your analysis needs with
|
|
68
|
+
`uv add <package>` at the root; scripts for the paper and for the talks then
|
|
69
|
+
import the same versions.
|
|
70
|
+
|
|
71
|
+
## Publish
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
make site # docs/ and present/ → site/
|
|
75
|
+
uvx sanitism pages init # one GitHub Pages workflow for both
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
A Pages site is **public**, even from a private repository.
|
|
79
|
+
|
|
80
|
+
## Upgrading the tools
|
|
81
|
+
|
|
82
|
+
`docs/pyproject.toml` pins document-sanity and `present/pyproject.toml` pins
|
|
83
|
+
presentation-sanity, each to a release tag. One command moves both to the
|
|
84
|
+
newest releases, re-resolves the one `uv.lock`, refreshes both agent skills
|
|
85
|
+
and adds what `present/shared/` lacks:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
uvx sanitism@latest update
|
|
89
|
+
uv sync
|
|
90
|
+
make check
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
`--dry-run` says what would change. One side at a time works too:
|
|
94
|
+
`uvx document-sanity@latest update` inside `docs/`,
|
|
95
|
+
`uvx presentation-sanity@latest update` inside `present/`. Each tool's
|
|
96
|
+
[release notes](https://github.com/yakaboskic/sanitism#the-tools) say what a
|
|
97
|
+
release changed.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Build docs/ and present/ into one site and deploy it to GitHub Pages.
|
|
2
|
+
# Written by `sanitism pages init` (v@@VERSION@@); rerun it with --force to
|
|
3
|
+
# regenerate.
|
|
4
|
+
#
|
|
5
|
+
# A Pages site is PUBLIC, even when this repository is private. Everything
|
|
6
|
+
# `make site` builds is published: every document under docs/ (its HTML
|
|
7
|
+
# viewer with numbers and provenance, its PDF and its Word file) and every
|
|
8
|
+
# presentation under present/. `document-sanity site` refuses a document whose
|
|
9
|
+
# manifest sets metadata.notice (CUI, distribution statements).
|
|
10
|
+
#
|
|
11
|
+
# One-time setup: Settings → Pages → Build and deployment → Source: GitHub Actions.
|
|
12
|
+
#
|
|
13
|
+
# The runner does not render manim or export Excalidraw figures: it deploys
|
|
14
|
+
# the videos and figures committed in present/public/. Render locally, commit,
|
|
15
|
+
# push.@@TEX_NOTE@@
|
|
16
|
+
name: Deploy to GitHub Pages
|
|
17
|
+
|
|
18
|
+
on:
|
|
19
|
+
push:
|
|
20
|
+
branches: [@@BRANCH@@]
|
|
21
|
+
workflow_dispatch:
|
|
22
|
+
|
|
23
|
+
permissions:
|
|
24
|
+
contents: read
|
|
25
|
+
pages: write
|
|
26
|
+
id-token: write
|
|
27
|
+
|
|
28
|
+
concurrency:
|
|
29
|
+
group: pages
|
|
30
|
+
cancel-in-progress: false
|
|
31
|
+
|
|
32
|
+
jobs:
|
|
33
|
+
build:
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
steps:
|
|
36
|
+
- uses: actions/checkout@v7
|
|
37
|
+
- id: pages
|
|
38
|
+
uses: actions/configure-pages@v6
|
|
39
|
+
- uses: astral-sh/setup-uv@v10.3.0
|
|
40
|
+
with:
|
|
41
|
+
enable-cache: true
|
|
42
|
+
- uses: actions/setup-node@v7
|
|
43
|
+
with:
|
|
44
|
+
node-version: 24
|
|
45
|
+
cache: npm
|
|
46
|
+
cache-dependency-path: present/package-lock.json
|
|
47
|
+
@@TEX_STEP@@ - name: Install document-sanity and presentation-sanity (no manim)
|
|
48
|
+
run: uv sync --locked --no-default-groups
|
|
49
|
+
- name: Install Slidev and VitePress
|
|
50
|
+
working-directory: present
|
|
51
|
+
run: npm ci
|
|
52
|
+
- name: Build site/
|
|
53
|
+
# base_path is "/<repo>" for a project site, "" for a custom domain or
|
|
54
|
+
# a <user>.github.io repository. Blogs need it absolute.
|
|
55
|
+
run: >-
|
|
56
|
+
make site
|
|
57
|
+
UV_RUN="uv run --no-sync"
|
|
58
|
+
BASE="${{ steps.pages.outputs.base_path }}"
|
|
59
|
+
DOCS_FLAGS="@@DOCS_FLAGS@@"
|
|
60
|
+
PRESENT_FLAGS="--skip-manim --skip-figures"
|
|
61
|
+
- uses: actions/upload-pages-artifact@v5
|
|
62
|
+
with:
|
|
63
|
+
path: site
|
|
64
|
+
|
|
65
|
+
deploy:
|
|
66
|
+
needs: build
|
|
67
|
+
runs-on: ubuntu-latest
|
|
68
|
+
environment:
|
|
69
|
+
name: github-pages
|
|
70
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
71
|
+
steps:
|
|
72
|
+
- id: deployment
|
|
73
|
+
uses: actions/deploy-pages@v5
|