Skip to content

Add optional setup wizard for first-run onboarding#1475

Draft
NatalieNobile wants to merge 1 commit into
box:mainfrom
NatalieNobile:feat/setup-wizard
Draft

Add optional setup wizard for first-run onboarding#1475
NatalieNobile wants to merge 1 commit into
box:mainfrom
NatalieNobile:feat/setup-wizard

Conversation

@NatalieNobile

Copy link
Copy Markdown

Summary

Adds an opt-in setup wizard (./scripts/setup) and audit
(./scripts/doctor) that streamline first-time onboarding for
contributors and SDK consumers. The wizard verifies Python + pip,
optionally installs the SDK in editable mode, captures auth
credentials for any of the four supported modes, and prints a
copy-pasteable smoke-test snippet.

The wizard is fully opt-in. Existing manual-setup flows in the README
continue to work unchanged; users who prefer those are unaffected.

What's in the diff

Path What it is
dev_setup/ Python package — wizard, doctor, checks, config, prompts (~900 lines)
scripts/setup, scripts/doctor bash launchers — python3 -m dev_setup.wizard / .doctor
.env.example annotated template; the wizard writes .env (gitignored)
WIZARD_FLOWS.md decision tree (Mermaid) + step reference + recovery paths
.gitignore adds box-jwt-config.json, un-ignores .env.example
setup.py one-line change: find_packages(exclude=['docs', '*test*', 'dev_setup', 'dev_setup.*'])

The package is intentionally named dev_setup/ rather than setup/
to avoid colliding with the existing setup.py and to make
find_packages()'s discovery rules unambiguous. The one-line exclude
in setup.py keeps the developer-only wizard out of the pip
distribution.

box_sdk_gen/ is not modified. README, CONTRIBUTING, and docs/*
are untouched.

Wizard flow

3-step picker (recommended runs all):

  1. Python + dependencies preflightpython >= 3.8, pip --version, import box_sdk_gen. Offers pip install -e .[test,dev] with a progress watchdog if the SDK isn't importable.
  2. Auth credentials — inner picker for Developer Token / JWT / Client Credentials Grant / OAuth 2.0. Captures via getpass (no echo, no shell history); writes .env at the repo root with chmod 0600.
  3. Smoke test snippet — prints a 6-line Python program keyed to the chosen mode (uses BoxDeveloperTokenAuth, BoxJWTAuth, BoxCCGAuth, or BoxOAuth as appropriate).

Picker grammar: 1,3 / 1-3 / all / recommended / none / blank-for-default.

Pacing is tunable via WIZARD_PACE_MS (0 for CI, default 80 for interactive). Auto-disables when stdout isn't a TTY.

Test plan

  • python3 -m dev_setup.wizard and python3 -m dev_setup.doctor import cleanly
  • ./scripts/doctor on a fresh clone reports 5 OK / 1 WARN (no .env yet) / 0 FAIL
  • Picker accepts recommended, 1,2,3, 1-3, all, none, blank, and rejects junk gracefully
  • Walk through Developer Token mode end-to-end — .env is written, doctor flips to 6 OK / 0 WARN / 0 FAIL
  • Re-running ./scripts/setup is idempotent — prompts to keep or change existing BOX_AUTH_MODE
  • find_packages() exclude verified: python3 -c "from setuptools import find_packages; print(find_packages(exclude=['docs', '*test*', 'dev_setup', 'dev_setup.*']))" does not list dev_setup

Patterns / provenance

The wizard's design (paced output, picker-first, env injection,
doctor-symmetry, idempotence, progress watchdog, self-contained
credential capture) is captured as a reusable scaffold at
NatalieNobile/setup-wizard-squared,
with this PR's wizard mirrored as a worked example. The
box-java-sdk equivalent
is the sister PR using the same scaffold against a Java/Gradle repo.

Happy to iterate on naming, auth-mode coverage, or trim scope if
useful.

Adds an opt-in `./scripts/setup` wizard and `./scripts/doctor` audit
under a new `dev_setup/` Python package. The wizard streamlines
first-time onboarding without modifying SDK source files.

What the wizard does (3-step picker):

1. Python + dependencies preflight — verifies Python 3.8+, pip, and
   that `box_sdk_gen` is importable. Optionally runs
   `pip install -e .[test,dev]` (with a progress watchdog so the
   subprocess doesn't look hung).
2. Auth credentials — inner picker for Developer Token / JWT / CCG /
   OAuth, then captures the right credentials and writes them to
   `.env` at the repo root.
3. Smoke test snippet — prints a copy-pasteable Python program that
   authenticates and calls `client.users.get_user_me()`, keyed to the
   chosen auth mode.

Doctor is read-only and re-runs each step's check function.

What this adds:
- dev_setup/                   — Python package (5 modules, ~900 lines)
- scripts/setup, scripts/doctor — bash launchers
- .env.example                 — annotated template
- WIZARD_FLOWS.md              — decision tree + step reference

What this touches in existing code:
- setup.py: one-line change to `find_packages(exclude=...)` so the
  developer-only `dev_setup/` package isn't shipped via pip. The
  wizard package is named `dev_setup/` (rather than `setup/`)
  specifically to avoid colliding with `setup.py`.
- .gitignore: adds `box-jwt-config.json` and an `!.env.example`
  un-ignore so the example file ships.

What this does NOT touch:
- box_sdk_gen/                 — no SDK source changes
- existing docs                — README, CONTRIBUTING, docs/* unchanged

The wizard is fully opt-in. Existing flows continue to work; users who
prefer the README's manual setup steps are unaffected.

Patterns used (paced output, picker-first, env injection,
doctor-symmetry, idempotence, progress watchdog, self-containment) are
distilled in setup-wizard-squared:
https://github.com/NatalieNobile/setup-wizard-squared

Tested locally: doctor reports 6 OK / 0 WARN / 0 FAIL after a complete
developer-token round-trip. Picker grammar (1,3 / 1-3 / all /
recommended / none / blank) all parse correctly. Wizard is
idempotent — re-running prompts to keep or change existing values.

Co-authored-by: Cursor <cursoragent@cursor.com>
NatalieNobile added a commit to NatalieNobile/setup-wizard-squared that referenced this pull request Jun 10, 2026
The Python sibling to the box-java-sdk example. Same scaffold, same
picker grammar, same 4-mode auth picker (Developer Token / JWT / CCG
/ OAuth) — different ecosystem (Python/pip/.env instead of
Java/Gradle/.properties).

Together the two examples demonstrate the scaffold is genuinely
portable across language families: only step bodies and check
functions change between them.

What this commit adds:

- examples/box-python-sdk/ — full mirror of the customized wizard
  copied from the upstream draft PR fork. Includes dev_setup/
  (Python package), scripts/setup + scripts/doctor (bash launchers),
  WIZARD_FLOWS.md (Mermaid decision tree + step table), .env.example
  (annotated template), and a README.md explaining what was
  customized vs. lifted from the scaffold.
- README.md — adds the box-python-sdk row to the worked-examples
  table with a link to the upstream draft PR
  (box/box-python-sdk#1475) and a one-line note that the Java/Python
  pair shows portability.
- SKILL.md — same example registration in the Worked Examples
  section, plus a callout about the one ecosystem-specific
  concession (rename setup/ to dev_setup/ in Python repos to avoid
  setup.py / find_packages() collision).

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant