diff --git a/README.md b/README.md index f79f713..bf96812 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ The project wraps the [md2txt](https://github.com/randogoth/md2txt/) toolchain, ### Installation -Install the CLI directly from GitHub with [uv](https://github.com/astral-sh/uv): +Install the CLI directly from GitHub with [uv](https://github.com/astral-sh/uv): ``` uv tool install --from github:randogoth/mambler mambler @@ -23,7 +23,7 @@ uv tool install --from github:randogoth/mambler mambler ### Usage ```bash -uv run mambler.py --title "Your Book Title" --codepage 437 path/to/index.md output.amb +mambler --title "Your Book Title" --codepage 437 path/to/index.md output.amb ``` - `index.md` is the root Markdown file. Any local Markdown links it contains will be followed and bundled automatically. @@ -35,7 +35,7 @@ uv run mambler.py --title "Your Book Title" --codepage 437 path/to/index.md outp ### Development Notes -- Run `uv run python -m compileall mambler.py` to ensure the script still compiles. +- Run `uv run python -m compileall src/mambler` to ensure the package still compiles. - The `md2txt` dependency is fetched from GitHub; contribute renderer/parser changes upstream in that project. --- diff --git a/pyproject.toml b/pyproject.toml index 4e3ed50..2272522 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,7 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + [project] name = "mambler" version = "0.1.0" @@ -7,6 +11,17 @@ requires-python = ">=3.13" dependencies = [ "md2txt", ] +license = { file = "LICENSE" } +authors = [{ name = "Tobias Raayoni Last" }] + +[project.scripts] +mambler = "mambler:main" [tool.uv.sources] md2txt = { git = "https://github.com/randogoth/md2txt", rev = "master" } + +[tool.hatch.build.targets.wheel] +packages = ["src/mambler"] + +[tool.hatch.build.targets.sdist] +include = ["src/mambler", "README.md", "LICENSE"] diff --git a/mambler.py b/src/mambler/__init__.py similarity index 99% rename from mambler.py rename to src/mambler/__init__.py index cbc4323..c2c2425 100644 --- a/mambler.py +++ b/src/mambler/__init__.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python3 +"""Core package for converting Markdown to Ancient Machine Book archives.""" + from __future__ import annotations import argparse diff --git a/src/mambler/__main__.py b/src/mambler/__main__.py new file mode 100644 index 0000000..fdd5a30 --- /dev/null +++ b/src/mambler/__main__.py @@ -0,0 +1,10 @@ +from . import main + + +def run() -> int: + """Entry point for `python -m mambler`.""" + return main() + + +if __name__ == "__main__": + raise SystemExit(run())