Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
ae75db4
Upgrade Fugue to version 0.3.0 with major enhancements and breaking c…
alexnodeland Aug 19, 2025
980ad9f
Enhance README and examples for Fugue library
alexnodeland Aug 19, 2025
f182b81
Update CHANGELOG and remove deprecated AdaptiveScales
alexnodeland Aug 19, 2025
07465af
format code
alexnodeland Aug 19, 2025
73cb815
Enhance type-safety in distributions
alexnodeland Aug 20, 2025
ecb6bf6
Refactor distributions for enhanced type safety and validation
alexnodeland Aug 20, 2025
2f60731
Remove unused epsilon variable from VariationalParam sampling methods…
alexnodeland Aug 22, 2025
ce931ac
Improve memory management and add memory benchmarks
alexnodeland Aug 22, 2025
16304eb
Add MCMC benchmarks and update DiminishingAdaptation structure
alexnodeland Aug 22, 2025
37d7e89
Enhance type safety and proposal strategies in MCMC implementation
alexnodeland Aug 22, 2025
e7bb7e8
Refactor MCMC benchmarks and improve code formatting
alexnodeland Aug 22, 2025
b8df4c3
Add rustfmt configuration for consistent code formatting
alexnodeland Aug 22, 2025
a8baecf
Run cargo clippy
alexnodeland Aug 22, 2025
5f15bca
Update Cargo.toml to organize dependencies and add new ones for CLI, …
alexnodeland Aug 22, 2025
131fa51
Add documentation style guide and module README template
alexnodeland Aug 23, 2025
78d9ef5
Enhance error handling system with structured error codes and context
alexnodeland Aug 23, 2025
869e0fc
Add Makefile for build automation and improve testing
alexnodeland Aug 23, 2025
a6d0695
Merge pull request #1 from alexnodeland/refactor/productionize
alexnodeland Aug 23, 2025
9f0209c
Add issue templates (#3)
alexnodeland Aug 23, 2025
cb439a6
Add comprehensive documentation and slim down main README following s…
Copilot Aug 28, 2025
8afdc53
Update README.md
alexnodeland Aug 28, 2025
d911f0f
Update API documentation links and remove outdated notes (#5)
alexnodeland Sep 1, 2025
9ea7e02
Fix/pass ci (#6)
alexnodeland Sep 1, 2025
3897a59
Docs/finalize meta docs (#7)
alexnodeland Sep 1, 2025
930ce40
Update development environment and dependencies (#8)
alexnodeland Sep 1, 2025
a916efe
Chore/update package name (#9)
alexnodeland Sep 1, 2025
3fa3494
Fix/project includes (#10)
alexnodeland Sep 1, 2025
b954a91
Enhance README.md with improved formatting and new sections (#11)
alexnodeland Sep 1, 2025
e84b1ba
Update examples/production_deployment.rs
alexnodeland Sep 1, 2025
636eb26
Update examples/trace_manipulation.rs
alexnodeland Sep 1, 2025
562d2c7
Refactor PooledPriorHandler usage across examples and documentation (…
alexnodeland Sep 1, 2025
d5c5581
Refactor code for improved readability and efficiency (#14)
alexnodeland Sep 1, 2025
a2006ca
Fix/pages deployment (#16)
alexnodeland Sep 1, 2025
86adec3
Merge branch 'main' into develop
alexnodeland Sep 1, 2025
4fd9633
Update API documentation link in `api-reference.md` to point to the c…
alexnodeland Sep 1, 2025
f33a808
Update API documentation link in README.md to point to the latest ver…
alexnodeland Sep 1, 2025
572998a
Update README.md
alexnodeland Sep 2, 2025
9f120a3
Merge branch 'main' into develop
alexnodeland Sep 2, 2025
429b41d
Update README.md to enhance documentation clarity and usability
alexnodeland Sep 2, 2025
310f54d
Add version check before publishing to crates.io in GitHub Actions wo…
alexnodeland Sep 2, 2025
bf91e42
Update GitHub Actions workflow for publishing to crates.io
alexnodeland Sep 2, 2025
5cae6f6
Enhance version check logic in GitHub Actions workflow
alexnodeland Sep 2, 2025
3789e69
Merge branch 'main' into develop
alexnodeland Sep 2, 2025
8e6b3cc
fix publish checks
alexnodeland Sep 2, 2025
600fab5
Merge branch 'main' into develop
alexnodeland Sep 2, 2025
1213e76
fix publish flow
alexnodeland Sep 2, 2025
d384933
Merge branch 'main' into develop
alexnodeland Sep 2, 2025
aa98627
Implement comprehensive AGENTS.md standard with testing-focused devel…
Copilot Sep 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 14 additions & 21 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,31 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
name: 🐞 Bug Report
about: Report a bug to help us improve
title: 'Bug: [Short description]'
labels: 'fixme'
assignees: 'alexnodeland'

---

**Describe the bug**
## Describe the bug

A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
## Steps To Reproduce

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
## Expected behavior

A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.
## Actual behavior

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
A clear and concise description of what actually happened.

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
## Additional Context

**Additional context**
Add any other context about the problem here.
22 changes: 13 additions & 9 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
---
name: Feature request
name: 💡 Feature Request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
title: 'Feature: [Short description]'
labels: 'enhancement'
assignees: 'alexnodeland'

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
## Is your feature request related to a problem?

Please provide a clear and concise description of what the problem is. Ex. I'm always frustrated when [...] If not, just write "None".

## Describe the solution you'd like

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
## Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
## Additional context

Add any other context or screenshots about the feature request here.
37 changes: 37 additions & 0 deletions .github/ISSUE_TEMPLATE/rfc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: "💡 RFC Proposal"
about: Submit a Request for Comments (RFC) to propose a design or feature
title: "RFC: [short descriptive title]"
labels: ["rfc/draft"]
assignees: ""
---

## Summary

One-paragraph explanation of the proposal.

## Motivation

- What problem does this solve?
- Why is this important?

## Proposed Solution

- Outline the design at a high level.
- Include diagrams, data flows, or API examples if helpful.

## Alternatives Considered

- What other options did you consider and reject?

## Risks / Drawbacks

- Known trade-offs or risks.

## Open Questions

- What needs further discussion?

---

🔗 **RFC File:** Create a corresponding markdown file in `/docs/rfcs/` with more details, and open a PR, discuss in comments, then merge and create implmenetation issue(s).
25 changes: 25 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/adr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# ADR Pull Request

## ADR Info

- **ADR Number:** [leave empty until assigned]
- **Title:** [decision title]
- **Status:** Proposed
- **Author(s):** [GitHub Username(s)]
- **Supersedes:** ADR-XXX [if applicable]
- **Linked RFC:** RFC-XXX

---

## Summary

Concise summary of the decision.

---

### Checklist

- [ ] ADR file created under `/docs/adrs/NNN-decision-title.md`
- [ ] Metadata filled in (authors, date, status)
- [ ] Links to related RFCs and Issues
- [ ] Labels applied (`adr`)
29 changes: 29 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/rfc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# RFC Pull Request

## RFC Info

- **RFC Number:** [leave empty until assigned]
- **Title:** [short descriptive title]
- **Status:** Draft
- **Author(s):** [GitHub Username(s)]
- **Linked Issue:** #[issue number if any]

---

## Summary

Brief summary of the RFC included in this PR.

## Notes for Reviewers

- What parts need extra scrutiny?
- Any alternatives the reviewers should consider?

---

### Checklist

- [ ] RFC file created under `/docs/rfcs/NNN-title.md`
- [ ] Metadata filled in (authors, date, status)
- [ ] Proposal reviewed for clarity
- [ ] Labels applied (`rfc/draft`)
5 changes: 4 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
uses: dtolnay/rust-toolchain@stable

- name: Check if version is already published
id: version_check
run: |
# Get the workspace package info (not dependencies)
WORKSPACE_ROOT=$(cargo metadata --format-version=1 | jq -r '.workspace_root')
Expand All @@ -32,12 +33,14 @@ jobs:

if echo "$DRY_RUN_OUTPUT" | grep -q "already exists on crates.io index"; then
echo "Version $PACKAGE_VERSION of $PACKAGE_NAME already exists on crates.io. Skipping publish."
exit 0
echo "should_publish=false" >> $GITHUB_OUTPUT
else
echo "Version $PACKAGE_VERSION of $PACKAGE_NAME can be published. Proceeding with publish."
echo "should_publish=true" >> $GITHUB_OUTPUT
fi

- name: Publish to crates.io
if: steps.version_check.outputs.should_publish == 'true'
run: cargo publish --allow-dirty
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
157 changes: 157 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
# Agent Context: Fugue Probabilistic Programming Library

## Project Overview

Fugue is a **production-ready, monadic probabilistic programming library** for Rust. It enables elegant probabilistic program composition through `Model` values executed with pluggable interpreters and state-of-the-art inference algorithms.

### Core Philosophy

- **Monadic Design**: Compose probabilistic programs using pure functional abstractions
- **Type Safety**: Natural return types for distributions (Bernoulli → `bool`, Poisson → `u64`)
- **Production Ready**: Numerically stable algorithms with comprehensive error handling
- **Performance Focused**: Memory optimization, copy-on-write traces, efficient algorithms

## Architecture Overview

```text
fugue/
├── src/ # Core library implementation
│ ├── core/ # Fundamental PPL primitives (Model, Distribution, Address)
│ ├── runtime/ # Execution engine (Handlers, Interpreters, Traces)
│ ├── inference/ # Algorithms (MCMC, SMC, VI, ABC)
│ └── error.rs # Comprehensive error handling
├── docs/ # User documentation (mdbook)
├── examples/ # Practical usage examples
├── tests/ # Integration and API tests
└── benches/ # Performance benchmarks
```

## Key Concepts

### Model Composition

- `Model<T>`: Core probabilistic program type
- `sample()`: Draw from distributions
- `observe()`: Condition on data
- `prob!` macro: Do-notation for monadic composition

### Address System

- Every random choice has a unique, stable address
- Format: `"name"`, `"name#index"`, `"scope::name"`, `"scope::name#index"`
- Critical for reproducibility and inference targeting

### Interpreters/Handlers

- `PriorHandler`: Forward sampling from priors
- `ReplayHandler`: Replay with specific trace values
- `ScoreGivenTrace`: Score traces for importance sampling
- Safe variants available for production use

## Development Guidelines

### Mandatory Testing Practice

**Always run tests after making changes.** This is critical for a probabilistic programming library where subtle changes can have significant statistical implications.

```bash
# Always run before committing changes
make all

# For quick feedback during development
make test

# Check test coverage
make coverage
```

### Code Style

- Follow standard Rust conventions (rustfmt, clippy)
- Prefer explicit error handling over panics
- Use type-safe abstractions over raw implementations
- Document public APIs with examples

### Testing Patterns

- Unit tests for individual components
- Integration tests for end-to-end workflows
- Property-based testing for numerical stability
- Benchmark critical performance paths

### Domain-Specific Considerations

- **Numerical Stability**: Use log-space computations, guard against overflow/underflow
- **Reproducibility**: Ensure deterministic execution given same random seed
- **Memory Management**: Consider trace pooling for high-throughput applications
- **Error Propagation**: Preserve error context through the computation stack

## Common Tasks

### Adding New Distributions

1. Implement `Distribution<T>` trait in `src/core/distribution.rs`
2. Add validation logic and error handling
3. Include comprehensive tests with edge cases
4. Document mathematical properties and use cases

### Implementing Inference Algorithms

1. Design around existing `Handler` infrastructure
2. Consider trace manipulation patterns
3. Implement convergence diagnostics
4. Provide both basic and production-ready variants

### Performance Optimization

1. Profile with realistic workloads first
2. Consider memory pooling for frequent allocations
3. Use copy-on-write semantics where appropriate
4. Benchmark against baseline implementations

## Development Tools

- `make test`: Run test suite
- `make lint`: Run clippy linter
- `make fmt`: Format code
- `make doc`: Generate and open documentation
- `make mdbook`: Build mdbook documentation
- `make coverage`: Generate coverage report
- `make bench`: Run benchmarks
- `make all`: Run all checks (format, lint, test, coverage)

## Getting Started

```bash
# Build and test
make test

# Run examples
cargo run --example basic_modeling

# Generate documentation
make docs-all

# Format and lint
make fmt
make lint

# Run all checks
make all
```

## Critical Areas Requiring Domain Knowledge

1. **Probabilistic Programming Theory**: Understanding of measure theory, inference algorithms
2. **Numerical Analysis**: Floating-point precision, log-space computations
3. **Rust Systems Programming**: Memory management, zero-cost abstractions
4. **Statistical Computing**: Convergence diagnostics, sampling strategies

## Contribution Guidelines

- Changes should preserve API compatibility where possible
- New features require comprehensive tests and documentation
- Performance-critical changes need benchmark validation
- All public APIs must include usage examples

For detailed contribution guidelines, see `.github/CONTRIBUTING.md`.
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
<div align="center">

# 🎼 Fugue

<img src="assets/fugue-logo.svg" alt="Fugue Logo" width="200" height="200">

**A production-ready, monadic probabilistic programming library for Rust**

*Write elegant probabilistic programs by composing `Model` values in direct style; execute them with pluggable interpreters and state-of-the-art inference algorithms.*

[![Rust](https://img.shields.io/badge/rust-1.70%2B-blue.svg)](https://www.rust-lang.org)
[![Crates.io](https://img.shields.io/crates/v/fugue-ppl.svg)](https://crates.io/crates/fugue-ppl)
[![Dev Docs](https://docs.rs/fugue-ppl/badge.svg)](https://docs.rs/fugue-ppl)
[![User Docs](https://img.shields.io/badge/guides-fugue.run-blue)](https://fugue.run)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![CI](https://github.com/alexnodeland/fugue/actions/workflows/ci-develop.yml/badge.svg)](https://github.com/alexnodeland/fugue/actions/workflows/ci-develop.yml)
[![codecov](https://codecov.io/gh/alexnodeland/fugue/branch/develop/graph/badge.svg?token=BDJ5OB6GOB)](https://codecov.io/gh/alexnodeland/fugue)
[![Discord](https://img.shields.io/discord/1412802057437712426?logo=discord&label=discord)](https://discord.gg/QAcF7Nwr)

**Supported Rust:** 1.70+ • **Platforms:** Linux / macOS / Windows • **Crate:** [`fugue-ppl` on crates.io](https://crates.io/crates/fugue-ppl)

A **production-ready**, **monadic probabilistic programming library** for Rust. Write elegant probabilistic programs by composing `Model` values in direct style; execute them with pluggable interpreters and state-of-the-art inference algorithms.

> Supported Rust: 1.70+ • Platforms: Linux / macOS / Windows • Crate: [`fugue-ppl` on crates.io](https://crates.io/crates/fugue-ppl)
</div>

## ✨ Features

Expand Down Expand Up @@ -75,6 +83,7 @@ let mu_values: Vec<f64> = samples.iter()

- **Issues & Bugs**: Use [GitHub Issues](https://github.com/alexnodeland/fugue/issues)
- **Feature Requests**: Open an issue with the `enhancement` label
- **Discord**: Join our [Discord server](https://discord.gg/QAcF7Nwr)

## 🗺️ Roadmap

Expand Down
Loading