Installation, Testing, & Publishing

Basic Installation

pip install monaco

Installing from Source

git clone https://github.com/scottshambaugh/monaco.git
cd monaco
uv sync --all-extras --group dev

Running Tests and Type Checking

uv run coverage run --source=monaco -m pytest && uv run coverage report -m 
uv run mypy src tests/test*

Profiling

Edit the example to remove the plotting functions before profiling. Then upload the json output to speedscope.app to view the report.

uv tool install py-spy
uv run py-spy record -o election.speedscope.json --format speedscope --rate 50 -- python examples/election/election_example_monte_carlo_sim.py

Building Docs

ReadTheDocs will automatically build when the main branch is updated.

uv sync --group docs
cd docs
uv run make clean && uv run make html

Releasing a New Version and Publishing to PyPI

  1. Update CHANGELOG.md

  2. Update the version in pyproject.toml

  3. Update and install the package

    uv sync --upgrade --all-extras --group dev
    
  4. Run tests, type checking, and linting locally

    uv run ruff check .
    uv run ruff format --check .
    uv run coverage run --source=monaco -m pytest && uv run coverage report -m 
    uv run mypy src tests/test*
    
  5. Run plotting tests manually

  6. Commit any changes and push up the main branch

  7. Wait for CI tests to pass

  8. Check that the docs are building

  9. Create a new release, creating a new tag and including a changelog:

    **Changelog**: https://github.com/scottshambaugh/monaco/blob/main/CHANGELOG.md    
    **Full Diff**: https://github.com/scottshambaugh/monaco/compare/v0.x.x...v0.x.x
    

    This will automatically publish the release to PyPI.