Skip to main content

Loman

Manage complex calculation flow via robust DAG-based dependency logic in Python

License: BSD-3-Clause Python versions PyPI - Version PyPI - Wheel ReadTheDocs

Github Linux MAC OS Code style: ruff uv Hatch project CodeFactor

CI MARIMO DEVCONTAINER

Open in GitHub Codespaces

Smart computation management - Only recalculate what's necessary

Loman tracks the state of your computations and their dependencies, enabling intelligent partial recalculations that save time and computational resources. Perfect for data pipelines, real-time systems, and complex analytical workflows.

Table of Contents

✨ Features

Build smarter computation graphs with automatic dependency tracking

  • 🔄 Smart Recalculation: Only compute what's changed - save time and resources
  • 📊 Dependency Tracking: Automatic graph-based dependency management
  • 🎯 Selective Updates: Control which outputs to compute and when
  • 💾 State Persistence: Serialize computation graphs for inspection and recovery
  • 🔍 Visual Debugging: Built-in GraphViz integration for computation visualization
  • Real-time Ready: Perfect for systems with inputs that tick at different rates
  • 🧪 Research Friendly: Iterate quickly by updating methods and re-running only necessary computations
  • 🔗 Framework Agnostic: Works with NumPy, Pandas, and your favorite Python libraries

🚀 Quick Start

Loman Graph Example

The above computation graph was generated with this simple Loman code:

from loman import Computation

# Create a computation graph
comp = Computation()
comp.add_node('a', value=1)                    # Input node
comp.add_node('b', lambda a: a + 1)            # b depends on a
comp.add_node('c', lambda a, b: 2 * a)         # c depends on a and b
comp.add_node('d', lambda b, c: b + c)         # d depends on b and c
comp.add_node('e', lambda c: c + 1)            # e depends on c

# Smart computation - only calculates what's needed
comp.compute('d')  # Will not compute 'e' unnecessarily!

# Inspect intermediate values
comp.to_dict()
# {'a': 1, 'b': 2, 'c': 2, 'd': 4, 'e': None}

# Visualize the computation graph
comp.draw()  # Creates the graph shown above

📚 Explore More: Check out our Interactive Examples including:

  • 💰 Interest Rate Swap Pricing
  • 📈 Portfolio Valuation
  • 🏦 CDO Modeling

Why Loman?

Loman transforms how you build and maintain complex data processing pipelines by making computational dependencies explicit and manageable. Instead of manually tracking what needs to be recalculated when data changes, Loman handles this automatically.

Perfect for:

  • 🔴 Real-time Systems: Handle inputs that tick at different rates efficiently

    • Only recalculate affected downstream computations
    • Control which outputs are computed and when
    • Monitor status of all components in your pipeline
  • 📦 Batch Processing: Build robust daily/periodic processes

    • Serialize computation state for easy inspection and debugging
    • Replace inputs or override intermediate values without full recomputation
    • Recover from failures efficiently by resuming from last good state
  • 🔬 Research & Analytics: Accelerate iterative development

    • Modify calculation methods and re-run only what's needed
    • Track complex dependencies in evolving analysis pipelines
    • Reuse expensive intermediate computations across experiments

📖 Learn More: The Introduction explains in detail how Loman can transform your workflow.

📥 Installation

Using pip (recommended)

pip install loman

From source (development)

git clone https://github.com/janusassetallocation/loman.git
cd loman
pip install -e .

Note: Use -e flag for editable installation during development

🛠️ Development

For contributors and advanced users

Loman uses modern Python development tools for a smooth developer experience:

# 📦 Install development dependencies
make install

# 🧪 Run tests with coverage
make test

# ✨ Format and lint code
make check

Development Tools

  • Testing: pytest with coverage reporting
  • Formatting: ruff for code formatting and linting
  • Task Management: Taskfile for build automation
  • Quality: Pre-commit hooks for code quality

📖 Documentation

☁️ Try Loman in Codespaces

Open in GitHub Codespaces

Instant development environment in your browser Click the button to launch a fully configured development environment in your browser.

What's Included

  • 🐍 Python 3.13 - Latest Python with all dependencies pre-installed
  • 🛠️ Development Tools - pytest, ruff, mypy, pre-commit hooks ready to go
  • 📓 Interactive Notebooks - Marimo notebooks for exploring examples
  • Zero Setup - Everything configured ready to go
  • 🎯 VS Code Extensions - Python, testing, and productivity extensions pre-installed

👥 Contributing

We welcome contributions! 🎉

Whether you're fixing bugs, adding features, or improving documentation, your help makes Loman better for everyone.

Quick Start for Contributors

  1. 🍴 Fork the repository
  2. 🌿 Create your feature branch: git checkout -b feature/amazing-feature
  3. ✨ Make your changes and add tests
  4. 🧪 Test your changes: make test
  5. 📝 Commit your changes: git commit -m 'Add amazing feature'
  6. 🚀 Push to your branch: git push origin feature/amazing-feature
  7. 🎯 Open a Pull Request

Resources

Acknowledgments 🙏


If you find Loman useful, please consider giving it a star!

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

loman-0.7.0.tar.gz (684.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

loman-0.7.0-py3-none-any.whl (151.5 kB view details)

Uploaded Python 3

File details

Details for the file loman-0.7.0.tar.gz.

File metadata

  • Download URL: loman-0.7.0.tar.gz
  • Upload date:
  • Size: 684.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for loman-0.7.0.tar.gz
Algorithm Hash digest
SHA256 b1b68b2c2cb6d08267451e26e873fc3c372016e5a5db6e0d98aece8ba7cb653e
MD5 191bdc3799ca0bbe19bfacab5da7a666
BLAKE2b-256 5521a0f1d5e4c3b184d76cfdddcb442e396720ac1f14c70b358b1416ce6894be

See more details on using hashes here.

Provenance

The following attestation bundles were made for loman-0.7.0.tar.gz:

Publisher: rhiza_release.yml on janushendersonassetallocation/loman

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file loman-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: loman-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 151.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for loman-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6ef40a4623391c09a327f40d654a8a77e7dae6d380c18cac102a4f98149b4048
MD5 a803c8514c781d9f925189fedec57613
BLAKE2b-256 7bb0dd39cb93b42c0c4eb7d1701b6c2ab18d7df2bef17a38ce568cf7a6e9a7da

See more details on using hashes here.

Provenance

The following attestation bundles were made for loman-0.7.0-py3-none-any.whl:

Publisher: rhiza_release.yml on janushendersonassetallocation/loman

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 files

0.6.0

2 files

0.5.5

2 files

0.5.4

2 files

0.5.3

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

0.3.0

2 files

0.2.1

2 files

0.2.0

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page