diff --git a/README.md b/README.md index 30f6fb7..51497d1 100644 --- a/README.md +++ b/README.md @@ -98,28 +98,26 @@ in memory — playback never writes to disk. Requires [`uv`](https://docs.astral.sh/uv/). Everything else is handled by `uv`. +Run `aloud` directly from GitHub without installing it: + ```sh -git clone https://github.com/wasim/aloud.git ~/aloud -cd ~/aloud +uvx --from git+https://github.com/wasim/aloud aloud https://example.com/article +``` -# Create the environment and install dependencies (reproducible). -uv python install 3.13 -uv venv --python 3.13 -uv sync +Or install the `aloud` command permanently: -# Put the `aloud` command on your PATH. -mkdir -p ~/.local/bin -cat > ~/.local/bin/aloud <<'EOF' -#!/bin/sh -exec "$HOME/aloud/.venv/bin/python" "$HOME/aloud/aloud.py" "$@" -EOF -chmod +x ~/.local/bin/aloud +```sh +uv tool install git+https://github.com/wasim/aloud +aloud https://example.com/article ``` -Make sure `~/.local/bin` is on your `PATH`. If not, add to `~/.zshrc`: +To work from a clone instead, create the environment and command with: ```sh -export PATH="$HOME/.local/bin:$PATH" +git clone https://github.com/wasim/aloud.git ~/aloud +cd ~/aloud +uv sync +uv run aloud https://example.com/article ``` The whole environment is reproducible from `pyproject.toml` + `uv.lock` with a @@ -221,7 +219,7 @@ pkill -f aloud.py # force-kill, if ever needed - `aloud.py` — the whole tool (one readable script) - `pyproject.toml` / `uv.lock` — reproducible environment -- `~/.local/bin/aloud` — the command wrapper on your PATH +- `~/.local/bin/aloud` — the command installed by `uv tool install` --- diff --git a/aloud.py b/aloud.py index ce500a1..def8edb 100644 --- a/aloud.py +++ b/aloud.py @@ -900,7 +900,8 @@ def main(): est_sec).run() -if __name__ == "__main__": +def cli(): + """Run the command-line interface.""" # Default SIGINT -> KeyboardInterrupt is what we rely on; keep it explicit. signal.signal(signal.SIGINT, signal.default_int_handler) try: @@ -908,3 +909,7 @@ def main(): except KeyboardInterrupt: print("\nStopping…") sys.exit(130) + + +if __name__ == "__main__": + cli() diff --git a/pyproject.toml b/pyproject.toml index 3fd65bf..23557b5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,8 +19,15 @@ dependencies = [ "pypdf", ] -[tool.uv] -package = false +[project.scripts] +aloud = "aloud:cli" + +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[tool.setuptools] +py-modules = ["aloud"] [tool.uv.sources] en-core-web-sm = { url = "https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.8.0/en_core_web_sm-3.8.0-py3-none-any.whl" } diff --git a/uv.lock b/uv.lock index 1cf0e95..68cbd75 100644 --- a/uv.lock +++ b/uv.lock @@ -14,7 +14,7 @@ wheels = [ [[package]] name = "aloud" version = "0.3.0" -source = { virtual = "." } +source = { editable = "." } dependencies = [ { name = "en-core-web-sm" }, { name = "espeakng-loader" },