chore: rebrand examples from javelin_sdk to highflame#253
Conversation
Sweeps all Python and notebook files under examples/ to use the v2 SDK
references documented in the README migration guide:
- Imports: javelin_sdk / highflame_sdk -> highflame
- Class names: JavelinClient -> Highflame, JavelinConfig -> Config,
JavelinClientError -> ClientError
- Kwargs in Config(): javelin_api_key -> api_key,
javelin_virtualapikey -> virtual_api_key
- Local variable / function names: javelin_X -> highflame_X
(renamed to avoid shadowing the new kwarg names)
- Default base URL: api-dev.javelin.live -> api.highflame.app
- Branding prose in comments, print strings, and notebook markdown
Preserved (intentionally):
- os.getenv("HIGHFLAME_X") or os.getenv("JAVELIN_X") fallback chains —
documented v1 compatibility shim
- x-javelin-* / X-Javelin-* HTTP header names — documented backward-compat
headers
- swagger/sync_models.py "JavelinConfig" string — load-bearing pending
backend rename (separate ticket)
- README.md / CLAUDE.md — intentional migration docs
- .js files — separate JavaScript SDK
- javelinpreview.openai.azure.com / javelin-guardrails.fastmcp.app —
actual hosted resources
- Cached notebook outputs (pip install logs, INFO:httpx traces) —
historical execution artifacts
Verification:
- All 60+ modified .py files parse cleanly via ast.
- All 8 notebooks remain valid JSON.
- No undefined-name resolution issues across modified files.
- flake8 F841 / F821 clean.
Closes highflame-ai#242.
There was a problem hiding this comment.
Code Review
This pull request performs a comprehensive renaming of 'Javelin' to 'Highflame' across various example scripts and notebooks. The review identified several critical NameError bugs where variables were renamed in assignments but not in corresponding conditional checks, which would cause runtime failures. These issues must be addressed to ensure the code functions correctly.
PR highflame-ai#253 review flagged 4 notebook cells where `api_key = ...` was the assignment but later references used `highflame_api_key` (NameError at runtime). A broader scan found 17 affected cells across 8 notebooks — the bot caught a representative sample. Root cause: the migration script's kwarg rule `(?<=[,(\s])javelin_api_key(?=\s*=)` matched module/cell-level assignments because the lookbehind sees whitespace (including line start) before the identifier. So javelin_api_key on an assignment got rewritten to api_key (intended only for kwargs), while later bare uses got rewritten to highflame_api_key. Inconsistent. Fix: rename leading-indented `api_key =` / `virtual_api_key =` assignments in code cells back to `highflame_api_key =` / `highflame_virtualapikey =` — only in cells that reference the highflame_* name, so we don't touch cells where api_key is a legitimate local variable (e.g. OpenAI's own api_key kwarg). Plus two special cases: - azure-openai/openai_azureopenai_testing.ipynb cell 12 had no highflame_api_key definition at all (pre-existing latent bug exposed by rebrand). Added one. - rag/rag_implemetation_highflame.ipynb cell 7 needed a top-level rename (not just indented) since the definition was at module level within the cell. Verification: - Per-cell AST scan: all references to highflame_api_key / highflame_virtualapikey resolve to a definition somewhere in the notebook (cross-cell scope model, mirroring jupyter execution). - All 60+ .py files parse cleanly; flake8 F841/F821 still clean.
|
Addressed all 4 review comments in 00c135f, plus 13 additional cells the bot didn't flag. Bot's findings (4 cells): all of the shape "cell defines Root cause: the rebrand script's kwarg rule Broader scan: I wrote a cross-cell AST name-resolution check Fix: for each affected cell, rename leading-indented Special cases handled:
Verification:
|
Summary
Mechanical rebrand sweep across all
examples/files to use the v2 SDK surface documented in the README's migration guide. 49 files, 475 insertions / 475 deletions — pure rename, no behavior change.Closes #242.
What's renamed
javelin_sdk/highflame_sdk→highflameJavelinClient→Highflame,JavelinConfig→Config,JavelinClientError→ClientErrorConfig(...):javelin_api_key→api_key,javelin_virtualapikey→virtual_api_keyjavelin_X→highflame_X(renamed to avoid shadowing the new kwarg names; e.g. localjavelin_api_keybecomeshighflame_api_keyso the call site readsConfig(api_key=highflame_api_key))api-dev.javelin.live→api.highflame.appWhat's preserved (intentionally)
os.getenv("HIGHFLAME_X") or os.getenv("JAVELIN_X")— these are the documented v1 transition path.x-javelin-*/X-Javelin-*HTTP header names — documented backward-compat headers (dual-emission lives at the SDK transport layer).swagger/sync_models.py's"JavelinConfig"string — load-bearing for backend Swagger sync until the Go-side rename lands (tracked in README's "Backend Changes Required" section).README.md/CLAUDE.md— intentional migration documentation..jsfiles underexamples/— separate JavaScript SDK rebrand, out of scope.javelinpreview.openai.azure.comandjavelin-guardrails.fastmcp.app— real DNS entries, not refactor targets.Type of change
Testing
.pyfiles parse cleanly viaast.parse.highflame_api_key,highflame_virtualapikey,javelin_*residuals).flake8 examples/ --select=F841,F821clean (no unused/undefined locals).Methodology
Two-pass deterministic substitution script (regex with word-boundary anchors) plus a few hand-curated last-mile fixes for cases the script's lookbehind couldn't disambiguate (e.g. function-local
api_key = os.getenv(...)vsjavelin_api_key = ...shadowing). The script itself is not committed — it's a one-shot tool.Risks
examples/are untouched and still carryJAVELIN_*env-var references. These belong to the JavaScript SDK and should rebrand in lockstep with that repo.