From 5325ef18fef03945ba67d85bbcfd96914a0953b3 Mon Sep 17 00:00:00 2001
From: Manuel Kaufmann
+ {% blocktrans trimmed %}
+ Make sure your project has a
+ Here you have an example for a Sphinx project:
+
+ {% trans "Project configuration file (
+
+.readthedocs.yaml
)" %}.readthedocs.yaml
at the root of your repository. This file is required by Read the Docs to be able to build your documentation. You can read more about this at https://docs.readthedocs.io/en/stable/config-file/v2.html
+ {% endblocktrans %}
+
+
+# .readthedocs.yaml
+# Read the Docs configuration file
+# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
+
+# Required
+version: 2
+
+# Set the version of Python and other tools you might need
+build:
+ os: ubuntu-22.04
+ tools:
+ python: "3.11"
+ # You can also specify other tool versions:
+ # nodejs: "19"
+ # rust: "1.64"
+ # golang: "1.19"
+
+# Build documentation in the docs/ directory with Sphinx
+sphinx:
+ configuration: docs/conf.py
+
+# If using Sphinx, optionally build your docs in additional formats such as PDF
+# formats:
+# - pdf
+
+# Optionally declare the Python requirements required to build your docs
+python:
+ install:
+ - requirements: docs/requirements.txt
+
{% trans "Project configuration file (
.readthedocs.yaml
)" %}
{% blocktrans trimmed %}
- Make sure your project has a .readthedocs.yaml
at the root of your repository. This file is required by Read the Docs to be able to build your documentation. You can read more about this at https://docs.readthedocs.io/en/stable/config-file/v2.html
+ Make sure your project has a .readthedocs.yaml
at the root of your repository. This file is required by Read the Docs to be able to build your documentation. You can read more about this in our documentation.
{% endblocktrans %}
.readthedocs.yaml
)" %}
- Here you have an example for a Sphinx project:
+ Here you have an example for a common Sphinx project:
-
+
+
+
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
@@ -21,7 +22,7 @@
+# - epub
+
+# Optionally, but recommended,
+# declare the Python requirements required to build your documentation
+# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
+# python:
+# install:
+# - requirements: docs/requirements.txt
+ {% trans "Project configuration file (
.readthedocs.yaml
)" %}{% trans "Project configuration file (.readthedocs.yaml
)" %}
.readthedocs.yaml
file to my project",
required=True,
)
From 4e44e800e08ff2ca767c2978cd3a2212ead09489 Mon Sep 17 00:00:00 2001
From: Manuel Kaufmann .readthedocs.yaml
file to my project",
+ label="I've already added a .readthedocs.yaml
file to my project",
required=True,
)
From 9d9226bc65d3380c4f3f74fa3730f10e00b59a2c Mon Sep 17 00:00:00 2001
From: Manuel Kaufmann .readthedocs.yaml
file to my project",
- required=True,
- )
-
def __init__(self, *args, **kwargs):
# Remove 'user' field since it's not expected by BaseForm.
kwargs.pop("user")
From 4090fa0fe16fb39c496e4f1b3c206beb3ae44b38 Mon Sep 17 00:00:00 2001
From: Manuel Kaufmann .readthedocs.yaml
)" %}
Here you have an example for a common Sphinx project:
- +# .readthedocs.yaml # Read the Docs configuration file From e9b78db0cf4960c1c56424f831b7d2ff5dd81915 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann
Date: Wed, 31 May 2023 09:42:39 +0200 Subject: [PATCH 09/13] Test: re-add `self.data` to test class --- .../rtd_tests/tests/test_project_views.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/readthedocs/rtd_tests/tests/test_project_views.py b/readthedocs/rtd_tests/tests/test_project_views.py index 2e31682ace5..fa6637f2493 100644 --- a/readthedocs/rtd_tests/tests/test_project_views.py +++ b/readthedocs/rtd_tests/tests/test_project_views.py @@ -26,6 +26,27 @@ class TestImportProjectBannedUser(RequestFactoryTestMixin, TestCase): url = '/dashboard/import/manual/' + def setUp(self): + super().setUp() + data = { + "basics": { + "name": "foobar", + "repo": "http://example.com/foobar", + "repo_type": "git", + }, + "extra": { + "description": "Describe foobar", + "language": "en", + "documentation_type": "sphinx", + }, + } + self.data = {} + for key in data: + self.data.update( + {("{}-{}".format(key, k), v) for (k, v) in list(data[key].items())} + ) + self.data["{}-current_step".format(self.wizard_class_slug)] = "extra" + def test_banned_user(self): """User is banned.""" req = self.request(method="post", path=self.url, data=self.data) From 5727471a8a5e8d3b6cf36504f176ec7db8ceb943 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Wed, 31 May 2023 14:37:57 +0200 Subject: [PATCH 10/13] Use CSS class to style the YAML shown at import step --- media/css/core.css | 4 ++++ readthedocs/templates/projects/import_config.html | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/media/css/core.css b/media/css/core.css index fa58300a696..fba3c2eebbd 100644 --- a/media/css/core.css +++ b/media/css/core.css @@ -1397,3 +1397,7 @@ div.highlight pre .vc { color: #bb60d5 } /* Name.Variable.Class */ div.highlight pre .vg { color: #bb60d5 } /* Name.Variable.Global */ div.highlight pre .vi { color: #bb60d5 } /* Name.Variable.Instance */ div.highlight pre .il { color: #40a070 } /* Literal.Number.Integer.Long */ + +pre.small { + font-size: 0.85em; +} diff --git a/readthedocs/templates/projects/import_config.html b/readthedocs/templates/projects/import_config.html index 03b246f73bf..4c88906ab7e 100644 --- a/readthedocs/templates/projects/import_config.html +++ b/readthedocs/templates/projects/import_config.html @@ -13,7 +13,7 @@ {% trans "Project configuration file (
.readthedocs.yaml
)" %} Here you have an example for a common Sphinx project: -+From c9bd407978ac1032917b80e14ba7c6a3e2f4bd3d Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann# .readthedocs.yaml # Read the Docs configuration file From 9bdcbec5419b192b7a13dc0b23d06376c98e08e1 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann
Date: Wed, 31 May 2023 14:42:03 +0200 Subject: [PATCH 11/13] Add required variable in tests --- readthedocs/rtd_tests/tests/test_project_views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/readthedocs/rtd_tests/tests/test_project_views.py b/readthedocs/rtd_tests/tests/test_project_views.py index fa6637f2493..c0aa6b1ef19 100644 --- a/readthedocs/rtd_tests/tests/test_project_views.py +++ b/readthedocs/rtd_tests/tests/test_project_views.py @@ -24,7 +24,8 @@ @mock.patch('readthedocs.projects.tasks.builds.update_docs_task', mock.MagicMock()) class TestImportProjectBannedUser(RequestFactoryTestMixin, TestCase): - url = '/dashboard/import/manual/' + wizard_class_slug = "import_wizard_view" + url = "/dashboard/import/manual/" def setUp(self): super().setUp() From dbb0aa92db36c823595f82f7590697a50fa404ec Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Thu, 1 Jun 2023 09:23:00 +0200 Subject: [PATCH 12/13] Minor style for import config step --- readthedocs/templates/projects/import_config.html | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/readthedocs/templates/projects/import_config.html b/readthedocs/templates/projects/import_config.html index 4c88906ab7e..06b404aa280 100644 --- a/readthedocs/templates/projects/import_config.html +++ b/readthedocs/templates/projects/import_config.html @@ -14,8 +14,7 @@ {% trans "Project configuration file (
.readthedocs.yaml
)" %} --# .readthedocs.yaml +
# .readthedocs.yaml # Read the Docs configuration file # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details @@ -41,13 +40,11 @@
{% trans "Project configuration file (
.readthedocs.yaml
)" %} +# - requirements: docs/requirements.txtDate: Tue, 6 Jun 2023 15:50:27 +0200 Subject: [PATCH 13/13] Split phrase to avoid scrolling --- readthedocs/templates/projects/import_config.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/readthedocs/templates/projects/import_config.html b/readthedocs/templates/projects/import_config.html index 06b404aa280..5489d24bb85 100644 --- a/readthedocs/templates/projects/import_config.html +++ b/readthedocs/templates/projects/import_config.html @@ -40,7 +40,8 @@ {% trans "Project configuration file (
.readthedocs.yaml
)" %}