A real, end-to-end application of the setup-wizard-squared scaffold
to the Box Python SDK v10.
This is the Python sibling to the box-java-sdk
example — same scaffold, same picker grammar, same
auth-mode coverage, different ecosystem.
Upstream draft PR: box/box-python-sdk#1475
- The same 7 patterns (paced output, picker-first, env injection,
doctor-symmetry, idempotence, progress watchdog, self-contained
credential capture) ported from
bq_rangerproduce a wizard that fits a totally different language ecosystem (Python / pip / setup.py) without scaffold changes. - A 3-step picker (preflight, auth credentials, smoke snippet) is
enough scope for an SDK setup wizard. Same step count as
box-java-sdk. - The same 4-way auth-mode picker (Developer Token / JWT / CCG /
OAuth) works across ecosystems — only the credential storage format
(
.envvs Java.properties) and snippet language differ.
| Path | Source | What changed |
|---|---|---|
dev_setup/prompts.py |
scaffold (verbatim) | none — generic TTY primitives |
dev_setup/config.py |
scaffold (customized) | PROJECT_NAME, BOX_ENV_FILE, MIN_PYTHON, auth-mode constants |
dev_setup/checks.py |
scaffold (replaced example) | check_python, check_pip, check_sdk_importable, check_box_env, check_developer_token, check_jwt_config |
dev_setup/wizard.py |
scaffold (replaced steps) | 3 real steps: preflight (with optional pip install -e .[test,dev]), auth-credentials picker, smoke-test snippet |
dev_setup/doctor.py |
scaffold (registered checks) | DOCTOR_CHECKS list points at the 6 real checks |
scripts/setup, scripts/doctor |
scaffold (verbatim) | bash launchers (python3 -m dev_setup.wizard etc.) |
WIZARD_FLOWS.md |
template (filled in) | Mermaid decision tree, step table, recovery paths, auth-mode table |
.env.example |
new | annotated template the user copies / replaces with ./scripts/setup |
Python's setup.py lives at the repo root and setuptools.find_packages()
walks the source tree looking for anything with __init__.py. Naming
the wizard package setup/ would create two ambiguities:
- Import resolution between the script
setup.pyand a packagesetup/is environment-specific. find_packages()would happily ship the wizard as a top-level package calledsetupwhen a user runspip install boxsdk.
Renaming to dev_setup/ removes both ambiguities. A one-line addition
to setup.py (exclude=['docs', '*test*', 'dev_setup', 'dev_setup.*'])
keeps the package out of the pip distribution belt-and-braces.
This is the only scaffold concession to Python's ecosystem; everything else carries over unchanged.
- Paced output —
WIZARD_PACE_MSenv var (0for CI / scripted onboarding, default80). - Picker-first — top-level 3-step picker accepts
1,3/1-3/all/recommended/none/ blank. Auth-mode step has its own inner 4-way picker. - Env injection —
_run_interactive(env=...)lets the wizard layer.envvalues onto the subprocess environment before invokingpipetc. (also used in step 1's editable install). - Doctor-symmetry — every step has a check function in
checks.pythe doctor calls. Re-running./scripts/doctorafter the wizard shows everything in one shot. - Idempotence — re-running the wizard with an existing
.envprompts to keep or change the auth mode rather than wiping it. - Progress watchdog —
pip install -e .[test,dev]is wrapped so the user seescurrent action: installing SDK in editable mode (pip)if it runs longer than 5s. - Self-contained — the wizard reads
.envitself when computing the smoke snippet and the doctor's mode-specific checks. Users never need to "first source X".
git clone https://github.com/NatalieNobile/box-python-sdk.git -b feat/setup-wizard
cd box-python-sdk
./scripts/setup # 3-step picker
./scripts/doctor # read-only audit afterwardsThe branch on the fork is what was opened as the upstream draft PR.
This example was synthesized from bq_ranger's setup wizard and the
setup-wizard-squared scaffold. Patterns and design
rationale live in reference/patterns.md.