Dependencies for Running financial_rigor.py in AI-Berkshire: Zero External Packages Required

The financial_rigor.py script requires only Python 3.7 or higher and exclusively uses standard library modules, meaning no external packages need to be installed.

The financial_rigor.py script is a stand-alone command-line utility located in the tools/ directory of the xbtlin/ai-berkshire repository. Designed to validate financial numbers through rigorous arithmetic checks, it deliberately avoids third-party dependencies to ensure execution in constrained environments like CI runners and Docker containers without pip or virtual-environment management.

Python Version Requirements

The script requires Python 3.7 or higher. While the code utilizes f-strings and type hints introduced in Python 3.6, version 3.7 ensures reliable operation of the decimal module's context for exact arithmetic. This version dependency supports the precise financial calculations performed by the tool's validation algorithms.

Standard Library Modules Used

As explicitly documented in the header comments at lines 7-9 of tools/financial_rigor.py, the script maintains "Zero external dependencies — uses only Python stdlib". The specific imports declared at lines 18-22 include:

  • argparse – Parses sub-commands and command-line options
  • json – Decodes JSON strings supplied via CLI arguments
  • math – Provides logarithm functions for Benford's Law analysis
  • sys – Handles the entry point through if __name__ == "__main__":
  • decimal – Supplies Decimal, Context, and rounding constants for exact financial arithmetic

Running the Script Without Installation

Because all dependencies are satisfied by the Python standard library, the script executes immediately without pip install. Run it directly from the repository root:

python3 tools/financial_rigor.py <sub-command> [options]

The following examples demonstrate core functionality that works in any standard Python environment:

Verify market capitalization calculations against reported values:

python3 tools/financial_rigor.py verify-market-cap --price 510 --shares 9.11e9 --reported 4.65e12 --currency HKD

Calculate valuation ratios using exact decimal arithmetic:

python3 tools/financial_rigor.py verify-valuation --price 510 --eps 23.5 --bvps 120

Cross-validate financial data from multiple sources:

python3 tools/financial_rigor.py cross-validate --field revenue --values '{"AnnualReport":7518,"Yahoo":7500}' --unit 亿

Perform Benford's Law analysis on numerical datasets:

python3 tools/financial_rigor.py benford --values '[1234, 2345, 3456, ...]'

Evaluate arithmetic expressions without floating-point error:

python3 tools/financial_rigor.py calc --expr '510 * 9.11e9'

Generate three-scenario valuation targets:

python3 tools/financial_rigor.py three-scenario --price 510 --eps 23.5 --shares 9.11 --growth 0.15 0.08 0.0 --pe 25 20 15

Summary

  • Python 3.7+ is the sole runtime requirement for executing financial_rigor.py
  • The script imports exclusively from the Python standard library: argparse, json, math, sys, and decimal
  • No external dependencies are required, as confirmed by the header documentation at lines 7-9 in tools/financial_rigor.py
  • The zero-dependency architecture supports automated workflows in constrained environments where pip is unavailable
  • Located at tools/financial_rigor.py in the xbtlin/ai-berkshire repository, the script validates market caps, valuation ratios, and cross-source financial data

Frequently Asked Questions

What Python version is required for financial_rigor.py?

The script requires Python 3.7 or higher. While Python 3.6 supports the f-strings and type hints used in the code, version 3.7 ensures reliable Decimal context handling for exact financial arithmetic, which is critical for the script's validation accuracy.

Does financial_rigor.py require pip install?

No. According to the source code in xbtlin/ai-berkshire, the script uses only standard library modules. The import section at lines 18-22 confirms dependencies on argparse, json, math, sys, and decimal only, allowing immediate execution with python3 tools/financial_rigor.py without any package installation.

Which standard library modules does financial_rigor.py use?

The script imports five standard library modules: argparse for CLI parsing, json for data decoding, math for logarithmic calculations in Benford's Law tests, sys for entry-point handling, and decimal for exact arithmetic. These imports are located at lines 18-22 of tools/financial_rigor.py.

Why does the script avoid external dependencies?

The zero-dependency design is intentional to support integration with Claude Code skills and automated workflows. By relying solely on the Python standard library, the tool executes reliably in CI/CD pipelines, Docker containers, and other restricted environments without requiring dependency resolution or virtual environment management.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →