PeerPedia Core — engine protocols, types, and exceptions
Reason this release was yanked:
Not stable
Project description
Peerpedia Core
Zero-dependency protocol layer for PeerPedia — the peer-reviewed academic publishing platform built on Git.
peerpedia-core ← this package: protocols, types, exceptions
├── peerpedia-storage ← SQL + Git backends (separate package)
├── peerpedia-transport ← HTTP / P2P transport (separate package)
├── peerpedia-compute ← scoring & reputation (separate package)
├── peerpedia-social ← notifications, shares (separate package)
└── peerpedia-app ← CLI, server, REPL (separate package)
What this package is
peerpedia-core defines the contracts — every other PeerPedia package
depends on this one. It contains:
- Types — frozen dataclasses for
Article,Review,User,Scores,Version, query types, and write payloads. All storage-agnostic, no IO. - Protocols —
typing.Protocolclasses for storage backends, lifecycle state machines, sync, auth, authorization, compilation, and scoring. - Exceptions — semantic exception hierarchy with machine-readable codes.
- Crypto protocols — algorithm-agnostic
SigningKey/PublicKeyinterfaces. - Lifecycle dispatcher —
execute()reduces an action+context through a pluggable state machine. - Peerpedia facade — dependency-injection wrapper that wires protocols into a usable engine.
The Scores type is a generic Mapping[str, float] wrapper — the compute
plugin (peerpedia-compute) defines which dimensions exist and how they are
aggregated. Aggregate scores are a read-side projection over review data,
not an article attribute stored in core.
What this package is NOT
- Not a storage backend. See
peerpedia-storagefor SQLAlchemy and GitPython implementations of the storage protocols. - Not a scoring algorithm. See
peerpedia-computefor average, reputation-weighted, and sedimentation engines. - Not a CLI, server, or REPL. See
peerpedia-app.
Quick start
from peerpedia_core import Peerpedia
from peerpedia_core.types import Article, ArticleId, User, UserId
# Peerpedia needs concrete backends — swap these with real implementations
# from peerpedia-storage in production:
#
# from peerpedia_storage import SqlArticleStorage, SqlUserStorage, SqlLifecycle
#
from tests.conftest import MemArticleStorage, MemLifecycle, MemUserStorage
storage = MemArticleStorage()
pp = Peerpedia(
storage=storage,
lifecycle=MemLifecycle(storage),
user_storage=MemUserStorage(),
)
# Create an article
aid = pp.create()
# Revise it
article = Article(id=aid, title="My Paper", status="draft", authors=("Alice",))
pp.revise(aid, content="# Hello World", article=article)
# Read metadata back
meta = pp.read_meta(aid)
print(meta.title) # "My Paper"
Note: The
Mem*backends above live intests/conftest.pyand are only available in editable/dev installs. Production code imports frompeerpedia-storage(SQLAlchemy + GitPython) orpeerpedia-transportinstead.
Protocols
This table shows every protocol in core and which package implements it.
| Protocol | File | Implemented by |
|---|---|---|
ArticleMetaStorage |
protocols/storage/article.py |
peerpedia-storage |
ArticleContentStorage |
protocols/storage/article.py |
peerpedia-storage |
ArticleStorage |
protocols/storage/article.py |
peerpedia-storage |
ReviewMetaStorage |
protocols/storage/review.py |
peerpedia-storage |
ReviewContentStorage |
protocols/storage/review.py |
peerpedia-storage |
UserStorage |
protocols/storage/user.py |
peerpedia-storage |
Lifecycle |
protocols/lifecycle.py |
peerpedia-app |
AuthProvider |
protocols/auth.py |
peerpedia-transport |
Authorizer |
protocols/authorizer.py |
peerpedia-app |
ScoringEngine |
protocols/scoring.py |
peerpedia-compute |
Compiler |
protocols/compiler.py |
peerpedia-app |
ArticleSync |
protocols/sync.py |
peerpedia-transport |
ReviewSync |
protocols/sync.py |
peerpedia-transport |
Exceptions
All business-logic errors inherit from PeerpediaError:
PeerpediaError code="ERROR"
├── NotFoundError code="NOT_FOUND"
├── NotAuthorizedError code="NOT_AUTHORIZED"
├── ConflictError code="CONFLICT"
│ └── MergeConflictError code="MERGE_CONFLICT"
└── BadRequestError code="BAD_REQUEST"
Each carries structured context (permission, resource_type,
conflicting_entity, etc.) for typed error handling.
Requirements
- Python ≥ 3.11
- Zero dependencies
License
AGPL-3.0 — see LICENSE.
Project details
Release history Release notifications | RSS feed
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 peerpedia_core-0.2.1.tar.gz.
File metadata
- Download URL: peerpedia_core-0.2.1.tar.gz
- Upload date:
- Size: 31.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93d26518db7f8be3c23577d428574ba5dd8e778e49d1bdff6f79189405e949ca
|
|
| MD5 |
acf7c55b47782b4d26e8ca114368a8b7
|
|
| BLAKE2b-256 |
776e1f52d66ef7c812855fe5d504968cf7f28c76be3fb487c7429e67364fadcc
|
File details
Details for the file peerpedia_core-0.2.1-py3-none-any.whl.
File metadata
- Download URL: peerpedia_core-0.2.1-py3-none-any.whl
- Upload date:
- Size: 33.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7fccb68c4a9155602ef5dd2ad7f4ac7a348f56877925bf8af725297134611fd4
|
|
| MD5 |
05490d6f19a47bcfdd96f70bcc62f2e9
|
|
| BLAKE2b-256 |
d8d21e2cc0bc8fd87990c25be1a31cfb5c46d536c52cf159797a91e9ca7dd676
|