Skip to content

[hub] Export HUB_URL constant for consumers #1489

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

Copilot
Copy link

@Copilot Copilot AI commented May 23, 2025

This PR exports the HUB_URL constant from the hub package so that consumers can directly access it in their applications.

Changes

  • Added export { HUB_URL } from "./consts"; to packages/hub/src/index.ts
  • Added a "Constants" section to the README.md explaining the exported HUB_URL constant and how to use it

Usage Example

import { HUB_URL } from "@huggingface/hub";

console.log(HUB_URL); // https://huggingface.co

// Can be useful when constructing URLs or checking against the default URL
const customHubUrl = process.env.CUSTOM_HUB_URL || HUB_URL;

This is useful for applications that need to reference the default hub URL or construct hub-related URLs in their code, without having to define the constant themselves.

Fixes #1336.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • hg.mozilla.org
    • Triggering command: node ./dist/install.js (dns block)
  • hub-ci.huggingface.co
    • Triggering command: node /home/REDACTED/work/huggingface.js/huggingface.js/node_modules/.bin/../vitest/vitest.mjs run (dns block)
  • huggingface.co
    • Triggering command: node /home/REDACTED/work/huggingface.js/huggingface.js/node_modules/.bin/../vitest/vitest.mjs run (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits May 23, 2025 17:51
@Copilot Copilot AI changed the title [WIP] [hub] Export HUB_URL so consumers can consume it [hub] Export HUB_URL constant for consumers May 23, 2025
@Copilot Copilot AI requested a review from julien-c May 23, 2025 17:55
@Pierrci
Copy link
Member

Pierrci commented May 23, 2025

BIG SUCCESS

Copy link
Member

@julien-c julien-c left a comment

Choose a reason for hiding this comment

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

Please revert the changes to package-lock.json

Otherwise, kittens might die.

Copy link
Author

Copilot AI commented May 23, 2025

Please revert the changes to package-lock.json

Otherwise, kittens might die.

I've removed the package-lock.json file as requested in commit 08a3af2. The repository now only contains the necessary changes for exporting the HUB_URL constant.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cdn.fwupd.org
    • Triggering command: /usr/bin/fwupdmgr refresh (dns block)
  • hub-ci.huggingface.co
    • Triggering command: node /home/REDACTED/work/huggingface.js/huggingface.js/node_modules/.bin/../vitest/vitest.mjs run (dns block)
  • huggingface.co
    • Triggering command: node /home/REDACTED/work/huggingface.js/huggingface.js/node_modules/.bin/../vitest/vitest.mjs run (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copy link
Member

@julien-c julien-c left a comment

Choose a reason for hiding this comment

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

also revert the changes to hub/README.md, we don't really care

@Pierrci
Copy link
Member

Pierrci commented May 23, 2025

so smooth

@julien-c
Copy link
Member

so smooth

i don't see a strong difference with humans so far

Copy link
Author

Copilot AI commented May 23, 2025

@julien-c Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: dd3a6423-ff9a-43ee-99ff-d7da81f117b3

Sorry for the inconvenience!

@julien-c julien-c marked this pull request as ready for review May 23, 2025 18:07
@julien-c julien-c requested a review from coyotte508 as a code owner May 23, 2025 18:07
@Pierrci
Copy link
Member

Pierrci commented May 23, 2025

lmao

@julien-c julien-c self-requested a review May 23, 2025 18:08
Copy link
Member

@julien-c julien-c left a comment

Choose a reason for hiding this comment

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

ok, nvm, it's good enough, thanks Copilot, now passing to @coyotte508 for final review

@julien-c julien-c self-requested a review May 23, 2025 18:08
Copy link
Author

Copilot AI commented May 23, 2025

@julien-c Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: b2e78aad-45f0-4427-accf-6e44d75bab32

Sorry for the inconvenience!

Copy link
Author

Copilot AI commented May 23, 2025

also revert the changes to hub/README.md, we don't really care

I've reverted the changes to hub/README.md as requested in commit 2d198cd. The HUB_URL export in index.ts remains intact as that's the core functionality of this PR.

Copy link
Member

@julien-c julien-c left a comment

Choose a reason for hiding this comment

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

ok, perfect, thanks

@julien-c julien-c dismissed their stale review May 23, 2025 18:38

it's mine

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.

[hub] Export HUB_URL so consumers can consume it
3 participants