Skip to main content

A world-class Python CLI template powered by Typer and rich.

Project description

World-Class Python CLI Template

This repository is a state-of-the-art starting point for building Python Command Line Interfaces (CLIs). It's optimized for both human developers and the Antigravity AI pair-programming agent.

Core Technologies

  • Framework: Typer with Rich
  • Packaging: Standard pyproject.toml (PEP 621) using hatchling
  • Linting & Formatting: Ruff
  • Type Checking: Mypy
  • Testing: Pytest
  • Git Hooks: pre-commit

Antigravity (AI) Integration

This repository is configured out-of-the-box with .gemini/rules.md. These rules instruct Antigravity automatically on architectural patterns (like enforcing standard Typer usage over other frameworks and maintaining ruff standards). See .gemini/mcp_instructions.md for tips on how to push the AI even further using MCP tools like sequential-thinking.

How to Work on this project

  1. Install tools and dependencies: We highly recommend using uv or creating a virtual environment first.
# Using standard pip in a venv
pip install -e ".[dev]"
  1. Setup Git hooks:
make setup
  1. Useful Commands:
  • make format: Auto-fix linting issues and auto-format code using Ruff.
  • make lint: Run strict Ruff and Mypy checks.
  • make test: Run pytest suite.
  • make check: Run format, lint, and tests all at once.

Database Configuration

Before running commands that require a database connection (like the dashboard), you need to set up your environment variables.

In PowerShell, you can set them for your current session like this:

$env:DB_NAME="fractanomicsdb"
$env:DB_USER="postgres"
$env:DB_PASS="postgres"
$env:DB_HOST="localhost"
$env:DB_PORT="5433"

Verify your environment

Run the setup command to check everything in one pass — required environment variables, the database connection and schema, IBKR connectivity, and the external tools the app needs (a local PostgreSQL server, the IBKR Gateway/TWS client, Python dependencies):

tradingtools-stock setup            # report what is configured vs. missing
tradingtools-stock setup --install  # additionally provision missing pieces

setup exits non-zero if any required check fails and prints how to fix each one. --install (a.k.a. --fix) is opt-in and never runs silently — it can create the database and tables and, where a package manager is available, install a local PostgreSQL server.

IBKR Portfolio (IB Gateway)

The dashboard's IBKR Portfolio tab reads your live account (positions, P&L, account summary) through the TWS API. One-time setup:

  1. Install IB Gateway (stable) from https://www.interactivebrokers.com/en/trading/ibgateway-stable.php (default install location C:\Jts is auto-detected; otherwise set IB_GATEWAY_PATH).
  2. Log in and enable the API: Configure > Settings > API > Settings > check Enable ActiveX and Socket Clients. Note the socket port.

Connection settings (defaults shown):

$env:IB_HOST="127.0.0.1"
$env:IB_PORT="4002"        # IB Gateway paper; 4001 live, 7497 TWS paper, 7496 TWS live
$env:IB_CLIENT_ID="11"

Daily usage:

tradingtools-stock ibkr gateway          # start IB Gateway (log in within its window)
tradingtools-stock ibkr status           # verify the API connection
tradingtools-stock dashboard start -g    # start dashboard + IB Gateway together

Try the CLI locally

Once installed, you can invoke the CLI from anywhere in your terminal!

tradingtools-stock --help
tradingtools-stock example hello World

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

stock_manager_cli-0.14.0.tar.gz (71.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stock_manager_cli-0.14.0-py3-none-any.whl (70.4 kB view details)

Uploaded Python 3

File details

Details for the file stock_manager_cli-0.14.0.tar.gz.

File metadata

  • Download URL: stock_manager_cli-0.14.0.tar.gz
  • Upload date:
  • Size: 71.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for stock_manager_cli-0.14.0.tar.gz
Algorithm Hash digest
SHA256 031c80aab04e9f7f4ede37c71172da87ae028695d27ec853f5928cc756558e28
MD5 9b62516fc9bac8a1529b3c94280572d8
BLAKE2b-256 0014315006f58fc33ed13efe707594ee7a54249f80f126b869ac8c31472fb76f

See more details on using hashes here.

Provenance

The following attestation bundles were made for stock_manager_cli-0.14.0.tar.gz:

Publisher: publish.yml on AntaresAndBharani/stock-manager-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stock_manager_cli-0.14.0-py3-none-any.whl.

File metadata

File hashes

Hashes for stock_manager_cli-0.14.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1e8a5f1db6f70e6946917e99829f654243f63dc4388eebdf5b348bdb1c34dee8
MD5 1ff30acd92f6066521c3b8f24cec3aac
BLAKE2b-256 8ca57dbb25858ab820482607bc60ca542fe5cf440c37c92ee47e772216564346

See more details on using hashes here.

Provenance

The following attestation bundles were made for stock_manager_cli-0.14.0-py3-none-any.whl:

Publisher: publish.yml on AntaresAndBharani/stock-manager-cli

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