huggingface / huggingface_hub

The official Python client for the Huggingface Hub.
https://huggingface.co/docs/huggingface_hub
Apache License 2.0
2.02k stars 531 forks source link

Update `constants` import to use module-level access #1172 #2453

Closed WizKnight closed 1 month ago

WizKnight commented 1 month ago

This PR addresses issue #1172 by updating the way constants are imported and used throughout the Hugging Face Hub codebase. Instead of directly importing specific constants, we now import the entire constants module and access constants as its attributes.

Wauplin commented 1 month ago

@WizKnight code quality seems to be complaining. To fix this, you must run make style locally which will fix the issues. Then you can run make quality to check everything's good. Finally, commit and push the changes.

HuggingFaceDocBuilderDev commented 1 month ago

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 commented 1 month ago

Hi @WizKnight, I've checked out locally your changes to test typing issues you were having. I can't reproduce them and the CI either. I suspect that we are not on the same version (currently using mypy==1.5.1 in CI). For now I reverted the typing-related changes from this PR (see https://github.com/huggingface/huggingface_hub/pull/2453/commits/62af016c88a46356d2b351c137eb96bb3b2ee76c). I'll have a look to what you mention though but keeping it for a separate one.

CI is now passing except for unrelated errors. Time to merge! Thanks again for the contribution!