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"
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

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.6.0.tar.gz (19.8 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.6.0-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for xpense-0.6.0.tar.gz
Algorithm Hash digest
SHA256 355febd8305e8b677737f5ff722599cb3f354bcc11f6aa0cdf3e62c284bb0528
MD5 c6b0800f0297d5f9445105fcf4b30f38
BLAKE2b-256 1d067d9862de4c614ac39df7e8ac348e5228266ce225ff5c445942390c360e5d

See more details on using hashes here.

Provenance

The following attestation bundles were made for xpense-0.6.0.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.6.0-py3-none-any.whl.

File metadata

  • Download URL: xpense-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 22.0 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.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fbe1f19e04b8747c73c1d12cd9762e4fb86dd4c1cb71418e128ad9637ba00e05
MD5 a4752f5c62766aefa997e70029cba4a1
BLAKE2b-256 ee13a57ec4ca38d3f01c71d933289b8fb04ea5c81ebc90e556ae5e5a6d94b7ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for xpense-0.6.0-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