Skip to content

Commit 4a43a8c

Browse files
committed
Merge tag '9.11.0' into rel
2 parents 6708a89 + 20c5294 commit 4a43a8c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+5857
-367
lines changed

CHANGELOG.rst

+19
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
Version 9.11.0
2+
--------------
3+
4+
:Date: April 18, 2023
5+
6+
* `@benjaoming <https://github.com/benjaoming>`__: Fix a little test failure (`#10248 <https://github.com/readthedocs/readthedocs.org/pull/10248>`__)
7+
* `@benjaoming <https://github.com/benjaoming>`__: Scripts: Add export statements and instruction to fetch awscli (compile_version_upload_s3.sh) (`#10245 <https://github.com/readthedocs/readthedocs.org/pull/10245>`__)
8+
* `@github-actions[bot] <https://github.com/github-actions[bot]>`__: Dependencies: all packages updated via pip-tools (`#10244 <https://github.com/readthedocs/readthedocs.org/pull/10244>`__)
9+
* `@stsewd <https://github.com/stsewd>`__: API V3: make tests explicit (`#10236 <https://github.com/readthedocs/readthedocs.org/pull/10236>`__)
10+
* `@ericholscher <https://github.com/ericholscher>`__: Release 9.10.1 (`#10235 <https://github.com/readthedocs/readthedocs.org/pull/10235>`__)
11+
* `@dependabot[bot] <https://github.com/dependabot[bot]>`__: Bump peter-evans/create-pull-request from 4 to 5 (`#10233 <https://github.com/readthedocs/readthedocs.org/pull/10233>`__)
12+
* `@github-actions[bot] <https://github.com/github-actions[bot]>`__: Dependencies: all packages updated via pip-tools (`#10232 <https://github.com/readthedocs/readthedocs.org/pull/10232>`__)
13+
* `@agjohnson <https://github.com/agjohnson>`__: Add notes on private repo support in our install docs (`#10230 <https://github.com/readthedocs/readthedocs.org/pull/10230>`__)
14+
* `@stsewd <https://github.com/stsewd>`__: Analytics API: check if absolute_uri isn't present (`#10227 <https://github.com/readthedocs/readthedocs.org/pull/10227>`__)
15+
* `@humitos <https://github.com/humitos>`__: Proxito: inject hosting integration header for `build.commands` (`#10219 <https://github.com/readthedocs/readthedocs.org/pull/10219>`__)
16+
* `@humitos <https://github.com/humitos>`__: API: hosting integrations endpoint versioning/structure (`#10216 <https://github.com/readthedocs/readthedocs.org/pull/10216>`__)
17+
* `@benjaoming <https://github.com/benjaoming>`__: Search: index <dl>s as sections and remove Sphinx domain logic (`#10128 <https://github.com/readthedocs/readthedocs.org/pull/10128>`__)
18+
* `@ewdurbin <https://github.com/ewdurbin>`__: implement multiple .readthedocs.yml files per repo (`#10001 <https://github.com/readthedocs/readthedocs.org/pull/10001>`__)
19+
120
Version 9.10.1
221
--------------
322

docs/_static/js/readthedocs-doc-diff.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474

7575
master_doc = "index"
7676
copyright = "Read the Docs, Inc & contributors"
77-
version = "9.10.1"
77+
version = "9.11.0"
7878
release = version
7979
exclude_patterns = ["_build", "shared", "_includes"]
8080
default_role = "obj"

docs/dev/search-integration.rst

+27-5
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ Tags to be ignored:
117117

118118
- ``nav``
119119

120+
Special rules that are derived from specific documentation tools applied in the generic parser:
121+
122+
.. https://squidfunk.github.io/mkdocs-material/reference/code-blocks/#adding-line-numbers
123+
124+
- ``.linenos``, ``.lineno`` (line numbers in code-blocks, comes from both MkDocs and Sphinx)
125+
- ``.headerlink`` (added by Sphinx to links in headers)
126+
120127
Example:
121128

122129
.. code-block:: html
@@ -133,12 +140,27 @@ Example:
133140
Sections
134141
~~~~~~~~
135142

136-
Sections are composed of a title, and a content.
137-
A section title can be a ``h`` tag, or a ``header`` tag containing a ``h`` tag,
138-
the ``h`` tag or its parent can contain an ``id`` attribute, which will be used to link to the section.
143+
Sections are stored in a dictionary composed of an ``id``, ``title`` and ``content`` key.
139144

140-
All content below the title, until a new section is found, will be indexed as part of the section content.
141-
Example:
145+
Sections are defined as:
146+
147+
* ``h1-h7``, all content between one heading level and the next header on the same level is used as content for that section.
148+
* ``dt`` elements with an ``id`` attribute, we map the ``title`` to the ``dt`` element and the content to the ``dd`` element.
149+
150+
All sections have to be identified by a DOM container's ``id`` attribute,
151+
which will be used to link to the section.
152+
How the id is detected varies with the type of element:
153+
154+
* ``h1-h7`` elements use the ``id`` attribute of the header itself if present, or
155+
its ``section`` parent (if exists).
156+
* ``dt`` elements use the ``id`` attribute of the ``dt`` element.
157+
158+
To avoid duplication and ambiguous section references,
159+
all indexed ``dl`` elements are removed from the DOM before indexing of other sections happen.
160+
161+
Here is an example of how all content below the title,
162+
until a new section is found,
163+
will be indexed as part of the section content:
142164

143165
.. code-block:: html
144166
:emphasize-lines: 2-10, 12-17, 21-26

docs/user/guides/setup/index.rst

+5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ The following how-to guides help you solve common tasks and challenges in the se
2424
Need several projects under the same umbrella?
2525
Start using subprojects, which is a way to host multiple projects under a "main project".
2626

27+
⏩️ :doc:`Using a .readthedocs.yaml file in a sub-folder </guides/setup/monorepo>`
28+
This guide shows how to configure a Read the Docs project to use a custom path for the ``.readthedocs.yaml`` build configuration.
29+
*Monorepos* that have multiple documentation projects in the same Git repository can benefit from this feature.
30+
2731
⏩️ :doc:`Hiding a version </guides/hiding-a-version>`
2832
Is your version (flyout) menu overwhelmed and hard to navigate?
2933
Here's how to make it shorter.
@@ -44,4 +48,5 @@ The following how-to guides help you solve common tasks and challenges in the se
4448
Managing custom domains </guides/custom-domains>
4549
Managing subprojects </guides/subprojects>
4650
Hiding a version </guides/hiding-a-version>
51+
Using a .readthedocs.yaml file in a sub-folder </guides/setup/monorepo>
4752
Using custom URL redirects in documentation projects </guides/redirects>

docs/user/guides/setup/monorepo.rst

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
.. Next steps: Show an example pattern for a monorepo layout or link to an example project
2+
3+
How to use a .readthedocs.yaml file in a sub-folder
4+
===================================================
5+
6+
This guide shows how to configure a Read the Docs project to use a custom path for the ``.readthedocs.yaml`` build configuration.
7+
`Monorepos <https://en.wikipedia.org/wiki/Monorepo>`__ that have multiple documentation projects in the same Git repository can benefit from this feature.
8+
9+
By default,
10+
Read the Docs will use the ``.readthedocs.yaml`` at the top level of your Git repository.
11+
But if a Git repository contains multiple documentation projects that need different build configurations,
12+
you will need to have a ``.readthedocs.yaml`` file in multiple sub-folders.
13+
14+
.. seealso::
15+
16+
`sphinx-multiproject <https://sphinx-multiproject.readthedocs.io/en/latest/>`__
17+
If you are only using Sphinx projects and want to share the same build configuration,
18+
you can also use the ``sphinx-multiproject`` extension.
19+
20+
:doc:`/guides/environment-variables`
21+
You might also be able to reuse the same configuration file across multiple projects,
22+
using only environment variables.
23+
This is possible if the configuration pattern is very similar and the documentation tool is the same.
24+
25+
Implementation considerations
26+
-----------------------------
27+
28+
This feature is currently *project-wide*.
29+
A custom build configuration file path is applied to all versions of your documentation.
30+
31+
.. warning::
32+
33+
Changing the configuration path will apply to all versions.
34+
Different versions of the project may not be able to build again if this path is changed.
35+
36+
Adding an additional project from the same repository
37+
-----------------------------------------------------
38+
39+
Once you have added the first project from the :ref:`Import Wizard <intro/import-guide:Automatically import your docs>`,
40+
it will show as if it has already been imported and cannot be imported again.
41+
In order to add another project with the same repository,
42+
you will need to use the :ref:`Manual Import <intro/import-guide:Manually import your docs>`.
43+
44+
Setting the custom build configuration file
45+
-------------------------------------------
46+
47+
Once you have added a Git repository to a project that needs a custom configuration file path,
48+
navigate to :menuselection:`Admin --> Advanced Settings` and add the path to the :guilabel:`Build configuration file` field.
49+
50+
.. image:: /img/screenshot-howto-build-configuration-file.png
51+
:alt: Screenshot of where to find the :guilabel:`Build configuration file` setting.
52+
53+
After pressing :guilabel:`Save`,
54+
you need to ensure that relevant versions of your documentation are built again.
55+
56+
.. tip::
57+
58+
Having multiple different build configuration files can be complex.
59+
We recommend setting up 1-2 projects in your Monorepo and getting them to build and publish successfully before adding additional projects to the equation.
60+
61+
Next steps
62+
----------
63+
64+
Once you have your monorepo pattern implemented and tested and it's ready to roll out to all your projects,
65+
you should also consider the Read the Docs project setup for these individual projects.
66+
67+
Having individual projects gives you the full flexibility of the Read the Docs platform to make individual setups for each project.
68+
69+
For each project, it's now possible to configure:
70+
71+
* Sets of maintainers (or :doc:`organizations </commercial/organizations>` on |com_brand|)
72+
* :doc:`Custom redirect rules </guides/custom-domains>`
73+
* :doc:`Custom domains </guides/custom-domains>`
74+
* :doc:`Automation rules </automation-rules>`
75+
* :doc:`Traffic and search analytics </reference/analytics>`
76+
* Additional documentation tools with individual :doc:`build processes </build-customization>`:
77+
One project might use :doc:`Sphinx <sphinx:index>`,
78+
while another project setup might use `Asciidoctor <https://asciidoctor.org/>`__.
79+
80+
...and much more. *All* settings for a Read the Docs project is available for each individual project.
81+
82+
.. seealso::
83+
84+
:doc:`/guides/subprojects`
85+
More information on nesting one project inside another project.
86+
In this setup, it is still possible to use the same monorepo for each subproject.
87+
88+
Other tips
89+
----------
90+
91+
For a monorepo,
92+
it's not desirable to have changes in unrelated sub-folders trigger new builds.
93+
94+
Therefore,
95+
you should consider setting up :ref:`conditional build cancellation rules <build-customization:Cancel build based on a condition>`.
96+
The configuration is added in each ``.readthedocs.yaml``,
97+
making it possible to write one conditional build rules per documentation project in the Monorepo 💯️
Loading

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "readthedocs",
3-
"version": "9.10.1",
3+
"version": "9.11.0",
44
"description": "Read the Docs build dependencies",
55
"author": "Read the Docs, Inc <[email protected]>",
66
"scripts": {

readthedocs/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
"""Read the Docs."""
22

33

4-
__version__ = "9.10.1"
4+
__version__ = "9.11.0"

readthedocs/api/v2/serializers.py

+21-20
Original file line numberDiff line numberDiff line change
@@ -73,26 +73,27 @@ def get_skip(self, obj):
7373

7474
class Meta(ProjectSerializer.Meta):
7575
fields = ProjectSerializer.Meta.fields + (
76-
'enable_epub_build',
77-
'enable_pdf_build',
78-
'conf_py_file',
79-
'analytics_code',
80-
'analytics_disabled',
81-
'cdn_enabled',
82-
'container_image',
83-
'container_mem_limit',
84-
'container_time_limit',
85-
'install_project',
86-
'use_system_packages',
87-
'skip',
88-
'requirements_file',
89-
'python_interpreter',
90-
'features',
91-
'has_valid_clone',
92-
'has_valid_webhook',
93-
'show_advertising',
94-
'environment_variables',
95-
'max_concurrent_builds',
76+
"enable_epub_build",
77+
"enable_pdf_build",
78+
"conf_py_file",
79+
"analytics_code",
80+
"analytics_disabled",
81+
"cdn_enabled",
82+
"container_image",
83+
"container_mem_limit",
84+
"container_time_limit",
85+
"install_project",
86+
"use_system_packages",
87+
"skip",
88+
"requirements_file",
89+
"python_interpreter",
90+
"features",
91+
"has_valid_clone",
92+
"has_valid_webhook",
93+
"show_advertising",
94+
"environment_variables",
95+
"max_concurrent_builds",
96+
"readthedocs_yaml_path",
9697
)
9798

9899

readthedocs/api/v3/tests/mixins.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
from readthedocs.builds.constants import TAG
1515
from readthedocs.builds.models import Build, Version
16+
from readthedocs.projects.constants import PUBLIC
1617
from readthedocs.projects.models import Project
1718
from readthedocs.redirects.models import Redirect
1819

@@ -55,7 +56,9 @@ def setUp(self):
5556
main_language_project=None,
5657
users=[self.me],
5758
versions=[],
58-
external_builds_enabled=False
59+
external_builds_enabled=False,
60+
external_builds_privacy_level=PUBLIC,
61+
privacy_level=PUBLIC,
5962
)
6063
for tag in ('tag', 'project', 'test'):
6164
self.project.tags.add(tag)
@@ -83,6 +86,7 @@ def setUp(self):
8386
has_pdf=True,
8487
has_epub=True,
8588
has_htmlzip=True,
89+
privacy_level=PUBLIC,
8690
)
8791

8892
self.build = fixture.get(
@@ -110,6 +114,8 @@ def setUp(self):
110114
main_language_project=None,
111115
users=[self.other],
112116
versions=[],
117+
external_builds_privacy_level=PUBLIC,
118+
privacy_level=PUBLIC,
113119
)
114120

115121
# Make all non-html true so responses are complete
@@ -140,6 +146,8 @@ def _create_new_project(self):
140146
main_language_project=None,
141147
users=[self.me],
142148
versions=[],
149+
external_builds_privacy_level=PUBLIC,
150+
privacy_level=PUBLIC,
143151
)
144152

145153
def _create_subproject(self):
@@ -157,6 +165,8 @@ def _create_subproject(self):
157165
main_language_project=None,
158166
users=[self.me],
159167
versions=[],
168+
external_builds_privacy_level=PUBLIC,
169+
privacy_level=PUBLIC,
160170
)
161171
self.project_relationship = self.project.add_subproject(self.subproject)
162172

readthedocs/builds/admin.py

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class BuildAdmin(admin.ModelAdmin):
3333
"date",
3434
"builder",
3535
"length",
36+
"readthedocs_yaml_path",
3637
"pretty_config",
3738
)
3839
readonly_fields = (
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Generated by Django 3.2.18 on 2023-04-04 13:03
2+
3+
from django.db import migrations, models
4+
5+
import readthedocs.projects.validators
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
("builds", "0049_automation_rule_copy"),
12+
]
13+
14+
operations = [
15+
migrations.AddField(
16+
model_name="build",
17+
name="readthedocs_yaml_path",
18+
field=models.CharField(
19+
blank=True,
20+
default=None,
21+
max_length=1024,
22+
null=True,
23+
validators=[readthedocs.projects.validators.validate_build_config_file],
24+
verbose_name="Custom build configuration file path used in this build",
25+
),
26+
),
27+
]

readthedocs/builds/models.py

+9
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
SPHINX_SINGLEHTML,
8282
)
8383
from readthedocs.projects.models import APIProject, Project
84+
from readthedocs.projects.validators import validate_build_config_file
8485
from readthedocs.projects.version_handling import determine_stable_version
8586

8687
log = structlog.get_logger(__name__)
@@ -707,6 +708,14 @@ class Build(models.Model):
707708
null=True,
708709
blank=True,
709710
)
711+
readthedocs_yaml_path = models.CharField(
712+
_("Custom build configuration file path used in this build"),
713+
max_length=1024,
714+
default=None,
715+
blank=True,
716+
null=True,
717+
validators=[validate_build_config_file],
718+
)
710719

711720
length = models.IntegerField(_('Build Length'), null=True, blank=True)
712721

0 commit comments

Comments
 (0)