Skip to content

Commit a98d8fe

Browse files
committed
Build: remove support for MkDocs <= 0.17.3
We want to keep deprecating old feature flags we don't want to support forever. In particular, those that keep our users using pretty old versions of doctools and freeze them in a status that's hard to maintain. This PR removes the `DEFATUL_TO_MKDOCS_0_17_3` feature flag and always install the latest `mkdocs` version. Note this feature flag has `default_true=True` for those projects created _before 2019-04-03_. I did a small DB query and found: ```python >>> Project.objects.filter(pub_date__lt=timezone.datetime(2019, 4, 3), documentation_type='mkdocs').count() 7529 ``` However, note we don't know if these projects are pinning a version of MkDocs, so we don't exactly know how many of those are using this feature. However, it gives us a maximum number at least. On the other hand, taking a look at Metabase, using the build data from the past 6 months I found that we only have 293 projects: https://ethicalads.metabaseapp.com/question/218-projects-using-mkdocs-group-by-version Related #9779
1 parent 60ff7d6 commit a98d8fe

File tree

4 files changed

+2
-82
lines changed

4 files changed

+2
-82
lines changed

readthedocs/doc_builder/backends/mkdocs.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,7 @@ def append_conf(self):
157157
)
158158

159159
user_config['docs_dir'] = docs_dir
160-
161-
# MkDocs <=0.17.x doesn't support absolute paths,
162-
# it needs one with a full domain.
163-
if self.project.has_feature(Feature.DEFAULT_TO_MKDOCS_0_17_3):
164-
static_url = get_absolute_static_url()
165-
else:
166-
static_url = self.project.proxied_static_path
160+
static_url = self.project.proxied_static_path
167161

168162
# Set mkdocs config values.
169163
extra_assets = {

readthedocs/doc_builder/python_environments.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,7 @@ def _install_old_requirements(self, pip_install_cmd):
259259
)
260260

261261
if self.config.doctype == 'mkdocs':
262-
requirements.append(
263-
self.project.get_feature_value(
264-
Feature.DEFAULT_TO_MKDOCS_0_17_3,
265-
positive='mkdocs==0.17.3',
266-
negative="mkdocs",
267-
)
268-
)
262+
requirements.append("mkdocs")
269263
else:
270264
requirements.extend(
271265
[

readthedocs/projects/models.py

-5
Original file line numberDiff line numberDiff line change
@@ -1936,7 +1936,6 @@ def add_features(sender, **kwargs):
19361936
USE_NEW_PIP_RESOLVER = 'use_new_pip_resolver'
19371937
DONT_INSTALL_LATEST_PIP = 'dont_install_latest_pip'
19381938
USE_SPHINX_LATEST = 'use_sphinx_latest'
1939-
DEFAULT_TO_MKDOCS_0_17_3 = 'default_to_mkdocs_0_17_3'
19401939
USE_SPHINX_RTD_EXT_LATEST = 'rtd_sphinx_ext_latest'
19411940
INSTALL_LATEST_CORE_REQUIREMENTS = "install_latest_core_requirements"
19421941

@@ -2042,10 +2041,6 @@ def add_features(sender, **kwargs):
20422041
_("Build: Don't install the latest version of pip"),
20432042
),
20442043
(USE_SPHINX_LATEST, _("Sphinx: Use latest version of Sphinx")),
2045-
(
2046-
DEFAULT_TO_MKDOCS_0_17_3,
2047-
_("MkDOcs: Install mkdocs 0.17.3 by default"),
2048-
),
20492044
(
20502045
USE_SPHINX_RTD_EXT_LATEST,
20512046
_("Sphinx: Use latest version of the Read the Docs Sphinx extension"),

readthedocs/rtd_tests/tests/test_doc_builder.py

-63
Original file line numberDiff line numberDiff line change
@@ -528,69 +528,6 @@ def test_append_conf_existing_yaml_on_root(self, checkout_path, run):
528528
"mkdocs",
529529
)
530530

531-
@patch("readthedocs.doc_builder.base.BaseBuilder.run")
532-
@patch("readthedocs.projects.models.Project.checkout_path")
533-
def test_append_conf_mkdocs_07x(self, checkout_path, run):
534-
get(
535-
Feature,
536-
feature_id=Feature.DEFAULT_TO_MKDOCS_0_17_3,
537-
projects=[self.project],
538-
)
539-
tmpdir = tempfile.mkdtemp()
540-
os.mkdir(os.path.join(tmpdir, "docs"))
541-
yaml_file = os.path.join(tmpdir, "mkdocs.yml")
542-
yaml.safe_dump(
543-
{
544-
"site_name": "mkdocs",
545-
"google_analytics": ["UA-1234-5", "mkdocs.org"],
546-
"docs_dir": "docs",
547-
},
548-
open(yaml_file, "w"),
549-
)
550-
checkout_path.return_value = tmpdir
551-
552-
python_env = Virtualenv(
553-
version=self.version,
554-
build_env=self.build_env,
555-
config=None,
556-
)
557-
builder = MkdocsHTML(
558-
build_env=self.build_env,
559-
python_env=python_env,
560-
)
561-
with override_settings(DOCROOT=tmpdir):
562-
builder.append_conf()
563-
564-
run.assert_called_with('cat', 'mkdocs.yml', cwd=mock.ANY)
565-
566-
config = yaml_load_safely(open(yaml_file))
567-
self.assertEqual(
568-
config['docs_dir'],
569-
'docs',
570-
)
571-
self.assertEqual(
572-
config['extra_css'],
573-
[
574-
'http://readthedocs.org/static/css/badge_only.css',
575-
'http://readthedocs.org/static/css/readthedocs-doc-embed.css',
576-
],
577-
)
578-
self.assertEqual(
579-
config['extra_javascript'],
580-
[
581-
'readthedocs-data.js',
582-
'http://readthedocs.org/static/core/js/readthedocs-doc-embed.js',
583-
'http://readthedocs.org/static/javascript/readthedocs-analytics.js',
584-
],
585-
)
586-
self.assertIsNone(
587-
config['google_analytics'],
588-
)
589-
self.assertEqual(
590-
config['site_name'],
591-
'mkdocs',
592-
)
593-
594531
@patch('readthedocs.doc_builder.base.BaseBuilder.run')
595532
@patch('readthedocs.projects.models.Project.checkout_path')
596533
def test_append_conf_existing_yaml_on_root_with_invalid_setting(self, checkout_path, run):

0 commit comments

Comments
 (0)