Skip to content

Easy EU region selection: ROBOFLOW_REGION, auth login --region, auth set-region - #513

Open
imbgar-roboflow wants to merge 1 commit into
mainfrom
brandongarcia/inf-314-cli-eu-region
Open

Easy EU region selection: ROBOFLOW_REGION, auth login --region, auth set-region#513
imbgar-roboflow wants to merge 1 commit into
mainfrom
brandongarcia/inf-314-cli-eu-region

Conversation

@imbgar-roboflow

Copy link
Copy Markdown
Contributor

Description

One switch points the SDK + CLI at the Roboflow EU data-residency platform (Linear INF-314). Three ways to set it:

roboflow auth login --region eu    # browser auth flow opens/validates against https://app.roboflow.eu/auth-cli
roboflow auth set-region eu        # persistent config setting, shown in 'roboflow auth status'
ROBOFLOW_REGION=eu ...             # env var, for CI/scripts

Sibling PR for inference-cli: roboflow/inference#2701.

How it works

  • config.py gains a region registry (us default / eu) and runtime resolvers (get_effective_region(), resolve_url()). Per-URL precedence: explicit env var > explicit config-file key > region default > existing US default — so API_URL-style overrides (the staging escape hatch) keep working unchanged.
  • EU map (all verified live): api/appapi/app.roboflow.eu, detection + instance-seg → serverless.roboflow.eu, dedicated deployments → eu.roboflow.cloud. Universe and semantic-seg stay on global .com — no EU instance exists.
  • login() resolves the app host at call time (an import-time constant can't see a --region flag passed in the same process) and now merges the prior config on forced re-login instead of clobbering it, so region + URL overrides survive.
  • auth login --api-key --region eu validates the key against the EU API; auth status (text + --json) reports region and effective URLs; the hidden root roboflow login alias forwards --region.
  • Unknown region values warn on stderr and fall back to us (never raise at import).

With no region set anywhere, every URL constant is byte-identical to today — guarded by a test.

Testing

  • 937 tests green (python -m unittest), including 16 new ones: back-compat guard, precedence matrix, EU mapping, login persistence/merge (incl. --force), CLI paths, invalid-region handling
  • make check_code_quality (ruff + mypy) clean
  • Live smoke against real EU endpoints: interactive login prints/validates against app.roboflow.eu, --api-key path validates against api.roboflow.eu, error behavior identical to US

Docs

  • CLI-COMMANDS.md: region flag, set-region, ROBOFLOW_REGION, endpoint table
  • README.md: "Using Roboflow EU" section

…egion, auth set-region

One switch selects the Roboflow platform region (us default, eu):
resolved env var > config file > region default > existing US default,
so explicit API_URL/APP_URL-style overrides keep working unchanged.

- config.py: region registry + runtime resolve_url()/get_effective_region();
  EU maps api/app to api,app.roboflow.eu, detection/instance-seg to
  serverless.roboflow.eu, dedicated deployments to eu.roboflow.cloud.
  Universe and semantic-seg stay global .com (no EU instance today).
- login(): browser auth flow prints and validates the token against the
  region's app host at call time; forced re-login now merges the prior
  config instead of clobbering it (preserves region + URL overrides).
- CLI: auth login --region {us,eu} (interactive + --api-key paths),
  auth set-region, region + effective URLs in auth status (text/JSON),
  root login alias forwards --region.
- Docs: CLI-COMMANDS.md region section, README 'Using Roboflow EU'.
- Tests: back-compat guard (no region = byte-identical US defaults),
  precedence matrix, EU map, login persistence/merge, CLI paths.

INF-314
@imbgar-roboflow

Copy link
Copy Markdown
Contributor Author

CI note: the check_code_quality failures here are unrelated to this diff — ruff 0.16.0 (released today) stabilized the CPY copyright rules, which select = ["ALL"] + unpinned CI ruff now enforce repo-wide. Main is red with the same 72 CPY001 errors. One-line fix in #514; will rebase/rerun once that merges.

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