Skip to content

Commit 5e2c781

Browse files
authored
Merge pull request #3581 from stsewd/python3-default-env
Set python3 as default interpreter
2 parents 080d6cf + d4441c6 commit 5e2c781

File tree

5 files changed

+33
-14
lines changed

5 files changed

+33
-14
lines changed

docs/config-file/v1.rst

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ The ``build`` block configures specific aspects of the documentation build.
112112
build.image
113113
```````````
114114

115-
* Default: :djangosetting:`DOCKER_IMAGE`
116-
* Options: ``1.0``, ``2.0``, ``latest``
115+
* Default: :djangosetting:`DOCKER_DEFAULT_VERSION`
116+
* Options: ``stable``, ``latest``
117117

118118
The build image to use for specific builds.
119119
This lets users specify a more experimental build image,
@@ -122,9 +122,8 @@ if they want to be on the cutting edge.
122122
Certain Python versions require a certain build image,
123123
as defined here:
124124

125-
* ``1.0``: 2, 2.7, 3, 3.4
126-
* ``2.0``: 2, 2.7, 3, 3.5
127-
* ``latest``: 2, 2.7, 3, 3.3, 3.4, 3.5, 3.6
125+
* ``stable``: :buildpyversions:`stable`
126+
* ``latest``: :buildpyversions:`latest`
128127

129128
.. code-block:: yaml
130129
@@ -147,8 +146,8 @@ used for building documentation.
147146
python.version
148147
``````````````
149148

150-
* Default: ``2.7``
151-
* Options: ``2.7``, ``2``, ``3.5``, ``3``
149+
* Default: ``3.7``
150+
* Options: :buildpyversions:`latest`
152151

153152
This is the version of Python to use when building your documentation.
154153
If you specify only the major version of Python,
@@ -158,7 +157,7 @@ the highest supported minor version will be selected.
158157

159158
The supported Python versions depends on the version of the build image your
160159
project is using. The default build image that is used to build
161-
documentation contains support for Python ``2.7`` and ``3.5``. See the
160+
documentation contains support for Python ``2.7`` and ``3.7``. See the
162161
:ref:`yaml__build__image` for more information on supported Python versions.
163162

164163
.. code-block:: yaml
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.11.18 on 2019-02-04 16:49
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations, models
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
('projects', '0037_add_htmlfile'),
12+
]
13+
14+
operations = [
15+
migrations.AlterField(
16+
model_name='project',
17+
name='python_interpreter',
18+
field=models.CharField(choices=[('python', 'CPython 2.x'), ('python3', 'CPython 3.x')], default='python3', help_text='The Python interpreter used to create the virtual environment.', max_length=20, verbose_name='Python Interpreter'),
19+
),
20+
]

readthedocs/projects/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ class Project(models.Model):
303303
_('Python Interpreter'),
304304
max_length=20,
305305
choices=constants.PYTHON_CHOICES,
306-
default='python',
306+
default='python3',
307307
help_text=_(
308308
'The Python interpreter used to create the virtual '
309309
'environment.',

readthedocs/rtd_tests/tests/test_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1468,7 +1468,7 @@ def test_get_version_by_id(self):
14681468
'language': 'en',
14691469
'name': 'Pip',
14701470
'programming_language': 'words',
1471-
'python_interpreter': 'python',
1471+
'python_interpreter': 'python3',
14721472
'repo': 'https://github.com/pypa/pip',
14731473
'repo_type': 'git',
14741474
'requirements_file': None,

readthedocs/rtd_tests/tests/test_config_integration.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def test_python_supported_versions_default_image_1_0(self, load_config):
9797
],
9898
'use_system_packages': self.project.use_system_packages,
9999
'requirements_file': self.project.requirements_file,
100-
'python_version': 2,
100+
'python_version': 3,
101101
'sphinx_configuration': mock.ANY,
102102
'build_image': 'readthedocs/build:1.0',
103103
'doctype': self.project.documentation_type,
@@ -112,7 +112,7 @@ def test_python_supported_versions_default_image_1_0(self, load_config):
112112
path=mock.ANY,
113113
env_config=expected_env_config,
114114
)
115-
self.assertEqual(config.python.version, 2)
115+
self.assertEqual(config.python.version, 3)
116116

117117
@mock.patch('readthedocs.doc_builder.config.load_config')
118118
def test_python_supported_versions_image_1_0(self, load_config):
@@ -151,8 +151,8 @@ def test_python_supported_versions_image_latest(self, load_config):
151151
def test_python_default_version(self, load_config):
152152
load_config.side_effect = create_load()
153153
config = load_yaml_config(self.version)
154-
self.assertEqual(config.python.version, 2)
155-
self.assertEqual(config.python_interpreter, 'python2.7')
154+
self.assertEqual(config.python.version, 3)
155+
self.assertEqual(config.python_interpreter, 'python3.7')
156156

157157
@mock.patch('readthedocs.doc_builder.config.load_config')
158158
def test_python_set_python_version_on_project(self, load_config):

0 commit comments

Comments
 (0)