Unverified Commit 473709fc authored by Sylvain Gugger's avatar Sylvain Gugger Committed by GitHub
Browse files

Use doc builder styler (#16412)

* Config update

* Use doc-builder styler

* Cleanup

* Adapt import

* We need it there too!
parent 8049dfa4
......@@ -852,7 +852,7 @@ jobs:
- run: isort --check-only examples tests src utils
- run: python utils/custom_init_isort.py --check_only
- run: flake8 examples tests src utils
- run: python utils/style_doc.py src/transformers docs/source --max_len 119 --check_only
- run: doc-builder style src/transformers docs/source --max_len 119 --check_only --path_to_docs docs/source
check_repository_consistency:
working_directory: ~/transformers
......
......@@ -48,13 +48,13 @@ quality:
isort --check-only $(check_dirs)
python utils/custom_init_isort.py --check_only
flake8 $(check_dirs)
python utils/style_doc.py src/transformers docs/source --max_len 119 --check_only
doc-builder style src/transformers docs/source --max_len 119 --check_only --path_to_docs docs/source
# Format source code automatically and check is there are any problems left that need manual fixing
extra_style_checks:
python utils/custom_init_isort.py
python utils/style_doc.py src/transformers docs/source --max_len 119
doc-builder style src/transformers docs/source --max_len 119 --path_to_docs docs/source
# this target runs checks on all files and potentially modifies some of them
......
......@@ -7,3 +7,8 @@ INSTALL_CONTENT = """
"""
notebook_first_cells = [{"type": "code", "content": INSTALL_CONTENT}]
black_avoid_patterns = {
"{processor_class}": "FakeProcessorClass",
"{model_class}": "FakeModelClass",
"{object_class}": "FakeObjectClass",
}
......@@ -108,6 +108,7 @@ _deps = [
"ftfy",
"fugashi>=1.0",
"GitPython<3.1.19",
"hf-doc-builder>=0.2.0",
"huggingface-hub>=0.1.0,<1.0",
"importlib_metadata",
"ipadic>=1.0.0,<2.0",
......@@ -283,12 +284,13 @@ extras["testing"] = (
"rouge-score",
"nltk",
"GitPython",
"hf-doc-builder",
)
+ extras["retrieval"]
+ extras["modelcreation"]
)
extras["quality"] = deps_list("black", "isort", "flake8", "GitPython")
extras["quality"] = deps_list("black", "isort", "flake8", "GitPython", "hf-doc-builder")
extras["all"] = (
extras["tf"]
......@@ -304,7 +306,7 @@ extras["all"] = (
)
# Might need to add doc-builder and some specific deps in the future
extras["docs_specific"] = []
extras["docs_specific"] = ["hf-doc-builder"]
# "docs" needs "all" to resolve all the references
extras["docs"] = extras["all"] + extras["docs_specific"]
......
......@@ -9,8 +9,8 @@ Spec is: github.com/git-lfs/git-lfs/blob/master/docs/custom-transfers.md
To launch debugger while developing:
``` [lfs "customtransfer.multipart"]
path = /path/to/transformers/.env/bin/python args = -m debugpy --listen 5678 --wait-for-client
/path/to/transformers/src/transformers/commands/transformers_cli.py lfs-multipart-upload ``` """
path = /path/to/transformers/.env/bin/python args = -m debugpy --listen 5678 --wait-for-client
/path/to/transformers/src/transformers/commands/transformers_cli.py lfs-multipart-upload ```"""
import json
import os
......
......@@ -18,6 +18,7 @@ deps = {
"ftfy": "ftfy",
"fugashi": "fugashi>=1.0",
"GitPython": "GitPython<3.1.19",
"hf-doc-builder": "hf-doc-builder>=0.2.0",
"huggingface-hub": "huggingface-hub>=0.1.0,<1.0",
"importlib_metadata": "importlib_metadata",
"ipadic": "ipadic>=1.0.0,<2.0",
......
......@@ -19,7 +19,7 @@ import os
import re
import black
from style_doc import style_docstrings_in_code
from doc_builder.style_doc import style_docstrings_in_code
# All paths are set with the intent you should run this script from the root of the repo with the command
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment