The first version of my reconciliation tool had a dependency problem.

It used pandas for CSV reading, openpyxl for a spreadsheet export, and a small date library for parsing. It worked on my machine. Then a finance operator tried to run it on a company laptop where installing packages required a ticket, the Python version was older than expected, and the proxy blocked the package index.

The tool was not wrong. It was undeliverable.

That experience pushed me toward a constraint: one Python file, standard library only, no network calls. Not because dependencies are bad, but because a finance utility has a different deployment target than a web app. It needs to run on a locked-down laptop, in a cron job, on an air-gapped workstation, six months after you wrote it.

Here is what I learned building csv-reconcile-cli under that constraint.

Why zero dependencies is an architecture decision

For a CLI that touches money, dependencies affect four things beyond install size.

1. Audit surface

A finance user is asked to trust that the tool did not send data anywhere, did not silently alter numbers, and did not change behavior because a transitive package updated. A single file with imports from csv, decimal, pathlib, and argparse is inspectable in minutes.

That does not prove correctness. It does prove scope. In finance, scope is part of trust.

2. Deployment reality

The target machine may be Windows with a corporate Python install, a Mac with Homebrew Python, or a Linux container without pip. python tool.py works across all three if the script uses conservative language features. A requirements file adds a support conversation before the first value is delivered.

3. Failure modes

Third-party libraries bring their own parsing decisions. Pandas may infer a column as numeric and convert an order ID 00123 to 123. An Excel library may write dates differently depending on locale. With the standard library, I choose the types explicitly.

4. Longevity

A zero-dependency script written for Python 3.8 will probably still run years from now. A stack of pinned dependencies may not. For a small utility that runs once a month, longevity beats ecosystem fashion.

The constraint is not a moral position. If you need complex Excel formatting or a web UI, use the right library. For CSV matching and report generation, the standard library is enough.

The shape of the tool

The CLI is intentionally one file:

reconcile.py # parser, loader, matcher, report writer, demo data README.md # usage and examples LICENSE # MIT 

No package structure, no plugin system, no framework. The architecture is a pipeline:

argparse → detect columns → load and normalize rows → aggregate by ID → compare → write Markdown + CSV 

Each stage is a pure-ish function that takes data and returns data. The file writer is isolated at the end. That makes the matching logic testable without touching the filesystem.

Decision 1: money is Decimal, never float

This is non-negotiable. Binary floating point cannot represent most decimal fractions exactly. A tool that compares money with floats will eventually classify a correct match as a one-cent discrepancy.

from decimal import Decimal, ROUND_HALF_UP amount = Decimal("1234.56").quantize(Decimal("0.01"), rounding=ROUND_HALF_UP) 

Two details matter:

  • Parse before aggregating. Do not sum floats and round at the end.
  • Quantize with an explicit rounding mode. The default may be fine, but the report should reflect a deliberate policy.

I also avoid converting money to float anywhere, including in the HTML report. Formatting happens on Decimal values.

Decision 2: column detection is a ranked alias list, not magic

Auto-detection has a bad reputation because it often guesses silently. The fix is not to remove it; it is to make it predictable and overridable.

The tool normalizes headers to lowercase snake_case:

def normalize_header(value): return re.sub(r"[^a-z0-9]+", "_", value.lower()).strip("_") 

Then tries an ordered alias list:

ORDER_ALIASES = ( "order_id", "transaction_id", "charge_id", "payment_id", "reference", "invoice_id", "id", ) 

Exact aliases come first. Fuzzy suffix matches come second. If nothing matches, the tool stops with an error that prints the actual headers and tells the user which flag to use:

error: payout.csv: could not detect order and amount columns. Use --order-column/--amount-column. Headers: Ref, Gross, Fee, Currency 

This is a design principle I keep coming back to: automation should be helpful by default and explicit when uncertain. Guessing wrong on a finance file is worse than asking.

Decision 3: parse ambiguous data conservatively

Real CSVs contain values that are not valid numbers in any language:

  • $1,234.56
  • (45.00) for a negative amount
  • 12,50 (decimal comma)
  • an empty fee cell
  • N/A
  • a duplicated header row in the middle of the file

The parser handles common formats, but it does not turn garbage into zero. If a row has an unparseable amount, the row is skipped and the report records a warning. A missing value and a zero value are different facts.

The same applies to fees. If one side has no fee column, the tool does not compare a number to zero. It skips the fee comparison and says so. That one choice prevents a lot of false positives when reconciling a processor export against a bank statement.

Decision 4: deterministic output beats clever output

A report is a financial artifact. Running the same inputs twice should produce the same numbers and the same ordering.

That means:

  • sort IDs before writing
  • do not depend on dictionary insertion order for report rows
  • state the tolerance in the report
  • include source file names
  • include a UTC generation timestamp
  • avoid live FX lookups in the default path

The timestamp is the one intentionally non-deterministic field. Everything else should be stable. If a user diffing two reports sees a dozen changes, those changes should correspond to real data changes, not dictionary ordering.

Decision 5: the demo is a product feature

The most effective feature in the tool is --demo.

python reconcile.py --demo 

It writes two small CSV files, runs the full pipeline, and produces a report with a missing order, an amount mismatch, and a fee difference. In one command, a new user sees:

  • what input looks like
  • what output looks like
  • that the tool runs on their machine
  • how differences are classified

It also gives the maintainer a regression fixture. If column detection breaks, the demo output changes. If a refactor changes fee logic, the fixture reveals it.

Good CLIs do not start with a configuration manual. They start with a working example.

Decision 6: explicit exit codes

A finance script is often run from cron, a scheduler, or CI. The process exit code is part of the interface.

The tool uses:

  • 0 — report generated, no fatal error (differences may exist)
  • 1 — differences found, only when --fail-on-diff is passed
  • 2 — invalid input or configuration

This lets a scheduler distinguish “the job ran and found discrepancies” from “the job failed to run.” Conflating those two states makes automation noisy and unreliable.

Decision 7: generate artifacts, not just console output

A terminal summary is for the person who ran the command. It is not the deliverable.

The tool writes:

  • Markdown — readable by humans, diffable in git, pasteable into a ticket
  • CSV — one row per order, ready for Excel or a downstream job

The Markdown includes totals, issue counts, differences, clean matches, and warnings. The CSV is deliberately flat and stable. Both are named next to each other so the report can link to the data.

For the Pro version, I added a standalone HTML report with filter buttons, search, and summary cards. It is a single file with inline CSS and JavaScript. No server, no CDN, no telemetry. The same constraint applies: the artifact must work when opened from a downloads folder on a plane.

Decision 8: currency conversion is explicit, rate-based, and reproducible

Multi-currency reconciliation introduces a trap: comparing numeric amounts across currencies is meaningless.

The Pro tool converts every amount to a base currency using a rate table:

{ "base": "USD", "rates": {"USD": 1.0, "EUR": 1.08, "GBP": 1.27} } 

The convention is documented: rates are USD per one unit of currency. Missing rates produce warnings, not silent assumptions. The tool never fetches live rates. If a rate is unavailable, the conversion is skipped and the report says so.

This is slower than an API call and less “real-time.” It is also the only way to reproduce last month's close.

What I would test first

If you build a similar tool, write fixtures for these before adding features:

  1. UTF-8 BOM on the first header
  2. decimal comma vs thousands separator
  3. negative amounts in parentheses
  4. duplicate order IDs within one file
  5. one side missing a fee column
  6. a row with a valid ID but unparseable amount
  7. a currency with no rate
  8. an empty file and a file with no matching columns
  9. order IDs that differ only by case
  10. a tolerance of zero vs one cent

These are not exotic. They show up in real exports. Each one is a chance for the tool to fail loudly instead of producing a confident wrong number.

Distribution lessons

Shipping a small finance tool is not only a code problem.

  • The README is the product page. A developer decides in thirty seconds whether the tool handles their file. Show a command, an output snippet, and the exact columns it recognizes.
  • The free version must be genuinely useful. A crippled demo creates distrust. The free CLI does real reconciliation; the paid version adds FX, presets, HTML, and batch processing.
  • Package for the buyer, not the repo. A ZIP with the script, a demo, a rates file, and a short guide is easier to deliver than “clone this and read the source.”
  • State the limits. No live FX, no bank API, no refund matching. Clear limits make the tool more credible, not less.
  • Never ask for credentials. A CSV-only workflow is a security feature. Say that plainly.

The broader point

Zero dependencies is not about being clever. It is about matching the deployment environment and the trust model of finance work.

The standard library is capable of a lot: strict decimal arithmetic, streaming CSV parsing, path handling, argument parsing, JSON configuration, and HTML generation. A single well-structured file can be easier to audit, distribute, and maintain than a small framework.

The constraint forces decisions that are good for finance anyway: explicit types, visible failure modes, deterministic output, and artifacts that outlive the terminal session.

If you want to see the result, the free MIT-licensed CLI is on GitHub. The Pro Automation Kit adds the multi-currency, platform-preset, HTML, and batch features described above.

The same zero-dependency pattern now covers the rest of the month-end stack. Each tool runs locally, needs no account, and is a one-time purchase rather than another subscription:

Build the smallest tool that makes the monthly close reproducible. Then make it boring enough to trust.