Skip to main content

A beautiful CLI expense and income tracker

Project description

xpense

A beautiful CLI expense and income tracker with gorgeous terminal output.

Features

  • Track expenses and income with ease
  • Beautiful reports with category breakdowns
  • Calculate balance (income - expenses)
  • Color-coded output (green for income, red for expenses)
  • Simple CSV storage at ~/.xpense/expenses.csv
  • Powerful filtering by month and category
  • Export transactions to CSV

Installation

From PyPI (recommended)

pip install xpense

From source

# Clone the repository
git clone https://github.com/Gabriel-Rockson/xpense.git
cd xpense

# Install with uv (recommended)
uv sync

# Or install with pip
pip install -e .

Usage

Add Transactions

Add an expense (default behavior):

# Quick syntax - amount, category, optional note
xpense 20 transport "to the office"
xpense 45.50 food "lunch at restaurant"
xpense 100 utilities "electricity bill"

Add income:

# Use 'add' subcommand for income
xpense add 2000 salary "from day job at AmaliTech"
xpense add 500 freelance "web design project"

View Transactions

List all transactions:

xpense list

Filter by month:

xpense list --month 3  # March transactions

Filter by category:

xpense list --category food

Filter by type:

xpense list --type expense  # Only expenses
xpense list --type income   # Only income

Combine filters:

xpense list --month 3 --category food --type expense

Calculate Totals

Total of all transactions:

xpense total

Total for a specific month:

xpense total --month 3

Total for a specific category:

xpense total --category food

Check Balance

Balance (income - expenses):

xpense balance

Monthly balance:

xpense balance --month 3

Generate Reports

Detailed category breakdown:

xpense report

Monthly report:

xpense report --month 3

List Categories

All categories:

xpense categories

Only expense categories:

xpense categories --type expense

Only income categories:

xpense categories --type income

Export Data

Export to default filename (xpense_YYYYMMDD.csv):

xpense export

Export to custom file:

xpense export --output my_transactions.csv

Data Structure

Transactions are stored in CSV format at ~/.xpense/expenses.csv with the following structure:

date,type,amount,category,note
2025-09-29 10:30:00,expense,20.0,transport,to the office
2025-09-29 12:15:00,income,2000.0,salary,from day job at AmaliTech

Fields

  • date: ISO format timestamp (YYYY-MM-DD HH:MM:SS)
  • type: "income" or "expense"
  • amount: Positive float value
  • category: Lowercase with underscores (automatically normalized)
  • note: Optional description

Examples

# Track daily expenses
xpense 5 coffee "morning latte"
xpense 12.50 lunch "sandwich and drink"
xpense 50 gas "fuel for car"

# Record income
xpense add 3000 salary "monthly paycheck"
xpense add 150 freelance "side project"

# Check current month's balance
xpense balance --month $(date +%-m)

# Generate monthly report
xpense report --month $(date +%-m)

# See all food expenses
xpense list --category food --type expense

# Export data for analysis
xpense export --output transactions_2025.csv

Color Coding

  • Green: Income (positive transactions)
  • Red: Expenses (negative transactions)
  • Cyan: Categories and headers

Project Structure

xpense/
├── pyproject.toml          # Project configuration
├── README.md               # This file
├── LICENSE                 # MIT License
└── xpense/
    ├── __init__.py         # Package initialization
    ├── main.py             # CLI entry point
    ├── cli.py              # Typer commands
    ├── storage.py          # CSV operations
    └── display.py          # Rich formatting

Development

# Install development dependencies
uv sync

# Run the CLI locally
uv run xpense --help

# Run with Python
python -m xpense.main

License

MIT License - See LICENSE file for details

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

xpense-0.2.3.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

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

xpense-0.2.3-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file xpense-0.2.3.tar.gz.

File metadata

  • Download URL: xpense-0.2.3.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for xpense-0.2.3.tar.gz
Algorithm Hash digest
SHA256 6eefcb5144da25194ddd82e73072b0d46ca8f1207df326340ace14170a82cf65
MD5 2d2b380805ae8a7a7cbd8830e7901bc9
BLAKE2b-256 600b9a0ed26da735d9a8a265a09cfcc7a415bbb4ddcaeb1163600878042a10f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for xpense-0.2.3.tar.gz:

Publisher: release-please.yml on Gabriel-Rockson/xpense

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file xpense-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: xpense-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for xpense-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1ea806b3476090cfc9e5169b859656a927545142c4292e46ced4f84f60e64eb0
MD5 31d4d5ed189064c31f5c59043eedce3f
BLAKE2b-256 77c589436c2d453f65d77e6209ed63c7b375dcf22714bd8a4e61cd2dc4d38243

See more details on using hashes here.

Provenance

The following attestation bundles were made for xpense-0.2.3-py3-none-any.whl:

Publisher: release-please.yml on Gabriel-Rockson/xpense

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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