Skip to main content

Cashier synchronization server in Python

Project description

cashier-server-python

Cashier synchronization server, in Python

Ledger-cli REST server for Cashier PWA, implemented in Python with FastAPI.

Cashier Server acts as a mediator between Cashier PWA and Ledger CLI, forwarding queries to Ledger and the results to Cashier. Used for synchronizing the ledger data in Cashier.

This is a Python implementation of the Cashier Server using FastAPI.

Installation

  1. Install uv
  2. Install uv tool install cashier-server

Configure Backend

To use Beancount as a back-end, set the BEANCOUNT_FILE environment variable.

The easiest way is by creating an .env file containing this variable, which should point to your Beancount book. Otherwise, Cashier Server will use Ledger as the backend.

Run

Execute cashier-server-py script provided by the cashier-server package.

The server runs on 0.0.0.0:3000, matching the Rust implementation.

API Endpoints

  • / - Execute a ledger command
  • /hello - Return a base64-encoded image
  • /ping - Simple health check
  • /shutdown - Request server shutdown

CORS is enabled for all origins, similar to the Rust implementation.

Development

VSCode recommended. Run the run.cmd script to start the server. Or run from VSCode to debug.

Debug

Make sure that Ledger CLI is configured and can be called from the current directory. Then run:

run.cmd
# or
uv run python app.py
# Or uvicorn directly:
uvicorn app:app --host 0.0.0.0 --port 3000

Notes on the Implementation

  1. Logging is configured to output to the console.

  2. For the /hello endpoint, you would need to provide an actual image file named "hello.png" in the same directory as the app.py file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cashier_server-0.10.0.tar.gz (31.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cashier_server-0.10.0-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file cashier_server-0.10.0.tar.gz.

File metadata

  • Download URL: cashier_server-0.10.0.tar.gz
  • Upload date:
  • Size: 31.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.8

File hashes

Hashes for cashier_server-0.10.0.tar.gz
Algorithm Hash digest
SHA256 39aa046c74f70b2d240bfa2b1402782a43535dcc8b30c3f7c72101d0ec5be091
MD5 2bba2a6e98b0141147c9dbf4b61b6746
BLAKE2b-256 666c250393cefa109cca3c3ef1bb54c3869695e23761404c2199450070b84955

See more details on using hashes here.

File details

Details for the file cashier_server-0.10.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cashier_server-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f627377f071616cd9b7a10e36265a353aebab5553a0c27110b1728233d69035f
MD5 a88da20573822518954d088b6b1651da
BLAKE2b-256 dfd54faf0ffd83ab0425b20a28b81d2845fa38e0210a64b459af11ea6199081f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page