Skip to content

Commit 58e38e0

Browse files
authored
Settings: simplify all the settings removing a whole old layer (dev) (#9978)
* Settings: simplify all the settings removing a whole old layer (`dev`) We are not using `settings/dev.py` since we started using Docker (`settings/docker_compose.py`). However, we never updated this code. This commit removes the extra `Dev` class layer by moving the required (and still used settings) into `settings/test.py` and `settings/docker_compose.py` since they were inheriting from `settings/dev.py`. * Settings: add missing setting for test * Settings: missing on web * Setting: missing on celery * Settings: missing on proxito * Settings: updates for docs/ * Docs: remove outdated and complex code and dependencies (#9981) * Docs: remove outdated and complex code This commit reduces the complexity of the documentation environment by removing the requirement of having Django installed and loaded to build the docs. * Remove the `djangodocs` and `doc_extensions`: they load the whole Django application unnecesarily. We need to have a bunch of requirements installed just because of this. * Remove defaults from "Interesting settings" because all the default were wrong. The Django extension was loading an invalid set of settings. This page could be completely removed as well probably. * Remove `featureflag` role because of the same reason (loads a whole Django project). We were using it only to show a small description of the feature flags. I wrote that text directly in the page. Feature flags are deprecated and this page will probably deleted soon as well. * Remove `buildpyversions` role also. Same reason. Manually wrote the versions supported on each Docker image. This is used for the legacy images, tho. They won't change since we don't maintain them anymore. * Docs: reduce requirements drastically Since we don't depend on Django anymore we can remove the `-r pip.txt` dependency from the documentation. This makes the documentation just to rely on Sphinx and some other extensions only simplifying the environment a lot and running fast. * Docs: don't install `pip.txt` * Docs: remove missing `djangosetting` role * Solve minimal merge conflicts
1 parent 889e9d1 commit 58e38e0

File tree

18 files changed

+94
-608
lines changed

18 files changed

+94
-608
lines changed

.readthedocs.yml

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ sphinx:
88

99
python:
1010
install:
11-
- requirements: requirements/pip.txt
1211
- requirements: requirements/docs.txt
1312

1413
build:

dockerfiles/settings/celery.py

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33

44
class CeleryDevSettings(DockerBaseSettings):
5+
DONT_HIT_DB = False
6+
57
# TODO: review this since it may not be needed with MinIO (S3). For now,
68
# this is still required, but the CORS issue may have disappeared in MinIO.
79

dockerfiles/settings/proxito.py

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55

66
class ProxitoDevSettings(CommunityProxitoSettingsMixin, DockerBaseSettings):
7+
DONT_HIT_DB = False
78

89
# El Proxito does not have django-debug-toolbar installed
910
@property

dockerfiles/settings/web.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33

44
class WebDevSettings(DockerBaseSettings):
5+
DONT_HIT_DB = False
56

67
# Router is useful from webs only because they have access to the database.
78
# Builders will use the same queue that was assigned the first time on retry

docs/conf.py

-12
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,6 @@
1616

1717
from multiproject.utils import get_project
1818

19-
sys.path.insert(0, os.path.abspath(".."))
20-
sys.path.append(os.path.dirname(__file__))
21-
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "readthedocs.settings.dev")
22-
23-
# Load Django after sys.path and configuration setup
24-
# isort: split
25-
import django
26-
27-
django.setup()
28-
2919
sys.path.append(os.path.abspath("_ext"))
3020
extensions = [
3121
"multiproject",
@@ -34,8 +24,6 @@
3424
"sphinx.ext.intersphinx",
3525
"sphinxcontrib.httpdomain",
3626
"sphinxcontrib.video",
37-
"djangodocs",
38-
"doc_extensions",
3927
"sphinx_tabs.tabs",
4028
"sphinx-prompt",
4129
"notfound.extension",

docs/dev/settings.rst

-32
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ Interesting Settings
44
DOCKER_LIMITS
55
-------------
66

7-
Default: :djangosetting:`DOCKER_LIMITS`
8-
97
A dictionary of limits to virtual machines. These limits include:
108

119
time
@@ -27,8 +25,6 @@ SLUMBER_USERNAME
2725
.. Don't set this automatically, lest we leak something. We are using the dev
2826
settings in the conf.py, but it's probably a good idea to be safe.
2927
30-
Default: ``test``
31-
3228
The username to use when connecting to the Read the Docs API. Used for hitting the API while building the docs.
3329

3430
SLUMBER_PASSWORD
@@ -37,63 +33,47 @@ SLUMBER_PASSWORD
3733
.. Don't set this automatically, lest we leak something. We are using the dev
3834
settings in the conf.py, but it's probably a good idea to be safe.
3935
40-
Default: ``test``
41-
4236
The password to use when connecting to the Read the Docs API. Used for hitting the API while building the docs.
4337

4438
USE_SUBDOMAIN
4539
---------------
4640

47-
Default: :djangosetting:`USE_SUBDOMAIN`
48-
4941
Whether to use subdomains in URLs on the site, or the Django-served content.
5042
When used in production, this should be ``True``, as Nginx will serve this content.
5143
During development and other possible deployments, this might be ``False``.
5244

5345
PRODUCTION_DOMAIN
5446
------------------
5547

56-
Default: :djangosetting:`PRODUCTION_DOMAIN`
57-
5848
This is the domain that gets linked to throughout the site when used in production.
5949
It depends on `USE_SUBDOMAIN`, otherwise it isn't used.
6050

6151
RTD_INTERSPHINX_URL
6252
-------------------
6353

64-
Default: :djangosetting:`RTD_INTERSPHINX_URL`
65-
6654
This is the domain that is used to fetch the intersphinx inventory file.
6755
If not set explicitly this is the ``PRODUCTION_DOMAIN``.
6856

6957
DEFAULT_PRIVACY_LEVEL
7058
---------------------
7159

72-
Default: :djangosetting:`DEFAULT_PRIVACY_LEVEL`
73-
7460
What privacy projects default to having. Generally set to `public`. Also acts as a proxy setting for blocking certain historically insecure options, like serving generated artifacts directly from the media server.
7561

7662
INDEX_ONLY_LATEST
7763
-----------------
7864

79-
Default: :djangosetting:`INDEX_ONLY_LATEST`
80-
8165
In search, only index the `latest` version of a Project.
8266

8367
PUBLIC_DOMAIN
8468
-------------
8569

86-
Default: :djangosetting:`PUBLIC_DOMAIN`
87-
8870
A special domain for serving public documentation.
8971
If set, public docs will be linked here instead of the `PRODUCTION_DOMAIN`.
9072

9173

9274
PUBLIC_DOMAIN_USES_HTTPS
9375
------------------------
9476

95-
Default: ``False``
96-
9777
If ``True`` and ``PUBLIC_DOMAIN`` is set, that domain will default to
9878
serving public documentation over HTTPS. By default, documentation is
9979
served over HTTP.
@@ -102,16 +82,12 @@ served over HTTP.
10282
ALLOW_ADMIN
10383
-----------
10484

105-
Default: :djangosetting:`ALLOW_ADMIN`
106-
10785
Whether to include `django.contrib.admin` in the URL's.
10886

10987

11088
RTD_BUILD_MEDIA_STORAGE
11189
-----------------------
11290

113-
Default: ``readthedocs.builds.storage.BuildMediaFileSystemStorage``
114-
11591
Use this storage class to upload build artifacts to cloud storage (S3, Azure storage).
11692
This should be a dotted path to the relevant class (eg. ``'path.to.MyBuildMediaStorage'``).
11793
Your class should mixin :class:`readthedocs.builds.storage.BuildMediaStorageMixin`.
@@ -166,17 +142,13 @@ and the ``settings`` is used for configuring the particular index.
166142
ES_TASK_CHUNK_SIZE
167143
------------------
168144

169-
Default: :djangosetting:`ES_TASK_CHUNK_SIZE`
170-
171145
The maximum number of data send to each elasticsearch indexing celery task.
172146
This has been used while running ``elasticsearch_reindex`` management command.
173147

174148

175149
ES_PAGE_IGNORE_SIGNALS
176150
----------------------
177151

178-
Default: ``False``
179-
180152
This settings is used to determine whether to index each page separately into elasticsearch.
181153
If the setting is ``True``, each ``HTML`` page will not be indexed separately but will be
182154
indexed by bulk indexing.
@@ -185,11 +157,7 @@ indexed by bulk indexing.
185157
ELASTICSEARCH_DSL_AUTOSYNC
186158
--------------------------
187159

188-
Default: ``True``
189-
190160
This setting is used for automatically indexing objects to elasticsearch.
191-
``False`` by default in development so it is possible to create
192-
project and build documentations without having elasticsearch.
193161

194162

195163
.. _elasticsearch-dsl-py.connections.configure: https://elasticsearch-dsl.readthedocs.io/en/stable/configuration.html#multiple-clusters

docs/doc_extensions.py

-75
This file was deleted.

docs/user/config-file/v1.rst

+6-4
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ The ``build`` block configures specific aspects of the documentation build.
114114
build.image
115115
```````````
116116

117-
* Default: :djangosetting:`DOCKER_DEFAULT_VERSION`
117+
* Default: ``latest``
118118
* Options: ``stable``, ``latest``
119119

120120
The build image to use for specific builds.
@@ -124,8 +124,10 @@ if they want to be on the cutting edge.
124124
Certain Python versions require a certain build image,
125125
as defined here:
126126

127-
* ``stable``: :buildpyversions:`stable`
128-
* ``latest``: :buildpyversions:`latest`
127+
* ``stable``:
128+
``2``, ``2.7``, ``3``, ``3.5``, ``3.6``, ``3.7``, ``pypy3.5``
129+
* ``latest``:
130+
``2``, ``2.7``, ``3``, ``3.5``, ``3.6``, ``3.7``, ``3.8``, ``pypy3.5``
129131

130132
.. code-block:: yaml
131133
@@ -147,7 +149,7 @@ python.version
147149
``````````````
148150

149151
* Default: ``3.7``
150-
* Options: :buildpyversions:`latest`
152+
* Options: ``2``, ``2.7``, ``3``, ``3.5``, ``3.6``, ``3.7``, ``3.8``, ``pypy3.5``
151153

152154
This is the version of Python to use when building your documentation.
153155
If you specify only the major version of Python,

docs/user/config-file/v2.rst

+4-2
Original file line numberDiff line numberDiff line change
@@ -856,8 +856,10 @@ The Docker image used for building the docs.
856856
Each image support different Python versions and has different packages installed,
857857
as defined here:
858858

859-
* `stable <https://github.com/readthedocs/readthedocs-docker-images/tree/releases/5.x>`_: :buildpyversions:`stable`
860-
* `latest <https://github.com/readthedocs/readthedocs-docker-images/tree/releases/6.x>`_: :buildpyversions:`latest`
859+
* `stable <https://github.com/readthedocs/readthedocs-docker-images/tree/releases/5.x>`_:
860+
``2``, ``2.7``, ``3``, ``3.5``, ``3.6``, ``3.7``, ``pypy3.5``
861+
* `latest <https://github.com/readthedocs/readthedocs-docker-images/tree/releases/6.x>`_:
862+
``2``, ``2.7``, ``3``, ``3.5``, ``3.6``, ``3.7``, ``3.8``, ``pypy3.5``
861863

862864
python.version (legacy)
863865
```````````````````````

docs/user/feature-flags.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ or reaching out to the administrator of your service.
1111
Available Flags
1212
---------------
1313

14-
``CONDA_APPEND_CORE_REQUIREMENTS``: :featureflags:`CONDA_APPEND_CORE_REQUIREMENTS`
14+
``CONDA_APPEND_CORE_REQUIREMENTS``: Append Read the Docs core requirements to environment.yml file.
1515

1616
Makes Read the Docs to install all the requirements at once on ``conda create`` step.
1717
This helps users to pin dependencies on conda and to improve build time.
1818

19-
``DONT_OVERWRITE_SPHINX_CONTEXT``: :featureflags:`DONT_OVERWRITE_SPHINX_CONTEXT`
19+
``DONT_OVERWRITE_SPHINX_CONTEXT``: Do not overwrite context vars in conf.py with Read the Docs context.
2020

21-
``DONT_CREATE_INDEX``: :featureflags:`DONT_CREATE_INDEX`
21+
``DONT_CREATE_INDEX``: Do not create index.md or README.rst if the project does not have one.
2222

2323
When Read the Docs detects that your project doesn't have an ``index.md`` or ``README.rst``,
2424
it auto-generate one for you with instructions about how to proceed.

docs/user/guides/embedding-content.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Embedding Content From Your Documentation
22
=========================================
33

44
Read the Docs allows you to embed content from any of the projects we host and specific allowed external domains
5-
(currently, :djangosetting:`RTD_EMBED_API_EXTERNAL_DOMAINS`)
5+
(currently, ``docs.python.org``, ``docs.scipy.org``, ``docs.sympy.org``, ``numpy.org``)
66
This allows reuse of content across sites, making sure the content is always up to date.
77

88
There are a number of uses cases for embedding content,

manage.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
import sys
44

55
if __name__ == "__main__":
6-
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "readthedocs.settings.dev")
6+
os.environ.setdefault(
7+
"DJANGO_SETTINGS_MODULE", "readthedocs.settings.docker_compose"
8+
)
79
sys.path.append(os.getcwd())
810

911
from django.core.management import execute_from_command_line

0 commit comments

Comments
 (0)