Skip to content

Commit 76c1228

Browse files
authored
Switch default branch to main and fix tests (#151)
* Switch default branch to main and fix tests * Last one forgotten
1 parent af4cae2 commit 76c1228

15 files changed

+51
-51
lines changed

.github/workflows/build_main_documentation.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ jobs:
139139
if [[ `git status --porcelain` ]]; then
140140
git add ${{ inputs.notebook_folder }}
141141
git commit -m "Updated ${{ inputs.package }} doc notebooks with commit ${{ inputs.commit_sha }} \n\nSee: https://github.com/huggingface/${{ inputs.package }}/commit/${{ inputs.commit_sha }}"
142-
git push origin master ||
143-
(echo "Failed on the first try, rebasing and pushing again" && git pull --rebase && git push origin master) ||
144-
(echo "Failed on the second try, rebasing and pushing again" && git pull --rebase && git push origin master)
142+
git push origin main ||
143+
(echo "Failed on the first try, rebasing and pushing again" && git pull --rebase && git push origin main) ||
144+
(echo "Failed on the second try, rebasing and pushing again" && git pull --rebase && git push origin main)
145145
else
146146
echo "No diff in the notebooks."
147147
fi

kit/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
- Install `nodejs` / `npm`
66
- Run `npm install`
77
- Copy the mdx docs into the routes folder
8-
- set `DOCS_VERSION` in the env to the correct prefix (eg `master`)
8+
- set `DOCS_VERSION` in the env to the correct prefix (eg `main`)
99
- set `DOCS_LANGUAGE` in the env to the correct language (eg `en`)
1010
- Run `npm run run build`
1111

1212
The generated html files and assets are in the `build` folder.
1313

1414
## Previewing the docs
1515

16-
Instead of `npm run build`, do `npm run dev`. Then go to http://localhost:3000 (or replace `master` with the correct prefix).
16+
Instead of `npm run build`, do `npm run dev`. Then go to http://localhost:3000 (or replace `main` with the correct prefix).

kit/svelte.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const config = {
3939
: "/docs/" +
4040
(process.env.DOCS_LIBRARY || "transformers") +
4141
"/" +
42-
(process.env.DOCS_VERSION || "master") +
42+
(process.env.DOCS_VERSION || "main") +
4343
"/" +
4444
(process.env.DOCS_LANGUAGE || "en")
4545
}

src/doc_builder/autodoc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def get_source_link(obj, page_info):
280280
Returns the link to the source code of an object on GitHub.
281281
"""
282282
package_name = page_info["package_name"]
283-
version = page_info.get("version", "master")
283+
version = page_info.get("version", "main")
284284
base_link = f"https://github.com/huggingface/{package_name}/blob/{version}/src/"
285285
module = obj.__module__.replace(".", "/")
286286
line_number = inspect.getsourcelines(obj)[1]
@@ -438,7 +438,7 @@ def resolve_links_in_text(text, package, mapping, page_info):
438438
page_info (`Dict[str, str]`): Some information about the page.
439439
"""
440440
package_name = page_info.get("package_name", package.__name__)
441-
version = page_info.get("version", "master")
441+
version = page_info.get("version", "main")
442442
language = page_info.get("language", "en")
443443

444444
prefix = f"/docs/{package_name}/{version}/{language}/"

src/doc_builder/build_doc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def resolve_open_in_colab(content, page_info):
4949

5050
package_name = page_info["package_name"]
5151
page_name = Path(page_info["page"]).stem
52-
nb_prefix = f"/github/huggingface/notebooks/blob/master/{package_name}_doc/"
52+
nb_prefix = f"/github/huggingface/notebooks/blob/main/{package_name}_doc/"
5353
nb_prefix_colab = f"https://colab.research.google.com{nb_prefix}"
5454
nb_prefix_awsstudio = f"https://studiolab.sagemaker.aws/import{nb_prefix}"
5555
links = [
@@ -355,7 +355,7 @@ def build_doc(
355355
doc_folder,
356356
output_dir,
357357
clean=True,
358-
version="master",
358+
version="main",
359359
language="en",
360360
notebook_dir=None,
361361
is_python_module=False,
@@ -371,7 +371,7 @@ def build_doc(
371371
The folder in which to put the built documentation. Will be created if it does not exist.
372372
clean (`bool`, *optional*, defaults to `True`):
373373
Whether or not to delete the content of the `output_dir` if that directory exists.
374-
version (`str`, *optional*, defaults to `"master"`): The name of the version of the doc.
374+
version (`str`, *optional*, defaults to `"main"`): The name of the version of the doc.
375375
language (`str`, *optional*, defaults to `"en"`): The language of the doc.
376376
notebook_dir (`str` or `os.PathLike`, *optional*):
377377
If provided, where to save the notebooks generated from the doc file with an [[open-in-colab]] marker.

src/doc_builder/commands/build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def build_command_parser(subparsers=None):
171171
"--version",
172172
type=str,
173173
help="Version of the documentation to generate. Will default to the version of the package module (using "
174-
"`master` for a version containing dev).",
174+
"`main` for a version containing dev).",
175175
)
176176
parser.add_argument("--notebook_dir", type=str, help="Where to save the generated notebooks.", default=None)
177177
parser.add_argument("--html", action="store_true", help="Whether or not to build HTML files instead of MDX files.")

src/doc_builder/commands/preview.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def preview_command_parser(subparsers=None):
225225
"documentation files should be indicated here.",
226226
)
227227
parser.add_argument("--language", type=str, help="Language of the documentation to generate", default="en")
228-
parser.add_argument("--version", type=str, help="Version of the documentation to generate", default="master")
228+
parser.add_argument("--version", type=str, help="Version of the documentation to generate", default="main")
229229
parser.add_argument(
230230
"--not_python_module",
231231
action="store_true",

src/doc_builder/convert_md_to_mdx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def convert_img_links(text, page_info):
8383
if "package_name" not in page_info:
8484
raise ValueError("`page_info` must contain at least the package_name.")
8585
package_name = page_info["package_name"]
86-
version = page_info.get("version", "master")
86+
version = page_info.get("version", "main")
8787
language = page_info.get("language", "en")
8888

8989
_re_img_link = re.compile(r"(src=\"|\()/imgs/")

src/doc_builder/convert_rst_to_mdx.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def convert_rst_links(text, page_info):
9292
if "package_name" not in page_info:
9393
raise ValueError("`page_info` must contain at least the package_name.")
9494
package_name = page_info["package_name"]
95-
version = page_info.get("version", "master")
95+
version = page_info.get("version", "main")
9696
language = page_info.get("language", "en")
9797
no_prefix = page_info.get("no_prefix", False)
9898

@@ -116,7 +116,7 @@ def convert_rst_links(text, page_info):
116116

117117
# Links with a prefix
118118
# TODO: when it exists, use the API to deal with prefix links properly.
119-
prefix = f"https://github.com/huggingface/{package_name}/tree/master/"
119+
prefix = f"https://github.com/huggingface/{package_name}/tree/main/"
120120
text = _re_prefix_links.sub(rf"[\1]({prefix}\2)", text)
121121
# Other links
122122
text = _re_links.sub(r"[\1](\2)", text)
@@ -220,7 +220,7 @@ def convert_rst_blocks(text, page_info):
220220
if "package_name" not in page_info:
221221
raise ValueError("`page_info` must contain at least the package_name.")
222222
package_name = page_info["package_name"]
223-
version = page_info.get("version", "master")
223+
version = page_info.get("version", "main")
224224
language = page_info.get("language", "en")
225225

226226
lines = text.split("\n")

src/doc_builder/convert_to_notebook.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def expand_links(content, page_info):
4646
Expand links relative to the documentation to full links to the hf.co website.
4747
"""
4848
package_name = page_info["package_name"]
49-
version = page_info.get("version", "master")
49+
version = page_info.get("version", "main")
5050
language = page_info.get("language", "en")
5151
page = str(page_info["page"])
5252

0 commit comments

Comments
 (0)