Development Guide
This guide covers development workflows: testing, building, linting, and Docker.
For installation prerequisites and setup, see the README.
Table of Contents
- Running Tests
- Building the Project
- Code Style and Linting
- Type Checking
- Docker Development
- Documentation
Running Tests
Tests are managed and run using pytest.
-
Run all tests:
This command discovers and executes all tests in the
tests/directory, generates code coverage reports (HTML, LCOV, XML) in thehtmlcov/directory, and Allure test results inallure-results/. You can view the Allure report by runningmake allure.
Building the Project
To build the project and create distributable packages (e.g., .whl and source distribution), use the make build command:
This command, as configured by pyproject.toml (using hatchling.build as the build backend), will generate the distributable files in the dist/ directory.
Code Style and Linting
Maintaining consistent code style and quality is essential. We use Ruff for both formatting and linting.
-
Run Code Style & Linting Checks:
This command will format your code and check for linting issues. For more granular control, you can use the
uvx ruffcommands directly as follows:-
Format code (apply changes):
-
Check formatting (without applying changes):
-
Lint code (check for errors and style issues):
-
Lint code and apply auto-fixes (for safe fixes):
-
Lint code and apply more aggressive auto-fixes (including potentially unsafe ones):
-
Type Checking
This project uses ty for static type checking, a modern and fast type checker from the Astral team (same as Ruff).
-
Run type checks:
This command will run
tyagainst the codebase.
Docker Development
The project provides Makefile commands for Docker-related tasks.
-
Build Docker Image:
Builds the application's Docker image.
-
Start Application with Docker Compose:
Starts the application using Docker Compose.
-
Stop Application with Docker Compose:
Stops the application started with Docker Compose.
-
Clean Project:
Removes build artifacts and stops Docker containers.
Documentation
The project uses MkDocs with the Material theme for documentation.
-
Install documentation dependencies:
-
Preview documentation locally:
Then open
http://localhost:8000in your browser. -
Build static documentation:
This generates the static site in the
site/directory.
Deployment
Documentation is automatically deployed to GitHub Pages when changes are pushed to main:
- Trigger conditions: Changes to
docs/,mkdocs.yml, or.github/workflows/docs.yml - Live site: https://pplmx.github.io/llm
By following this guide, you'll be well on your way to contributing to llm. Thank you for your efforts in maintaining and improving this project!