Metadata-Version: 2.4
Name: bcpractice
Version: 0.3.0
Summary: CLI tool to generate AP BC Calculus practice problems using AI
Project-URL: Homepage, https://github.com/aaravjaichand/bcpractice
Project-URL: Repository, https://github.com/aaravjaichand/bcpractice
Author-email: Aarav Jaichand <aaravj413@gmail.com>
License: MIT
License-File: LICENSE
Keywords: ap,calculus,cli,education,pdf,practice
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Education
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Education
Requires-Python: >=3.10
Requires-Dist: anthropic>=0.116.0
Requires-Dist: claude-agent-sdk>=0.2.0
Requires-Dist: openai>=1.0.0
Requires-Dist: questionary>=2.0.0
Requires-Dist: rich>=13.0.0
Requires-Dist: typer>=0.9.0
Description-Content-Type: text/markdown

# 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](https://img.shields.io/pypi/v/bcpractice)](https://pypi.org/project/bcpractice/)
[![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/license-MIT-green)](LICENSE)

## 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](https://miktex.org/download) |

   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:
   - A Claude account (any paid plan) with [Claude Code](https://code.claude.com/docs/en/overview) installed. No API key needed.
   - An [Anthropic API key](https://platform.claude.com/settings/keys).
   - An [OpenAI API key](https://platform.openai.com/api-keys).

## Installation

### macOS and Linux

One command:

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

The script finds Python, installs [pipx](https://pipx.pypa.io/) 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:

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

### Windows

```bash
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:

```bash
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:

```bash
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

```bash
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:

```bash
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](LICENSE).

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