This guide is for contributors and advanced users who want to build CertMonitor from source, work on the codebase, or use the Rust-powered features in development.
All development tasks are managed through the comprehensive Makefile. To see all available commands:
make help-
Clone the repository:
git clone <repo-url> cd certmonitor
-
Install dev dependencies (includes maturin):
=== "uv"
sh uv sync --group dev=== "pip"
sh pip install -e .[dev] -
Install Rust toolchain:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # Or see https://www.rust-lang.org/tools/install
-
Build and install the Rust bindings:
make develop
CertMonitor provides a comprehensive Makefile with unified commands for both Python and Rust development. All commands are designed to work seamlessly together.
| Command | Description |
|---|---|
make develop |
Install package in development mode (Python + Rust) |
make build |
Build release artifacts |
make wheel |
Build Python wheel with Rust extension |
| Command | Description |
|---|---|
make test |
Run full CI-equivalent test suite (9 comprehensive checks) |
make test-quick |
Run tests only (fast, no quality checks) |
make ci |
Alias for make test |
| Command | Description |
|---|---|
make check |
Quick code quality checks (lint + format) |
make format |
Format both Python and Rust code |
make format-check |
Check formatting for both languages |
make lint |
Lint both Python and Rust code |
make typecheck |
Run mypy type checking |
make security |
Run security vulnerability check |
| Command | Description |
|---|---|
make python-format |
Format Python code only |
make python-lint |
Lint Python code only |
make rust-format |
Format Rust code only |
make rust-format-check |
Check Rust formatting |
make rust-lint |
Lint Rust code only |
| Command | Description |
|---|---|
make report |
Generate modularization and quality report |
| Command | Description |
|---|---|
make docs |
Serve documentation locally |
| Command | Description |
|---|---|
make clean |
Remove all build artifacts and cache |
make verify-wheel |
Verify contents of built wheel |
- Make your changes to Python or Rust code
- Format and lint your code:
make format lint
- Run quick quality checks:
make check
- Run tests if needed:
make test-quick # Fast tests only # OR make test # Full CI-equivalent suite
Before committing or creating a PR, run the full test suite:
make testThis runs 9 comprehensive checks:
- Python code formatting check
- Python linting check
- Rust code formatting check
- Rust linting check
- Pytest with coverage (95%+ required)
- Python type checking (mypy)
- Security vulnerability check (cargo audit)
- Build verification
- Modularization report generation
When you modify Rust code in rust_certinfo/, you need to rebuild:
make develop # Rebuilds and installs Rust extensionFor Rust-specific tasks:
make rust-format # Format Rust code
make rust-lint # Lint Rust code with clippyThe project maintains high code quality standards:
- Python: Uses
rufffor formatting and linting - Rust: Uses
cargo fmtfor formatting andclippyfor linting - Type Safety: 100% mypy compliance required
- Test Coverage: 95%+ coverage required
- Documentation: All public APIs must be documented
The unified format and lint commands provide several advantages:
- Single Interface: Run
make formatto format all code regardless of language - Consistent Experience: Same commands work for Python and Rust
- CI Alignment: Local
make testmatches exactly what CI runs - Time Saving: No need to remember separate commands for each language
make test-quickmake testThe full test suite provides detailed progress reporting and matches exactly what runs in CI.
make docsThis starts a local development server for the documentation.
Parsing X.509 certificates and extracting cryptographic key information is performance-critical and security-sensitive. Python's standard library does not provide low-level, robust, or fast parsing for all certificate fields, especially for public key extraction and ASN.1 parsing. Rust, with its strong safety guarantees and excellent cryptography ecosystem, is ideal for this task.
- Performance: Rust code is compiled and runs much faster than pure Python for binary parsing.
- Safety: Rust's memory safety model helps prevent many classes of bugs and vulnerabilities.
- Ecosystem: The Rust
x509-parsercrate is mature and reliable for certificate parsing.
The Rust extension is built as a Python module using PyO3 and maturin, and is automatically installed as part of the development workflow.
- Rust compilation errors: Ensure you have the latest Rust toolchain installed
- Import errors: Run
make developto rebuild the Rust extension - Test failures: Run
make format lintto fix code quality issues - Type errors: Run
make typecheckto see mypy errors
- Run
make helpto see all available commands - Check the CI logs if tests pass locally but fail in CI
- Review the
pyproject.tomlfor dependency information
For more details, see the Makefile commands above and pyproject.toml for up-to-date dependencies.