Skip to main content

CLI tool to generate AP BC Calculus practice problems using AI

Project description

bcpractice

A command line tool that generates AP Calculus BC practice problem sets as print-ready PDFs. You pick the units or topics, choose a length, and an AI model writes free-response problems in the style of the AP exam. The PDF is laid out like a real exam booklet: a cover page with AP-style directions, one question per page, and blank workspace under each part.

PyPI Python 3.10+ License: MIT

Requirements

  1. Python 3.10 or newer.

  2. A LaTeX distribution providing the pdflatex command. Without it, bcpractice can still generate a .tex file, but not a PDF.

    Platform Install command
    macOS brew install --cask mactex-no-gui
    Ubuntu/Debian sudo apt install texlive-latex-extra texlive-fonts-extra
    Windows MiKTeX

    The PDF uses the Times-like newtx fonts for the AP exam look (included in the installs above). If your LaTeX installation doesn't have them, bcpractice falls back to the standard LaTeX fonts automatically.

  3. One of the following, for problem generation:

Installation

macOS and Linux

One command:

curl -fsSL https://raw.githubusercontent.com/aaravjaichand/bcpractice/main/install.sh | bash

The script finds Python, installs pipx if needed (so the tool stays isolated from your system Python), and installs bcpractice. Re-running it updates an existing install to the latest version.

Prefer to run the steps yourself? The script is equivalent to:

brew install pipx        # macOS; on Linux: python -m pip install --user pipx
pipx ensurepath
pipx install bcpractice

Windows

python -m pip install --user pipx
python -m pipx ensurepath
pipx install bcpractice

Plain pip also works: pip install bcpractice. If the bcpractice command is not found after a pip install, run it as python -m bcpractice.

Setup

Run the interactive setup and follow the prompts:

bcpractice setup

You will be asked how to authenticate, then which model to use.

Option 1: Claude account (recommended)

Sign in once with your Claude account and bcpractice uses it directly. There is no API key to create or paste. Generation counts against your Claude plan usage.

  1. Install Claude Code if you do not have it: npm install -g @anthropic-ai/claude-code
  2. Sign in: claude /login
  3. Run bcpractice setup and choose "Claude account".

Setup verifies the sign-in with a small test request. If Claude Code is installed but not signed in, setup offers to launch the login for you.

Note: if the ANTHROPIC_API_KEY environment variable is set, the Claude Code runtime uses it instead of your account sign-in, and generation bills that key. Setup and bcpractice status warn you when this applies.

Option 2: API key

Choose "Anthropic API key" or "OpenAI API key" during setup and paste your key. The key is validated before it is saved, and stored in ~/.bcpractice/config.json with owner-only permissions.

Option 3: Environment variables

You can skip setup entirely by exporting a key:

export ANTHROPIC_API_KEY="sk-ant-..."
# or
export OPENAI_API_KEY="sk-..."

bcpractice infers the provider from whichever variable is set and uses that provider's default model.

Usage

bcpractice generate

The command walks you through topic selection (by unit or by individual topic) and set length, then generates the problems and compiles a PDF into the current directory.

Options:

bcpractice generate --length quick          # quick (5-8), medium (12-15), or full (20-25) problems
bcpractice generate --output ~/practice     # write the PDF somewhere else
bcpractice generate --model claude-opus-4-8 # override the configured model for one run

If pdflatex is missing, bcpractice tells you before any generation happens and offers to save a .tex file instead.

Commands

Command Description
bcpractice setup Configure authentication and model choice
bcpractice generate Generate a practice problem set
bcpractice topics List all available units and topics
bcpractice status Show provider, auth source, model, and pdflatex status
bcpractice update Update bcpractice to the latest released version
bcpractice reset Remove the saved configuration
bcpractice --version Print the installed version

Configuration

Settings live in ~/.bcpractice/config.json, created with permissions 600 (owner read and write only). It stores the provider, the chosen model, and, for the API key options, the key itself. The Claude account option stores no credentials; authentication is handled by Claude Code.

Topic coverage

The full AP Calculus BC curriculum from the College Board Course and Exam Description, 111 topics across 10 units.

Unit Name Topics
1 Limits and Continuity 16
2 Differentiation: Definition and Fundamental Properties 10
3 Differentiation: Composite, Implicit, and Inverse Functions 6
4 Contextual Applications of Differentiation 7
5 Analytical Applications of Differentiation 12
6 Integration and Accumulation of Change 14
7 Differential Equations 9
8 Applications of Integration 13
9 Parametric, Polar, and Vector Functions 9
10 Infinite Sequences and Series 15

Topics marked [BC] in bcpractice topics are exclusive to Calculus BC and not covered in AB.

Troubleshooting

"pdflatex was not found": install a LaTeX distribution (see Requirements). On macOS, MacTeX installs into /Library/TeX/texbin; open a new terminal after installing so the PATH change takes effect.

"Claude Code is not signed in": run claude /login and complete the browser sign-in, then retry. bcpractice status shows the current authentication state.

Generation bills my API key instead of my Claude plan: unset ANTHROPIC_API_KEY in your shell. The Claude Code runtime prefers an API key from the environment over your account sign-in.

"usage limit has been reached": your Claude plan's usage window is exhausted. Wait for it to reset, or switch to an API key with bcpractice setup.

"rejected your API key": the stored key is invalid or expired. Run bcpractice setup again with a fresh key.

bcpractice: command not found after pip install: your Python scripts directory is not on PATH. Use python -m bcpractice, or install with pipx instead.

License

MIT. See LICENSE.

Curriculum structure follows the College Board AP Calculus BC Course and Exam Description. Problem styling is inspired by the practice materials at FlippedMath.

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

bcpractice-0.3.0.tar.gz (30.8 kB view details)

Uploaded Source

Built Distribution

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

bcpractice-0.3.0-py3-none-any.whl (32.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for bcpractice-0.3.0.tar.gz
Algorithm Hash digest
SHA256 73e2f87b56895c862713c459791c981ca8c99d737c1850c64186ba172be7ce55
MD5 092e7b6221e6501ec303b3ae8dc2ac02
BLAKE2b-256 fb55b48e2dce66d79f83204282b753e42afdfe5705b2d369105fd98a07bfe55f

See more details on using hashes here.

Provenance

The following attestation bundles were made for bcpractice-0.3.0.tar.gz:

Publisher: publish.yml on aaravjaichand/bcpractice

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

File details

Details for the file bcpractice-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: bcpractice-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 32.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for bcpractice-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0411d42ba07c2c632ca4c95d1a7f2a8292613eb5d1fa9b1147c2d93b70ef88cb
MD5 e6d8a2cd834066f3d5b5ca8b87378e14
BLAKE2b-256 ad7dc538327ee4fffbee0ab7564429e546fa550c70e11f0a05b574ba7ff642ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for bcpractice-0.3.0-py3-none-any.whl:

Publisher: publish.yml on aaravjaichand/bcpractice

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