huggingface.js icon indicating copy to clipboard operation
huggingface.js copied to clipboard

[hub] Export HUB_URL constant for consumers

Open Copilot opened this issue 9 months ago • 8 comments

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 avatar May 23 '25 17:05 Copilot

BIG SUCCESS

Pierrci avatar May 23 '25 17:05 Pierrci

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:

Copilot avatar May 23 '25 18:05 Copilot

so smooth

Pierrci avatar May 23 '25 18:05 Pierrci

so smooth

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

julien-c avatar May 23 '25 18:05 julien-c

@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!

Copilot avatar May 23 '25 18:05 Copilot

lmao

Pierrci avatar May 23 '25 18:05 Pierrci

@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!

Copilot avatar May 23 '25 18:05 Copilot

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.

Copilot avatar May 23 '25 18:05 Copilot