Python port of Morphir - a library of tools for building and working with functional domain models.
Morphir enables you to write business logic once and use it across multiple platforms, languages, and runtimes. It provides a strongly-typed intermediate representation (IR) that captures the semantics of your domain model.
This monorepo contains two packages:
| Package | Description | PyPI |
|---|---|---|
morphir |
Core library - IR models, types, and functional domain modeling primitives | |
morphir-tools |
CLI tools and extensions for working with Morphir |
If you just need the Morphir library for your Python project:
pip install morphirOr with uv:
uv add morphirFor the full toolset including CLI commands:
pip install morphir-toolsOr with uv:
uv add morphir-toolsfrom morphir.ir import Type, Value
# Example usage will be added as the library develops- Python 3.14+
This project uses mise for tool management and uv for Python package management.
Install mise (if not already installed):
curl https://mise.run | sh- Clone the repository:
git clone https://github.com/finos/morphir-python.git
cd morphir-python- Install tools and dependencies:
mise install
uv sync --all-groups- Run the checks:
mise run check| Task | Description |
|---|---|
mise run lint |
Run ruff linter |
mise run format |
Run ruff formatter |
mise run typecheck |
Run mypy and pyright |
mise run test |
Run pytest unit tests |
mise run test-bdd |
Run behave BDD tests |
mise run test-all |
Run all tests |
mise run coverage |
Run tests with coverage |
mise run check |
Run all checks |
mise run build |
Build packages |
mise run clean |
Clean build artifacts |
This project follows functional programming principles:
- Immutability: Data structures are immutable by default
- Type Safety: Strict type annotations with mypy and pyright
- Algebraic Data Types: Using
@dataclass(frozen=True), Unions, and Protocols - Making Illegal States Unrepresentable: Domain modeling that prevents invalid states at compile time
- Core IR model implementation
- JSON serialization/deserialization
- Type checking and validation
- Code generation backends
- CLI tooling
For any questions, bugs or feature requests please open an issue. For anything else please send an email to morphir@finos.org.
To submit a contribution:
- Fork it (https://github.com/finos/morphir-python/fork)
- Create your feature branch (
git checkout -b feature/fooBar) - Read our contribution guidelines and Community Code of Conduct
- Commit your changes (
git commit -am 'Add some fooBar') - Push to the branch (
git push origin feature/fooBar) - Create a new Pull Request
NOTE: Commits and pull requests to FINOS repositories will only be accepted from those contributors with an active, executed Individual Contributor License Agreement (ICLA) with FINOS OR who are covered under an existing and active Corporate Contribution License Agreement (CCLA) executed with FINOS. Commits from individuals not covered under an ICLA or CCLA will be flagged and blocked by the FINOS Clabot tool (or EasyCLA). Please note that some CCLAs require individuals/employees to be explicitly named on the CCLA.
Need an ICLA? Unsure if you are covered under an existing CCLA? Email help@finos.org
- Morphir - The main Morphir project
- Morphir Elm - Elm implementation
- Morphir Scala - Scala implementation
Copyright 2026 FINOS
Distributed under the Apache License, Version 2.0.
SPDX-License-Identifier: Apache-2.0