Skip to content

Commit ac87f67

Browse files
authored
Build: remove conda_append_core_requirements feature flag (#11847)
We have had this flag set for a while now.
1 parent 65b835e commit ac87f67

File tree

3 files changed

+30
-91
lines changed

3 files changed

+30
-91
lines changed

readthedocs/doc_builder/python_environments.py

+7-44
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,8 @@ def conda_bin_name(self):
239239
return self.config.python_interpreter
240240

241241
def setup_base(self):
242-
if self.project.has_feature(Feature.CONDA_APPEND_CORE_REQUIREMENTS):
243-
self._append_core_requirements()
244-
self._show_environment_yaml()
242+
self._append_core_requirements()
243+
self._show_environment_yaml()
245244

246245
self.build_env.run(
247246
self.conda_bin_name(),
@@ -357,48 +356,12 @@ def _get_core_requirements(self):
357356
return pip_requirements, conda_requirements
358357

359358
def install_core_requirements(self):
360-
"""Install basic Read the Docs requirements into the Conda env."""
361-
362-
if self.project.has_feature(Feature.CONDA_APPEND_CORE_REQUIREMENTS):
363-
# Skip install core requirements since they were already appended to
364-
# the user's ``environment.yml`` and installed at ``conda env
365-
# create`` step.
366-
return
367-
368-
pip_requirements, conda_requirements = self._get_core_requirements()
369-
# Install requirements via ``conda install`` command if they were
370-
# not appended to the ``environment.yml`` file.
371-
cmd = [
372-
self.conda_bin_name(),
373-
"install",
374-
"--yes",
375-
"--quiet",
376-
"--name",
377-
self.version.slug,
378-
]
379-
cmd.extend(conda_requirements)
380-
self.build_env.run(
381-
*cmd,
382-
cwd=self.checkout_path,
383-
# TODO: on tests I found that we are not passing ``bin_path`` here
384-
# for some reason.
385-
)
359+
"""
360+
Skip installing requirements.
386361
387-
# Install requirements via ``pip install``
388-
pip_cmd = [
389-
self.venv_bin(filename="python"),
390-
"-m",
391-
"pip",
392-
"install",
393-
"-U",
394-
"--no-cache-dir",
395-
]
396-
pip_cmd.extend(pip_requirements)
397-
self.build_env.run(
398-
*pip_cmd,
399-
bin_path=self.venv_bin(),
400-
cwd=self.checkout_path, # noqa - no comma here in py27 :/
401-
)
362+
Skip installing core requirements, since they were already appended to
363+
the user's ``environment.yml`` and installed at ``conda env create`` step.
364+
"""
402365

403366
def install_requirements_file(self, install):
404367
# as the conda environment was created by using the ``environment.yml``

readthedocs/projects/models.py

-5
Original file line numberDiff line numberDiff line change
@@ -1878,7 +1878,6 @@ def add_features(sender, **kwargs):
18781878
# Feature constants - this is not a exhaustive list of features, features
18791879
# may be added by other packages
18801880
API_LARGE_DATA = "api_large_data"
1881-
CONDA_APPEND_CORE_REQUIREMENTS = "conda_append_core_requirements"
18821881
RECORD_404_PAGE_VIEWS = "record_404_page_views"
18831882
DISABLE_PAGEVIEWS = "disable_pageviews"
18841883
RESOLVE_PROJECT_FROM_HEADER = "resolve_project_from_header"
@@ -1909,10 +1908,6 @@ def add_features(sender, **kwargs):
19091908
API_LARGE_DATA,
19101909
_("Build: Try alternative method of posting large data"),
19111910
),
1912-
(
1913-
CONDA_APPEND_CORE_REQUIREMENTS,
1914-
_("Conda: Append Read the Docs core requirements to environment.yml file"),
1915-
),
19161911
(
19171912
RECORD_404_PAGE_VIEWS,
19181913
_("Proxito: Record 404s page views."),

readthedocs/projects/tests/test_build_tasks.py

+23-42
Original file line numberDiff line numberDiff line change
@@ -1552,8 +1552,13 @@ def test_requirements_from_config_file_installed(self, load_yaml_config):
15521552
]
15531553
)
15541554

1555+
@mock.patch("readthedocs.core.utils.filesystem.assert_path_is_inside_docroot")
15551556
@mock.patch("readthedocs.doc_builder.director.load_yaml_config")
1556-
def test_conda_config_calls_conda_command(self, load_yaml_config):
1557+
def test_conda_config_calls_conda_command(
1558+
self, load_yaml_config, assert_path_is_inside_docroot
1559+
):
1560+
# While testing, we are unsure if temporary test files exist in the docroot.
1561+
assert_path_is_inside_docroot.return_value = True
15571562
load_yaml_config.return_value = get_build_config(
15581563
{
15591564
"version": 2,
@@ -1588,34 +1593,19 @@ def test_conda_config_calls_conda_command(self, load_yaml_config):
15881593
mock.call("asdf", "global", "python", python_version),
15891594
mock.call("asdf", "reshim", "python", record=False),
15901595
mock.call(
1591-
"conda",
1592-
"env",
1593-
"create",
1594-
"--quiet",
1595-
"--name",
1596-
self.version.slug,
1597-
"--file",
1596+
"cat",
15981597
"environment.yaml",
15991598
cwd=mock.ANY,
1600-
bin_path=mock.ANY,
16011599
),
16021600
mock.call(
16031601
"conda",
1604-
"install",
1605-
"--yes",
1602+
"env",
1603+
"create",
16061604
"--quiet",
16071605
"--name",
16081606
self.version.slug,
1609-
"sphinx",
1610-
cwd=mock.ANY,
1611-
),
1612-
mock.call(
1613-
mock.ANY,
1614-
"-m",
1615-
"pip",
1616-
"install",
1617-
"-U",
1618-
"--no-cache-dir",
1607+
"--file",
1608+
"environment.yaml",
16191609
cwd=mock.ANY,
16201610
bin_path=mock.ANY,
16211611
),
@@ -1654,8 +1644,13 @@ def test_conda_config_calls_conda_command(self, load_yaml_config):
16541644
],
16551645
)
16561646

1647+
@mock.patch("readthedocs.core.utils.filesystem.assert_path_is_inside_docroot")
16571648
@mock.patch("readthedocs.doc_builder.director.load_yaml_config")
1658-
def test_python_mamba_commands(self, load_yaml_config):
1649+
def test_python_mamba_commands(
1650+
self, load_yaml_config, assert_path_is_inside_docroot
1651+
):
1652+
# While testing, we are unsure if temporary test files exist in the docroot.
1653+
assert_path_is_inside_docroot.return_value = True
16591654
load_yaml_config.return_value = get_build_config(
16601655
{
16611656
"version": 2,
@@ -1683,6 +1678,11 @@ def test_python_mamba_commands(self, load_yaml_config):
16831678
mock.call("asdf", "install", "python", "mambaforge-4.10.3-10"),
16841679
mock.call("asdf", "global", "python", "mambaforge-4.10.3-10"),
16851680
mock.call("asdf", "reshim", "python", record=False),
1681+
mock.call(
1682+
"cat",
1683+
"environment.yaml",
1684+
cwd=mock.ANY,
1685+
),
16861686
mock.call(
16871687
"mamba",
16881688
"env",
@@ -1695,26 +1695,7 @@ def test_python_mamba_commands(self, load_yaml_config):
16951695
bin_path=None,
16961696
cwd=mock.ANY,
16971697
),
1698-
mock.call(
1699-
"mamba",
1700-
"install",
1701-
"--yes",
1702-
"--quiet",
1703-
"--name",
1704-
"latest",
1705-
"sphinx",
1706-
cwd=mock.ANY,
1707-
),
1708-
mock.call(
1709-
mock.ANY,
1710-
"-m",
1711-
"pip",
1712-
"install",
1713-
"-U",
1714-
"--no-cache-dir",
1715-
bin_path=mock.ANY,
1716-
cwd=mock.ANY,
1717-
),
1698+
mock.call("test", "-x", "_build/html", cwd=mock.ANY, record=False),
17181699
]
17191700
)
17201701

0 commit comments

Comments
 (0)