Contributing¶
Contributions are welcome: bug fixes, features, documentation, and issue reports.
Development setup¶
Prerequisites: Python 3.10+ and Git.
git clone https://github.com/queelius/book-memex.git
cd book-memex
make setup # create a virtual environment and install ".[dev,all]"
# or manually:
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -e ".[dev]" # dev pulls in the mcp, server, and similarity extras
Running tests¶
pytest # full suite
pytest tests/test_server_marginalia.py -v # one file
make test-file FILE=tests/test_server_marginalia.py
pytest -k "marginalia or reading" -v # keyword filter
pytest -m "not slow" # skip slow tests
pytest --cov=book_memex --cov-report=term-missing # coverage
make test-coverage
Code quality¶
make lint # linters
make format # black + isort
make format-check # check formatting without changing files
Building the documentation¶
The site is built with MkDocs (Material theme). CI builds it in strict mode, so broken links or nav entries fail the build:
pip install "mkdocs>=1.6,<2" mkdocs-material "mkdocstrings[python]" pymdown-extensions
mkdocs build --clean --strict
mkdocs serve # live preview at http://127.0.0.1:8000
Add new pages under docs/ and list them in the nav section of mkdocs.yml.
docs/superpowers/ holds internal design specs and plans and is intentionally
not in the nav.
Making changes¶
- Create a branch:
git checkout -b feature/my-change. - Keep
cli.pyandserver.pythin; put logic inservices/. - New record tables get an
archived_at TIMESTAMP NULLcolumn and a migration indb/migrations.py(idempotent, bumpCURRENT_SCHEMA_VERSION). - Keep REST and MCP in parity: a new REST operation should have a matching MCP tool, and vice versa.
- Route user-supplied FTS5 queries through
book_memex.core.fts.safe_fts_query. - Add tests, and update
docs/for user-facing changes. - Open a pull request on GitHub.
Adding a CLI command¶
Add the function to the relevant Typer sub-app in book_memex/cli.py
(import_app, export_app, book_app, ...), give it help text and examples,
resolve the library path with the config fallback where the argument is
optional, and document it in docs/user-guide/cli.md.
Code style¶
- Type hints on public functions; Google-style docstrings.
snake_casefunctions and variables,PascalCaseclasses,UPPER_CASEconstants.- Line length 100.
Reporting issues¶
Include the book-memex version (pip show book-memex), Python version, OS, steps
to reproduce, expected vs. actual behavior, and any error output.
License¶
By contributing you agree that your contributions are licensed under the project's MIT License.