Easy EU region selection: ROBOFLOW_REGION, auth login --region, auth set-region - #513
Open
imbgar-roboflow wants to merge 1 commit into
Open
Easy EU region selection: ROBOFLOW_REGION, auth login --region, auth set-region#513imbgar-roboflow wants to merge 1 commit into
imbgar-roboflow wants to merge 1 commit into
Conversation
…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
Contributor
Author
|
CI note: the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
One switch points the SDK + CLI at the Roboflow EU data-residency platform (Linear INF-314). Three ways to set it:
Sibling PR for
inference-cli: roboflow/inference#2701.How it works
config.pygains a region registry (usdefault /eu) and runtime resolvers (get_effective_region(),resolve_url()). Per-URL precedence: explicit env var > explicit config-file key > region default > existing US default — soAPI_URL-style overrides (the staging escape hatch) keep working unchanged.api/app→api/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--regionflag 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 euvalidates the key against the EU API;auth status(text +--json) reports region and effective URLs; the hidden rootroboflow loginalias forwards--region.us(never raise at import).With no region set anywhere, every URL constant is byte-identical to today — guarded by a test.
Testing
python -m unittest), including 16 new ones: back-compat guard, precedence matrix, EU mapping, login persistence/merge (incl.--force), CLI paths, invalid-region handlingmake check_code_quality(ruff + mypy) cleanapp.roboflow.eu,--api-keypath validates againstapi.roboflow.eu, error behavior identical to USDocs
CLI-COMMANDS.md: region flag,set-region,ROBOFLOW_REGION, endpoint tableREADME.md: "Using Roboflow EU" section