Skip to content

[Bucket/Repo] Support 'region' option in create_bucket and create_repo#4194

Merged
Wauplin merged 7 commits into
mainfrom
add-region-to-create-bucket
May 7, 2026
Merged

[Bucket/Repo] Support 'region' option in create_bucket and create_repo#4194
Wauplin merged 7 commits into
mainfrom
add-region-to-create-bucket

Conversation

@Wauplin

@Wauplin Wauplin commented May 6, 2026

Copy link
Copy Markdown
Collaborator

PR (almost) entirely made using Moon-IDE + Inference Providers + https://huggingface.co/Qwen/Qwen3.5-397B-A17B (Scaleway). cc @coyotte508

(made 36 requests for a cost of 2,42$ 😬)

Uploaded the Coder trace to https://huggingface.co/buckets/Wauplin/moon-ide-traces/tree/sess-1778056134318-f8763a11.jsonl but it's not recognized by the Hub.


Follow-up PR after server-side update (private - https://github.com/huggingface-internal/moon-landing/pull/18059) cc @alexpouliquen .

This PR adds a region parameter to the create_bucket method and CLI command, allowing users to specify the cloud region when creating a bucket.

  • Add region: Literal["us", "eu"] | None parameter to HfApi.create_bucket()
  • Add --region option to hf buckets create command
  • Update examples + docs

Usage

Python:

>>> create_bucket("my-bucket", region="us")

CLI:

$ hf buckets create my-bucket --region us

Note

Medium Risk
Adds a new user-facing region parameter/flag that alters create_repo/create_bucket request payloads; risk is mainly around backend compatibility and validation of supported regions.

Overview
Adds support for creating repos and buckets in a specific cloud region.

HfApi.create_repo and HfApi.create_bucket now accept an optional region ("us"/"eu") and include it in the creation payload when provided; the hf repos create and hf buckets create CLI commands expose this via a new --region option and update examples/help text.

Documentation and CLI reference pages are updated with new region usage examples, and CLI tests are adjusted to expect region=None in create_repo calls.

Reviewed by Cursor Bugbot for commit 272e907. Bugbot is set up for automated code reviews on this repo. Configure here.

- Add region parameter to HfApi.create_bucket() method
- Add --region option to hf buckets create CLI command
- region accepts 'us' or 'eu' values (Literal type, no runtime validation)
- Update documentation in buckets guide and CLI reference
@Wauplin Wauplin changed the title feat: add region option to create_bucket [Bucket] Support 'region' option in create_bucket May 6, 2026
@bot-ci-comment

bot-ci-comment Bot commented May 6, 2026

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@Pierrci

Pierrci commented May 6, 2026

Copy link
Copy Markdown
Member

nice! do you think it would also make sense to support that for git repos? (server-side we shipped it in a separate PR: https://github.com/huggingface-internal/moon-landing/pull/17957)

@Wauplin

Wauplin commented May 6, 2026

Copy link
Copy Markdown
Collaborator Author

nice! do you think it would also make sense to support that for git repos? (server-side we shipped it in a separate PR: huggingface-internal/moon-landing#17957)

ah yes definitely, haven't seen that one

Co-authored-by: Lucain <Wauplin@users.noreply.github.com>
@cursor cursor Bot changed the title [Bucket] Support 'region' option in create_bucket [Bucket/Repo] Support 'region' option in create_bucket and create_repo May 6, 2026

@Wauplin Wauplin left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

(added support both both buckets and repos)

Co-authored-by: Lucain <Wauplin@users.noreply.github.com>

@Pierrci Pierrci left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, thanks!

Comment thread docs/source/en/package_reference/cli.md Outdated
**Options**:

* `--private`: Create a private bucket.
* `--region [us|eu]`: Cloud region in which to create the bucket. Can be one of 'us' or 'eu'.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* `--region [us|eu]`: Cloud region in which to create the bucket. Can be one of 'us' or 'eu'.
* `--region [us|eu]`: Cloud region in which to create the bucket (requires Team plan or above). Can be one of 'us' or 'eu'.

(maybe, as you prefer - same elsewhere?)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes good idea, updated all docstrings in d2264ab

@Wauplin Wauplin merged commit 680c5a8 into main May 7, 2026
21 checks passed
@Wauplin Wauplin deleted the add-region-to-create-bucket branch May 7, 2026 08:22
@huggingface-hub-bot

Copy link
Copy Markdown
Contributor

This PR has been shipped as part of the v1.15.0 release.

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.

4 participants