Protean
Protean is an opinionated Python framework for building event-driven applications with Domain-Driven Design — aggregates, CQRS, and event sourcing are first-class, and your domain logic stays independent of the database, broker, and API you run it on.
Installation
Protean is available on PyPI:
$ pip install protean
Protean officially supports Python 3.11+.
Quick Start
A command flows to its handler, the aggregate raises an event, and an event handler reacts — all wired by the domain, independent of infrastructure:
from protean import Domain
from protean.fields import Boolean, Identifier, String
from protean.utils.mixins import handle
domain = Domain(name="Publishing")
domain.config["command_processing"] = "sync"
domain.config["event_processing"] = "sync"
@domain.event(part_of="Post")
class PostPublished:
post_id = Identifier()
title = String()
@domain.aggregate
class Post:
title = String(required=True, max_length=200)
is_published = Boolean(default=False)
def publish(self):
self.is_published = True
self.raise_(PostPublished(post_id=self.id, title=self.title))
@domain.command(part_of="Post")
class PublishPost:
post_id = Identifier(identifier=True)
title = String()
@domain.command_handler(part_of="Post")
class PostCommandHandler:
@handle(PublishPost)
def publish(self, command):
post = Post(id=command.post_id, title=command.title)
post.publish()
domain.repository_for(Post).add(post)
@domain.event_handler(part_of="Post")
class Notifications:
@handle(PostPublished)
def announce(self, event):
print(f"Published: {event.title}")
domain.init(traverse=False)
with domain.domain_context():
domain.process(PublishPost(post_id="1", title="Hello, Protean"))
Documentation
Online docs are available at https://docs.proteanhq.com.
Versioning
Protean does not use strict semantic versioning. The promise is: Code that runs warning-free on 1.N runs unmodified on 1.N+1. Every removal is announced by a deprecation warning naming the release it lands in, at least one release ahead, so you can turn "will this upgrade break us?" into a test run. See the versioning policy for the full contract.
Quality
Protean is tested against 5 backing services across 4 Python versions on every commit.
| Metric | Value |
|---|---|
| Tests | 12,000+ (quality report) |
| Linting | Zero violations (Ruff) |
| Complexity | Avg 3.38 cyclomatic (A grade) |
| Maintainability | A rank (95% of files) |
| CI Matrix | Python 3.11-3.14 x PostgreSQL, Redis, Elasticsearch, MessageDB, MSSQL |
See the full Quality Report for details.
Contributing
Note: Protean framework is not associated or related to Protean eGov Technologies or Code for Gov Tech initiatives.
Protean is developed and maintained by a single maintainer. The contributions that help most are bug reports, real-world use cases, and adapter packages built against the public conformance suite.
- Found a bug or have a use case to share? Open an issue. Clear, reproducible reports are the most valuable contribution you can make, and they are answered as a priority.
- Planning a non-trivial code change? Open an issue to discuss it first, before investing in a pull request. Unsolicited large PRs may not be merged. Small, obvious fixes are welcome directly.
- Building an adapter? Adapters live in their own packages, certified against the conformance suite. See the contributing guide.
See CONTRIBUTING.md and the community section for the full picture.
License
Protean is licensed under the Apache License 2.0.
Licensing commitment. The Protean framework core is, and will remain, available under the Apache License 2.0. This is a permanent commitment: the core will not be relicensed to a proprietary or source-available license.
Copyright 2018-2026 Subhash Bhushan C and the Protean contributors.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file protean-0.17.0.tar.gz.
File metadata
- Download URL: protean-0.17.0.tar.gz
- Upload date:
- Size: 4.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dee635e9660a36d95c2f20967b9b4ed7c7b0aba1440bd09284511b782d970e31
|
|
| MD5 |
0c28a6cb4ae94467be967d563158e041
|
|
| BLAKE2b-256 |
89003a7512e83125e436b00eb5c6331303bd4a1f3b424fe8b1381dd126440d99
|
Provenance
The following attestation bundles were made for protean-0.17.0.tar.gz:
Publisher:
publish.yml on proteanhq/protean
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
protean-0.17.0.tar.gz -
Subject digest:
dee635e9660a36d95c2f20967b9b4ed7c7b0aba1440bd09284511b782d970e31 - Sigstore transparency entry: 2341476123
- Sigstore integration time:
-
Permalink:
proteanhq/protean@d5c30aaae74139a2dbf4ad224f5c809fcb149e9b -
Branch / Tag:
refs/tags/v0.17.0 - Owner: https://github.com/proteanhq
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d5c30aaae74139a2dbf4ad224f5c809fcb149e9b -
Trigger Event:
push
-
Statement type:
File details
Details for the file protean-0.17.0-py3-none-any.whl.
File metadata
- Download URL: protean-0.17.0-py3-none-any.whl
- Upload date:
- Size: 1.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d80742704942b4aac77e467f4f598b3e0852a6620091ca793742b4210c1e70c8
|
|
| MD5 |
10f820be6938ff00eb76c82ac6ac5bd8
|
|
| BLAKE2b-256 |
9e340f3afde66eeffbec6ce6694b4ef8598b2af65c46629eb04c5ba815ccd0b5
|
Provenance
The following attestation bundles were made for protean-0.17.0-py3-none-any.whl:
Publisher:
publish.yml on proteanhq/protean
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
protean-0.17.0-py3-none-any.whl -
Subject digest:
d80742704942b4aac77e467f4f598b3e0852a6620091ca793742b4210c1e70c8 - Sigstore transparency entry: 2341476137
- Sigstore integration time:
-
Permalink:
proteanhq/protean@d5c30aaae74139a2dbf4ad224f5c809fcb149e9b -
Branch / Tag:
refs/tags/v0.17.0 - Owner: https://github.com/proteanhq
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d5c30aaae74139a2dbf4ad224f5c809fcb149e9b -
Trigger Event:
push
-
Statement type: