Metadata-Version: 2.4
Name: cashier-server
Version: 0.5.1
Summary: Cashier synchronization server in Python
License-File: LICENSE
Requires-Python: >=3.12
Requires-Dist: beancount>=3.1.0
Requires-Dist: beanquery>=0.2.0
Requires-Dist: fastapi>=0.115.12
Requires-Dist: loguru>=0.7.3
Requires-Dist: python-dotenv>=1.1.0
Requires-Dist: uvicorn>=0.34.2
Description-Content-Type: text/markdown

# cashier-server-python
Cashier synchronization server, in Python

Ledger-cli REST server for [Cashier](https://github.com/alensiljak/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`

## 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:

```sh
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

3. Logging is configured to output to the console.

5. 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.
