a-ledger
توضیحات
Application-neutral double-entry ledger SDK backed by SQLite
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | a-ledger-0.3.0 |
| نام | a-ledger |
| نسخه کتابخانه | 0.3.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | realqiyan |
| ایمیل نویسنده | - |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/a-ledger/ |
| مجوز | - |
# 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
```python
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](docs/sdk-interface-design.md)
- [Data model and business references](docs/ledger-data-model.md)
- [Ledger page queries](docs/ledger-page-design.md)
- [Whole-source option booking](docs/options-booking-design.md)
- [Domain terminology](CONTEXT.md)
## 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.
نیازمندی
| مقدار | نام |
|---|---|
| - | SQLAlchemy<2.1,>=2.0 |
| xtr | build>=1; |
| xtr | pytest>=8; |
| xtr | twine>=5; |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.11 | Python |
نحوه نصب
نصب پکیج whl a-ledger-0.3.0:
pip install a-ledger.whl
نصب پکیج tar.gz a-ledger-0.3.0:
pip install a-ledger.tar.gz