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.3.0.tar.gz (13.0 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.3.0-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for xpense-0.3.0.tar.gz
Algorithm Hash digest
SHA256 9d8c13ac25f1009143bed39a40a6bf4ec17f521bb69f9c6dd7a878ee72126f9d
MD5 fafb3ae5c098e8b2de6c276ddb38c13b
BLAKE2b-256 760a9c8c5bf034c419dddf617b4e04a2427e347c16877218227bc9c2abc9d4bc

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: xpense-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 12.9 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 640569a62c796b23f6463e2490df37d85e8c976a4cd3e0f4aaf29e1bc17de123
MD5 71b0b2b5ed615103e4bdfe1b216c581b
BLAKE2b-256 161574f911e31d9f4bf0b31e15cb7f478fe826a210192881cdfabb359edab292

See more details on using hashes here.

Provenance

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