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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xpense-0.2.4.tar.gz.
File metadata
- Download URL: xpense-0.2.4.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47bb50b5b5a237997c17df74fe8ef7a1d014f3cf76754ffbdade40e77788f6f6
|
|
| MD5 |
6b8fd12b3cb749171a1f9bf5cdb2e018
|
|
| BLAKE2b-256 |
ddaa08816110c6fc38ccbc99e06149109187a095ea58e207e529a48e80fb9a3a
|
Provenance
The following attestation bundles were made for xpense-0.2.4.tar.gz:
Publisher:
release-please.yml on Gabriel-Rockson/xpense
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xpense-0.2.4.tar.gz -
Subject digest:
47bb50b5b5a237997c17df74fe8ef7a1d014f3cf76754ffbdade40e77788f6f6 - Sigstore transparency entry: 569746414
- Sigstore integration time:
-
Permalink:
Gabriel-Rockson/xpense@5737aff332ce0fea95e55b348dc84f610ffac6da -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Gabriel-Rockson
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-please.yml@5737aff332ce0fea95e55b348dc84f610ffac6da -
Trigger Event:
push
-
Statement type:
File details
Details for the file xpense-0.2.4-py3-none-any.whl.
File metadata
- Download URL: xpense-0.2.4-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ee2193b098d0bc9733db967f1a100b7fab5689b043cb1a5d99b4f34be03c630
|
|
| MD5 |
38b853a07b8cd0e72752eb8f202e4d0c
|
|
| BLAKE2b-256 |
7e451100a6d9251d1f3e9a52ab777e108f31f26122cc5274c794dad779134ed3
|
Provenance
The following attestation bundles were made for xpense-0.2.4-py3-none-any.whl:
Publisher:
release-please.yml on Gabriel-Rockson/xpense
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xpense-0.2.4-py3-none-any.whl -
Subject digest:
3ee2193b098d0bc9733db967f1a100b7fab5689b043cb1a5d99b4f34be03c630 - Sigstore transparency entry: 569746420
- Sigstore integration time:
-
Permalink:
Gabriel-Rockson/xpense@5737aff332ce0fea95e55b348dc84f610ffac6da -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Gabriel-Rockson
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-please.yml@5737aff332ce0fea95e55b348dc84f610ffac6da -
Trigger Event:
push
-
Statement type: