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.

Configure Certificates

Create a self-signed certificate with OpenSSL.

Add CASHIER_SSL_KEY and CASHIER_SSL_CERT paths to .env file, pointing to generated key.pem and cert.pem.

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.11.0.tar.gz (32.4 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.11.0-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cashier_server-0.11.0.tar.gz
  • Upload date:
  • Size: 32.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for cashier_server-0.11.0.tar.gz
Algorithm Hash digest
SHA256 5c2e65264d29df08a1bbad7e7c76ea33fed274724f0d90c2d3a00dd8b7bb1c3c
MD5 fe10e4ed24846e0e65a54687bb390baa
BLAKE2b-256 7e70bdf3bd7e29c98757c639ae86141d8295def5b9f4cbf3b9fe9988e15fd2b7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cashier_server-0.11.0-py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for cashier_server-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9cbfb58c8058a52e5bec71ebbd0cec5b1fdf8ccc1104b2af3ba5ca8c4c8fdd4b
MD5 474e83ba8ef25f40514a4b66f409169f
BLAKE2b-256 16b11eb454dc0077dbd9345934256b207c8ee34c959a1b75b2b6ccbd1376e9c6

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