Skip to content
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

Refactor all constant imports to module-level access #2489

Merged
merged 5 commits into from
Aug 27, 2024

Conversation

WizKnight
Copy link
Contributor

This PR addresses issue #1172 by refactoring constant imports throughout the Hugging Face Hub codebase. It introduces module-level access (from ... import constants) for improved code organization and maintainability.

Key changes:

  • Introduced module-level import from . import constants in all relevant files.
  • Updated all references to constants to use the new module-level access pattern (e.g., constants.ENDPOINT).

@WizKnight
Copy link
Contributor Author

Hey @Wauplin, the required changes were done in this PR.

And there is a @patch issue with HUGGINGFACE_CO_URL_TEMPLATE import, while testing. This import is present in huggingface_hub/file_download.py and tests/test_file_download.py

@HuggingFaceDocBuilderDev

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.

@Wauplin
Copy link
Contributor

Wauplin commented Aug 27, 2024

And there is a @patch issue with HUGGINGFACE_CO_URL_TEMPLATE import, while testing. This import is present in huggingface_hub/file_download.py and tests/test_file_download.py

I fixed a last test that was failing locally in 67f9b68. Let's see if CI passes now :)

Copy link
Contributor

@Wauplin Wauplin left a comment

Choose a reason for hiding this comment

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

Thanks a lot for this work @WizKnight! Everything looks good to me now and will close #1172 for good :) Thanks again for the contribution 🤗

@Wauplin Wauplin merged commit 1462151 into huggingface:main Aug 27, 2024
16 of 17 checks passed
@WizKnight
Copy link
Contributor Author

Thankyou, @Wauplin🤗!!! I appreciate your guidance and patience throughout this process. I've learned a lot from you, especially about handling those little mistakes. I'm excited to take on new challenges and would be grateful if you could assign me another task.

@Wauplin
Copy link
Contributor

Wauplin commented Aug 29, 2024

Hi @WizKnight, glad you took out some learning in the process! Would you be interested in having a look at #2447 for example? It's about adding support for a new endpoint in HfApi. Let me know what you think and if you have any question :)

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.

3 participants