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

add: utility to format our docs too 📜 #7314

Merged
merged 18 commits into from
Apr 2, 2024
Merged

add: utility to format our docs too 📜 #7314

merged 18 commits into from
Apr 2, 2024

Conversation

sayakpaul
Copy link
Member

What does this PR do?

TL;DR: We should be formatting our docs with hf-doc-builder utility so that the code examples and other content in our docs are formatted properly.

This PR enables this for both in make style && make quality and in the CI.

Most of the changes in this PR are a result of running make style && make quality with the doc-formatting added. hf-doc-builder needs black as an implicit dependency.

@sayakpaul sayakpaul requested review from DN6 and yiyixuxu March 14, 2024 05:09
Comment on lines -36 to +35
ruff check examples tests src utils scripts
ruff format examples tests src utils scripts --check
run: make quality
Copy link
Member Author

Choose a reason for hiding this comment

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

I think it makes more sense to just run the make quality command here instead of manually repeating the exact same commands we already have under the quality alias of our Makefile.

Makefile Outdated
@@ -42,6 +42,7 @@ repo-consistency:
quality:
ruff check $(check_dirs) setup.py
ruff format --check $(check_dirs) setup.py
doc-builder style src/diffusers tests docs/source --max_len 119 --check_only
Copy link
Member Author

Choose a reason for hiding this comment

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

Major change 1.

Makefile Outdated
@@ -55,6 +56,7 @@ extra_style_checks:
style:
ruff check $(check_dirs) setup.py --fix
ruff format $(check_dirs) setup.py
doc-builder style src/diffusers tests docs/source --max_len 119
Copy link
Member Author

Choose a reason for hiding this comment

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

Major change 2.

@@ -130,6 +130,7 @@
"torchvision",
"transformers>=4.25.1",
"urllib3<=2.0.0",
"black",
Copy link
Member Author

Choose a reason for hiding this comment

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

Major change 3.

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

@sayakpaul
Copy link
Member Author

The failing tests should be fixed with #7329

@sayakpaul
Copy link
Member Author

@yiyixuxu @DN6 a gentle ping here. Let's decide on this soon otherwise merge conflicts will start accumulating.

Copy link
Collaborator

@yiyixuxu yiyixuxu left a comment

Choose a reason for hiding this comment

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

thanks for doing this! I left one question
I'm really not too familiar this so I cced @BenjaminBossan for help here

are we not able to use Ruff to format code examples?

setup.py Outdated Show resolved Hide resolved
@sayakpaul
Copy link
Member Author

are we not able to use Ruff to format code examples?

Unfortunately not. We rely on doc-builder to format those and it inherently relies on black. I did an effort to migrate that to ruff but it isn't that trivial: huggingface/doc-builder#485.

Copy link
Member

@BenjaminBossan BenjaminBossan left a comment

Choose a reason for hiding this comment

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

Thanks Sayak, the PR looks good. This makes the code much easier to read, so great addition.

@sayakpaul sayakpaul merged commit 4a34307 into main Apr 2, 2024
17 checks passed
@sayakpaul sayakpaul deleted the doc-formatting branch April 2, 2024 15:19
noskill pushed a commit to noskill/diffusers that referenced this pull request Apr 5, 2024
* add: utility to format our docs too 📜

* debugging saga

* fix: message

* checking

* should be fixed.

* revert pipeline_fixture

* remove empty line

* make style

* fix: setup.py

* style.
@sayakpaul sayakpaul mentioned this pull request Apr 19, 2024
XSE42 added a commit to XSE42/diffusers3d that referenced this pull request Apr 30, 2024
diffusers commit 4a34307
    add: utility to format our docs too 📜 (huggingface/diffusers#7314)
XSE42 added a commit to XSE42/diffusers3d that referenced this pull request May 13, 2024
Modify `loaders/unet_loader_utils` according to these commits

diffusers commit 4a34307:
    add: utility to format our docs too 📜 (huggingface/diffusers#7314)

diffusers commit 21c747f:
    Support InstantStyle (huggingface/diffusers#7668)
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