Thank you for your interest in contributing to mixpanel_headless!
Note: This package is in pre-release. We welcome contributions, but APIs may change between versions as we work toward a stable 1.0 release. Install with
pip install mixpanel-headless.
# Clone the repository
git clone https://github.com/mixpanel/mixpanel-headless.git
cd mixpanel-headless
# Install dependencies
uv sync --all-extras
# Verify setup
just checkThis project uses just as a command runner. Run just to see all available commands.
| Command | Description |
|---|---|
just |
List all available commands |
just check |
Run all checks (lint, typecheck, test) |
just test |
Run tests (supports args: just test -k foo) |
just test-cov |
Run tests with coverage |
just lint |
Lint code with ruff |
just lint-fix |
Auto-fix lint errors |
just fmt |
Format code with ruff |
just typecheck |
Type check with mypy |
just sync |
Sync dependencies |
just clean |
Remove caches and build artifacts |
just build |
Build package |
just mp |
Run the CLI (supports args: just mp --help) |
# Run all tests
just test
# Run specific tests
just test -k test_workspace
# Run with coverage
just test-covBefore submitting a PR, run all checks:
just checkThis runs:
ruff check— Lintingmypy --strict— Type checkingpytest— Tests
src/mixpanel_headless/
├── __init__.py # Public API exports
├── workspace.py # Workspace facade class
├── auth.py # Public auth module
├── exceptions.py # Exception hierarchy
├── types.py # Result types
├── _internal/ # Private implementation
│ ├── config.py # ConfigManager, Credentials
│ ├── api_client.py # MixpanelAPIClient
│ └── services/ # Service layer
│ ├── discovery.py # DiscoveryService
│ └── live_query.py # LiveQueryService
└── cli/
├── main.py # Typer app entry point
├── utils.py # Error handling, console
├── formatters.py # Output formatters
├── validators.py # Input validation
└── commands/ # Command implementations
├── auth.py
├── query.py
├── inspect.py
├── schemas.py
└── lexicon.py
tests/
├── conftest.py # Shared pytest fixtures
├── unit/ # Unit tests
└── integration/ # Integration tests
CLI Layer (Typer) → Argument parsing, output formatting
↓
Public API Layer → Workspace class, auth module
↓
Service Layer → DiscoveryService, LiveQueryService
↓
Infrastructure Layer → ConfigManager, MixpanelAPIClient
Two data paths:
- Live queries: Call Mixpanel API directly (segmentation, funnels, retention)
- Streaming: Stream events and profiles directly for ETL or processing
- Streaming data access: API returns iterators for memory-efficient processing
- Immutable credentials: Resolved once at Workspace construction
- Dependency injection: Services accept dependencies as constructor arguments for testing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run
just checkto verify quality - Commit your changes with a clear message
- Push to your fork
- Open a Pull Request
Open an issue on GitHub for questions or discussion.