Skip to content

Commit

Permalink
Merge pull request #3581 from stsewd/python3-default-env
Browse files Browse the repository at this point in the history
Set python3 as default interpreter
  • Loading branch information
stsewd authored Feb 6, 2019
2 parents 080d6cf + d4441c6 commit 5e2c781
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 14 deletions.
15 changes: 7 additions & 8 deletions docs/config-file/v1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ The ``build`` block configures specific aspects of the documentation build.
build.image
```````````

* Default: :djangosetting:`DOCKER_IMAGE`
* Options: ``1.0``, ``2.0``, ``latest``
* Default: :djangosetting:`DOCKER_DEFAULT_VERSION`
* Options: ``stable``, ``latest``

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

* ``1.0``: 2, 2.7, 3, 3.4
* ``2.0``: 2, 2.7, 3, 3.5
* ``latest``: 2, 2.7, 3, 3.3, 3.4, 3.5, 3.6
* ``stable``: :buildpyversions:`stable`
* ``latest``: :buildpyversions:`latest`

.. code-block:: yaml
Expand All @@ -147,8 +146,8 @@ used for building documentation.
python.version
``````````````

* Default: ``2.7``
* Options: ``2.7``, ``2``, ``3.5``, ``3``
* Default: ``3.7``
* Options: :buildpyversions:`latest`

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

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

.. code-block:: yaml
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-02-04 16:49
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('projects', '0037_add_htmlfile'),
]

operations = [
migrations.AlterField(
model_name='project',
name='python_interpreter',
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'),
),
]
2 changes: 1 addition & 1 deletion readthedocs/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ class Project(models.Model):
_('Python Interpreter'),
max_length=20,
choices=constants.PYTHON_CHOICES,
default='python',
default='python3',
help_text=_(
'The Python interpreter used to create the virtual '
'environment.',
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/rtd_tests/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1468,7 +1468,7 @@ def test_get_version_by_id(self):
'language': 'en',
'name': 'Pip',
'programming_language': 'words',
'python_interpreter': 'python',
'python_interpreter': 'python3',
'repo': 'https://github.com/pypa/pip',
'repo_type': 'git',
'requirements_file': None,
Expand Down
8 changes: 4 additions & 4 deletions readthedocs/rtd_tests/tests/test_config_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def test_python_supported_versions_default_image_1_0(self, load_config):
],
'use_system_packages': self.project.use_system_packages,
'requirements_file': self.project.requirements_file,
'python_version': 2,
'python_version': 3,
'sphinx_configuration': mock.ANY,
'build_image': 'readthedocs/build:1.0',
'doctype': self.project.documentation_type,
Expand All @@ -112,7 +112,7 @@ def test_python_supported_versions_default_image_1_0(self, load_config):
path=mock.ANY,
env_config=expected_env_config,
)
self.assertEqual(config.python.version, 2)
self.assertEqual(config.python.version, 3)

@mock.patch('readthedocs.doc_builder.config.load_config')
def test_python_supported_versions_image_1_0(self, load_config):
Expand Down Expand Up @@ -151,8 +151,8 @@ def test_python_supported_versions_image_latest(self, load_config):
def test_python_default_version(self, load_config):
load_config.side_effect = create_load()
config = load_yaml_config(self.version)
self.assertEqual(config.python.version, 2)
self.assertEqual(config.python_interpreter, 'python2.7')
self.assertEqual(config.python.version, 3)
self.assertEqual(config.python_interpreter, 'python3.7')

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

0 comments on commit 5e2c781

Please sign in to comment.