a-ledger
Embedded Python accounting SDK for a-options and a-trader. It owns balanced journal facts, correction history, lot computation, reservations and batch reads. Applications own business data and compose it through explicit ledger identifiers.
Use
from sqlalchemy import create_engine, event
from a_ledger import Ledger
from a_ledger.schema import install
engine = create_engine("sqlite:///accounts.db")
@event.listens_for(engine, "connect")
def configure_sqlite(dbapi_connection, _):
dbapi_connection.isolation_level = None
dbapi_connection.execute("PRAGMA foreign_keys=ON")
@event.listens_for(engine, "begin")
def begin_sqlite(connection):
connection.exec_driver_sql("BEGIN")
with engine.begin() as connection:
install(connection) # Explicit installation on an empty/current store.
ledger = Ledger(connection)
ledger.accounts.create_portfolio("main", code="main", currency="CNY")
ledger.accounts.create_account(
"cash", portfolio_id="main", code="cash", category="ASSET"
)
The caller owns the connection and outer transaction. Use the same connection
for application writes and SDK calls; the SDK never commits that transaction.
All posting, replacement and reversal commands use ledger.journal.
- Public contracts
- Data model and business references
- Ledger page queries
- Whole-source option booking
- Domain terminology
Verification
Run .venv/bin/python -m pytest. Source and test modules are limited to 500
physical lines. Tests use synthetic data and public accounting interfaces.
Normal startup and restore support the current schema; historical audit evidence
and command identities remain immutable.
Metadata
Release files for a-ledger 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| a_ledger-0.3.0.tar.gz | 59.4 kB | With provenance | Details for a_ledger-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| a_ledger-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for a_ledger-0.3.0-py3-none-any.whl |
Total release size: 125.5 kB
Release files / a_ledger-0.3.0.tar.gz
| Download URL | a_ledger-0.3.0.tar.gz |
|---|---|
| Size | 59.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
78dbf9133ff02e4ce6b0fa8f4f5ce99cf187ee62cbe5bd3f8dca59ac5f12d8c1
|
|
BLAKE2b-256 checksum How to use checksums |
98c4b18aee3ee9cdb2801cf79c63b86ae706e7c4ae4de52ad0a78b781da67bc3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.
Transparency logRelease files / a_ledger-0.3.0-py3-none-any.whl
| Download URL | a_ledger-0.3.0-py3-none-any.whl |
|---|---|
| Size | 66.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c95ac251bb8c5ac89c2c914881f2e489b59ac4723235ba69d6bc3c6130e3304a
|
|
BLAKE2b-256 checksum How to use checksums |
66a4c7acd00bb4e55559862d00bb6e8c594c5f6580f2833ad08ca9baf6d5201c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.
Transparency logSecurity for a-ledger 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for a_ledger-0.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.