tanh-tooling 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.
@@ -0,0 +1,16 @@
1
+ # Python
2
+ python/dist/
3
+ python/build/
4
+ **/__pycache__/
5
+ *.egg-info/
6
+ .venv/
7
+
8
+ # Node
9
+ node_modules/
10
+ *.tsbuildinfo
11
+
12
+ # Claude Code personal/local overrides
13
+ .claude/settings.local.json
14
+
15
+ # OS
16
+ .DS_Store
@@ -0,0 +1,40 @@
1
+ Metadata-Version: 2.4
2
+ Name: tanh-tooling
3
+ Version: 0.1.0
4
+ Summary: tanh-lab shared Python developer configuration (ruff + pyright bases) and a sync CLI.
5
+ Author: Fares Schulz
6
+ Requires-Python: >=3.11
7
+ Requires-Dist: pyright>=1.1.400
8
+ Requires-Dist: ruff>=0.14
9
+ Description-Content-Type: text/markdown
10
+
11
+ # tanh-tooling (Python)
12
+
13
+ Shared tanh-lab Python developer configuration: a `ruff` base and a `pyright`
14
+ base, plus a `tanh-tooling sync` CLI that materialises them into a consuming repo.
15
+
16
+ ## Use it
17
+
18
+ ```sh
19
+ uv add tanh-tooling
20
+ uv run tanh-tooling sync # writes ruff_base.toml + pyright_base.json
21
+ ```
22
+
23
+ Then keep thin, hand-owned configs that extend the bases:
24
+
25
+ ```toml
26
+ # ruff.toml
27
+ extend = "ruff_base.toml"
28
+ ```
29
+
30
+ ```json
31
+ // pyrightconfig.json
32
+ { "extends": "pyright_base.json", "include": ["src"] }
33
+ ```
34
+
35
+ The synced `ruff_base.toml` / `pyright_base.json` are committed but **generated** —
36
+ treat them like a lockfile, never hand-edit. CI drift check:
37
+
38
+ ```sh
39
+ uv run tanh-tooling sync --check
40
+ ```
@@ -0,0 +1,30 @@
1
+ # tanh-tooling (Python)
2
+
3
+ Shared tanh-lab Python developer configuration: a `ruff` base and a `pyright`
4
+ base, plus a `tanh-tooling sync` CLI that materialises them into a consuming repo.
5
+
6
+ ## Use it
7
+
8
+ ```sh
9
+ uv add tanh-tooling
10
+ uv run tanh-tooling sync # writes ruff_base.toml + pyright_base.json
11
+ ```
12
+
13
+ Then keep thin, hand-owned configs that extend the bases:
14
+
15
+ ```toml
16
+ # ruff.toml
17
+ extend = "ruff_base.toml"
18
+ ```
19
+
20
+ ```json
21
+ // pyrightconfig.json
22
+ { "extends": "pyright_base.json", "include": ["src"] }
23
+ ```
24
+
25
+ The synced `ruff_base.toml` / `pyright_base.json` are committed but **generated** —
26
+ treat them like a lockfile, never hand-edit. CI drift check:
27
+
28
+ ```sh
29
+ uv run tanh-tooling sync --check
30
+ ```
@@ -0,0 +1,22 @@
1
+ [project]
2
+ name = "tanh-tooling"
3
+ version = "0.1.0"
4
+ description = "tanh-lab shared Python developer configuration (ruff + pyright bases) and a sync CLI."
5
+ readme = "README.md"
6
+ requires-python = ">=3.11"
7
+ dependencies = ["ruff>=0.14", "pyright>=1.1.400"] # co-pin the tools to the config
8
+
9
+ [[project.authors]]
10
+ name = "Fares Schulz"
11
+
12
+ [project.scripts]
13
+ tanh-tooling = "tanh_tooling._cli:main"
14
+
15
+ [build-system]
16
+ requires = ["hatchling"]
17
+ build-backend = "hatchling.build"
18
+
19
+ [tool.hatch.build.targets.wheel]
20
+ packages = ["src/tanh_tooling"]
21
+ # data/ lives inside the package dir, so ruff_base.toml / pyright_base.json
22
+ # ship with the wheel automatically — no extra include needed.
@@ -0,0 +1,3 @@
1
+ """tanh-lab shared Python developer configuration."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,47 @@
1
+ import argparse
2
+ import importlib.resources as res
3
+ import shutil
4
+ import sys
5
+ from pathlib import Path
6
+
7
+ from . import __version__
8
+
9
+ # package-relative source -> filename written into the consuming repo
10
+ FILES = {"ruff_base.toml": "ruff_base.toml", "pyright_base.json": "pyright_base.json"}
11
+
12
+
13
+ def _bundled(name: str) -> Path:
14
+ # wheels unpack into site-packages, so this resolves to a real path
15
+ return Path(str(res.files("tanh_tooling").joinpath("data", name)))
16
+
17
+
18
+ def main() -> int:
19
+ p = argparse.ArgumentParser(prog="tanh-tooling")
20
+ p.add_argument("--version", action="version", version=__version__)
21
+ sub = p.add_subparsers(dest="cmd", required=True)
22
+ s = sub.add_parser("sync", help="materialise Python base configs into this repo")
23
+ s.add_argument(
24
+ "--check",
25
+ action="store_true",
26
+ help="fail if a base config is missing or differs (CI)",
27
+ )
28
+ args = p.parse_args()
29
+
30
+ dest, drift = Path.cwd(), False
31
+ for src_name, out_name in FILES.items():
32
+ src, tgt = _bundled(src_name), dest / out_name
33
+ if args.check:
34
+ if not tgt.exists() or tgt.read_bytes() != src.read_bytes():
35
+ print(f"out of date: {out_name}")
36
+ drift = True
37
+ else:
38
+ shutil.copy(src, tgt)
39
+ print(f"wrote {out_name}")
40
+ if args.check and drift:
41
+ print("run `tanh-tooling sync` and commit the result", file=sys.stderr)
42
+ return 1
43
+ return 0
44
+
45
+
46
+ if __name__ == "__main__":
47
+ raise SystemExit(main())
@@ -0,0 +1,7 @@
1
+ {
2
+ // Reusable pyright policy (strictness + shared rule overrides).
3
+ // Other projects inherit via "extends": "<path>/pyright_base.json".
4
+ // Keep repo-specific paths (include/exclude/venv) in each project's pyrightconfig.json,
5
+ // since relative paths in a base file resolve against the base file's location.
6
+ "typeCheckingMode": "standard"
7
+ }
@@ -0,0 +1,12 @@
1
+ # Reusable Ruff base config (shared style + rule selection).
2
+ # Standalone ruff.toml format: keys are top-level, NOT under [tool.ruff].
3
+ # Other projects can inherit this via `extend = "<path>/ruff_base.toml"`.
4
+ # Named ruff_base.toml (not ruff.toml) on purpose: a bare ruff.toml would be
5
+ # auto-discovered and would override pyproject.toml's [tool.ruff] instead of merging.
6
+
7
+ line-length = 100
8
+ target-version = "py311"
9
+
10
+ [lint]
11
+ # E/F = pyflakes + pycodestyle, I = isort, UP = pyupgrade, B = bugbear.
12
+ select = ["E", "F", "I", "UP", "B"]