Metadata-Version: 2.4
Name: phrase-gym
Version: 0.2.0
Summary: A small local trainer for bringing useful phrases into speech.
Project-URL: Homepage, https://andgineer.github.io/phrase-gym/
Project-URL: Documentation, https://andgineer.github.io/phrase-gym/
Project-URL: Repository, https://github.com/andgineer/phrase-gym
Author-email: Andrey Sorokin <andrey@sorokin.engineer>
License: Copyright (c) 2026 Andrey Sorokin (andrey@sorokin.engineer)
        
        Permission is hereby granted, free of charge, to any person obtaining a copy of
        this software and associated documentation files (the “Software”), to deal in
        the Software without restriction, including without limitation the rights to use,
        copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
        Software, and to permit persons to whom the Software is furnished to do so,
        subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
        EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
        OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
        NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
        HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
        WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
        FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
        OTHER DEALINGS IN THE SOFTWARE.
License-File: LICENSE
Keywords: language-learning,phrases,spoken-retrieval
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: <3.14,>=3.13
Requires-Dist: fastapi==0.119.1
Requires-Dist: platformdirs==4.5.0
Requires-Dist: pydantic==2.12.3
Requires-Dist: uvicorn==0.38.0
Provides-Extra: coach
Provides-Extra: deploy
Description-Content-Type: text/markdown

# Phrase Gym

[![CI](https://github.com/andgineer/phrase-gym/workflows/CI/badge.svg)](https://github.com/andgineer/phrase-gym/actions)
[![Coverage](https://raw.githubusercontent.com/andgineer/phrase-gym/python-coverage-comment-action-data/badge.svg)](https://htmlpreview.github.io/?https://github.com/andgineer/phrase-gym/blob/python-coverage-comment-action-data/htmlcov/index.html)

Phrase Gym is a small local Python/Vue application for studying useful English phrases and
keeping private learner recordings. This checkpoint supports package import, ungraded first
study, reference playback, optional recording, comparison, and saved replay. Later recall and
scheduling remain the next stage.

## Install and launch

The server runs on macOS and Linux. Use a macOS browser for the MVP media player and recording;
Linux browser audio support is planned after the MVP.

For a source checkout, use Python 3.13, [uv](https://docs.astral.sh/uv/), Node 22.12+ and a
configured English Piper voice for Coach synthesis. Install the pinned environments and build the client once:

```bash
uv sync --frozen
npm --prefix frontend ci
npm --prefix frontend run build
```

Start Phrase Gym without any Piper installation:

```bash
uv run phrase-gym run
```

For private iPhone access on your existing tailnet, use `uv run inv run --build --tailscale`. This points Tailscale Serve at the new server
and allows its exact HTTPS machine hostname. Open the HTTPS URL printed by Tailscale on the
iPhone with Tailscale connected.

The built wheel contains the Vue client. A lean installed package runs `phrase-gym run`.
Coach runs separately: set `PHRASE_GYM_PIPER_CONFIG` to the private voice file in
[the import guide](docs/importing-phrases.md#piper-voice), then run
`uv run phrase-gym coach` in another terminal. The private Piper environment belongs to Coach;
the server needs only core dependencies. Service registration and deployment commands remain
unavailable.

Open <http://127.0.0.1:8000> on the Mac. The app listens only on loopback and stores its database,
references, and recordings in the operating system's Phrase Gym application-data directory.
For a separate data directory, add `--data-dir /absolute/path`.

## Add and study material

Open **Add material**, paste a package or choose its UTF-8 JSON file, and select **Import**.
The app saves the request before acknowledging it. A text-only package stays pending while Coach
is offline; Coach prepares reference audio and returns it through the API. An external agent can
submit the same package with complete WAV references in one API request, without Coach. The server
validates and publishes all cards and references together. A preparation error remains visible
for explicit retry. Exact package
retries return the existing result; a changed package ID or repeated source/item identity is
rejected without overwriting learned material.

Study shows the full phrase and meaning/use help. Reference playback and recording are optional.
Every stopped take is retained separately and saved automatically; pending uploads remain in the
browser for retry. **Next** records ungraded study completion. The finish screen deliberately does
not invent a recall grade or schedule before the later-recall stage exists.

See [the package schema, example, and external-agent instruction](docs/importing-phrases.md).

## Development

```bash
. ./activate.sh
uv run pre-commit install
inv --list
uv run inv pre
uv run inv test
```

`inv test` runs Python tests, client typechecking/unit/build checks, and silent real-backend
browser tests in Chromium and WebKit on macOS. CI runs the full gate on macOS and separately
runs all Python server tests on Linux. For server-only iteration, use `uv run pytest`.
Install browser binaries from `frontend/` with
`npx playwright install chromium webkit`. If migrating from the temporary custom hook, run
`git config --unset core.hooksPath` before `pre-commit install`.

The scaffold's `inv pre`, `inv reqs`, `inv docs-en`, `inv build-docs`, `inv version`, and
`inv ver-bug` / `inv ver-feature` / `inv ver-release` commands are available.
`uv run inv build` builds the client and Python distributions. A version command checks and commits the
version update, then pushes its release tag; the tag workflow publishes to PyPI only after CI passes.
See [development and release operations](docs/development.md) for setup and dry-run commands.

Use `uv run inv run --build` to rebuild the frontend and start the server, or `uv run inv run`
to start it with the existing client build.

[Documentation](https://andgineer.github.io/phrase-gym/),
[Allure reports](https://andgineer.github.io/phrase-gym/builds/tests/),
[Codecov](https://app.codecov.io/gh/andgineer/phrase-gym), and
[Coveralls](https://coveralls.io/github/andgineer/phrase-gym) retain the scaffold's reporting links.

Created using [cookiecutter-python-package](https://github.com/andgineer/cookiecutter-python-package).

Current decisions and remaining work start at [specs/START-HERE.md](specs/START-HERE.md).
