Skip to content

Add support for Python 3.10.0b3 and upgrade to Miniconda3-4.9.2 #174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jul 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: 2

jobs:
tests:
docker:
- image: circleci/python:3.6
environment:
PIPENV_VENV_IN_PROJECT=1
PIPENV_IGNORE_VIRTUALENVS=1
steps:
- checkout
- setup_remote_docker:
version: 20.10.6
docker_layer_caching: true
- run:
name: Setup
command: |
pip install pipenv
pipenv install
- run:
name: Build Docker image
command: docker build -t readthedocs/build:7.0 .
- run:
name: Run tests
command: pipenv run pytest -m image_70

workflows:
version: 2
tests:
jobs:
- tests
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

48 changes: 35 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,21 @@ ENV PYTHON_VERSION_36 3.6.12
ENV PYTHON_VERSION_37 3.7.9
ENV PYTHON_VERSION_38 3.8.6
ENV PYTHON_VERSION_39 3.9.1
ENV PYTHON_VERSION_310 3.10.0b4
ENV PYPY_VERSION_35 pypy3.5-7.0.0
# Note: 4.7.12.1 drastically increases memory usage
ENV CONDA_VERSION 4.6.14
# Latest miniconda version is Miniconda3-py39_4.10.1, but it's not available for x86_64
ENV CONDA_PYTHON_VERSION py39
ENV CONDA_VERSION 4.9.2
LABEL python.version_27=$PYTHON_VERSION_27
LABEL python.version_35=$PYTHON_VERSION_35
LABEL python.version_36=$PYTHON_VERSION_36
LABEL python.version_37=$PYTHON_VERSION_37
LABEL python.version_38=$PYTHON_VERSION_38
LABEL python.version_39=$PYTHON_VERSION_39
LABEL python.version_310=$PYTHON_VERSION_310
LABEL pypy.version_35=$PYPY_VERSION_35
LABEL conda.version=$CONDA_VERSION
LABEL conda.python_version=$CONDA_PYTHON_VERSION

# System dependencies
RUN apt-get -y update
Expand Down Expand Up @@ -75,6 +79,7 @@ RUN apt-get install -y \
libncurses5-dev \
libncursesw5-dev \
libssl-dev \
libxmlsec1-dev \
llvm \
make \
python-openssl \
Expand Down Expand Up @@ -141,14 +146,6 @@ RUN apt-get -y install \
auxlib \
virtualenv==$RTD_VIRTUALENV_VERSION

# sphinx-js dependencies: jsdoc and typedoc (TypeScript support)
RUN apt-get -y install \
nodejs \
npm \
&& npm install --global \
jsdoc \
typedoc

# UID and GID from readthedocs/user
RUN groupadd --gid 205 docs
RUN useradd -m --uid 1005 --gid 205 docs
Expand All @@ -157,10 +154,10 @@ USER docs
WORKDIR /home/docs

# Install Conda
RUN curl -L -O https://repo.continuum.io/miniconda/Miniconda2-${CONDA_VERSION}-Linux-x86_64.sh
RUN bash Miniconda2-${CONDA_VERSION}-Linux-x86_64.sh -b -p /home/docs/.conda/
RUN curl -L -O https://repo.continuum.io/miniconda/Miniconda3-${CONDA_PYTHON_VERSION}_${CONDA_VERSION}-Linux-x86_64.sh && \
bash Miniconda3-${CONDA_PYTHON_VERSION}_${CONDA_VERSION}-Linux-x86_64.sh -b -p /home/docs/.conda/ && \
rm -f Miniconda3-${CONDA_PYTHON_VERSION}_${CONDA_VERSION}-Linux-x86_64.sh
ENV PATH $PATH:/home/docs/.conda/bin
RUN rm -f Miniconda2-${CONDA_VERSION}-Linux-x86_64.sh

# Install Rust
ENV RTD_RUST_VERSION 1.46.0
Expand All @@ -177,6 +174,7 @@ ENV PATH /home/docs/.pyenv/shims:$PATH:/home/docs/.pyenv/bin

# Install supported Python versions
RUN pyenv install $PYTHON_VERSION_27 && \
pyenv install $PYTHON_VERSION_310 && \
pyenv install $PYTHON_VERSION_39 && \
pyenv install $PYTHON_VERSION_38 && \
pyenv install $PYTHON_VERSION_37 && \
Expand All @@ -185,6 +183,7 @@ RUN pyenv install $PYTHON_VERSION_27 && \
pyenv install $PYPY_VERSION_35 && \
pyenv global \
$PYTHON_VERSION_27 \
$PYTHON_VERSION_310 \
$PYTHON_VERSION_39 \
$PYTHON_VERSION_38 \
$PYTHON_VERSION_37 \
Expand All @@ -202,6 +201,13 @@ RUN pyenv local $PYTHON_VERSION_27 && \

ENV RTD_PIP_VERSION 20.0.2
ENV RTD_SETUPTOOLS_VERSION 45.2.0

# NOTE: numpy is not installed by default because it's not built for Python 3.10 yet
RUN pyenv local $PYTHON_VERSION_310 && \
pyenv exec pip install --no-cache-dir -U pip==$RTD_PIP_VERSION && \
pyenv exec pip install --no-cache-dir -U setuptools==$RTD_SETUPTOOLS_VERSION && \
pyenv exec pip install --no-cache-dir virtualenv==$RTD_VIRTUALENV_VERSION

RUN pyenv local $PYTHON_VERSION_39 && \
pyenv exec pip install --no-cache-dir -U pip==$RTD_PIP_VERSION && \
pyenv exec pip install --no-cache-dir -U setuptools==$RTD_SETUPTOOLS_VERSION && \
Expand Down Expand Up @@ -238,6 +244,22 @@ RUN pyenv local $PYPY_VERSION_35 && \
pyenv exec pip install --no-cache-dir -U setuptools==$RTD_SETUPTOOLS_VERSION && \
pyenv exec pip install --no-cache-dir virtualenv==$RTD_VIRTUALENV_VERSION

# NOTE: this is moved to the bottom because apt-get finds some incompatibilities
# between packages and uninstall them:
# The following packages will be REMOVED:
# libmysqlclient-dev libssl-dev libxmlsec1-dev
# As libssl-dev and libxmlsec1-dev are required to build Python with pyenv,
# we first build Python versions and then install these packages
# sphinx-js dependencies: jsdoc and typedoc (TypeScript support)
USER root
RUN apt-get -y install \
nodejs \
npm \
&& npm install --global \
[email protected] \
[email protected]

USER docs
WORKDIR /

CMD ["/bin/bash"]
8 changes: 5 additions & 3 deletions tests/test_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@ def test_miniconda():
base_url = 'https://repo.continuum.io/miniconda'
dockerfile = get_dockerfile()
conda_version = dockerfile.envs.get('CONDA_VERSION')
conda_python_version = dockerfile.envs.get('CONDA_PYTHON_VERSION')
latest = requests.head(
'{base}/Miniconda2-latest-Linux-x86_64.sh'.format(
'{base}/Miniconda3-latest-Linux-x86_64.sh'.format(
base=base_url
)
)
current = requests.head(
'{base}/Miniconda2-{version}-Linux-x86_64.sh'.format(
'{base}/Miniconda3-{conda_python_version}_{conda_version}-Linux-x86_64.sh'.format(
base=base_url,
version=conda_version,
conda_python_version=conda_python_version,
conda_version=conda_version,
)
)
assert current.headers['etag'] == latest.headers['etag']
9 changes: 7 additions & 2 deletions tests/test_versions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pytest
from docker import APIClient

from .utils import run_command_in_container

Expand Down Expand Up @@ -57,6 +56,7 @@ def test_command_versions_image_master(command, expected_output):
('python3.7 --version', 'Python 3.7.9'),
('python3.8 --version', 'Python 3.8.6'),
('python3.9 --version', 'Python 3.9.1'),
('python3.10 --version', 'Python 3.10.0b4'),
('pypy3.5 --version', 'Python 3.5.3 (928a4f70d3de7d17449456946154c5da6e600162, Feb 09 2019, 11:50:43)\n[PyPy 7.0.0 with GCC 8.2.0]'),
# pip
('python2 -m pip --version', "pip 20.0.2 from /home/docs/.pyenv/versions/2.7.18/lib/python2.7/site-packages/pip (python 2.7)"),
Expand All @@ -65,26 +65,31 @@ def test_command_versions_image_master(command, expected_output):
('python3.7 -m pip --version', "pip 20.0.2 from /home/docs/.pyenv/versions/3.7.9/lib/python3.7/site-packages/pip (python 3.7)"),
('python3.8 -m pip --version', "pip 20.0.2 from /home/docs/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip (python 3.8)"),
('python3.9 -m pip --version', "pip 20.0.2 from /home/docs/.pyenv/versions/3.9.1/lib/python3.9/site-packages/pip (python 3.9)"),
('python3.10 -m pip --version', "pip 20.0.2 from /home/docs/.pyenv/versions/3.10.0b4/lib/python3.10/site-packages/pip (python 3.10)"),
# setuptools
('python2 -c "import setuptools; print(setuptools.__version__)"', "44.0.0"),
('python3.5 -c "import setuptools; print(setuptools.__version__)"', "45.2.0"),
('python3.6 -c "import setuptools; print(setuptools.__version__)"', "45.2.0"),
('python3.7 -c "import setuptools; print(setuptools.__version__)"', "45.2.0"),
('python3.8 -c "import setuptools; print(setuptools.__version__)"', "45.2.0"),
('python3.9 -c "import setuptools; print(setuptools.__version__)"', "45.2.0"),
('python3.10 -c "import setuptools; print(setuptools.__version__)"', "45.2.0"),
# virtualenv
('python2 -m virtualenv --version', 'virtualenv 20.0.7 from /home/docs/.pyenv/versions/2.7.18/lib/python2.7/site-packages/virtualenv/__init__.pyc'),
('python3.5 -m virtualenv --version', 'virtualenv 20.0.7 from /home/docs/.pyenv/versions/3.5.10/lib/python3.5/site-packages/virtualenv/__init__.py'),
('python3.6 -m virtualenv --version', 'virtualenv 20.0.7 from /home/docs/.pyenv/versions/3.6.12/lib/python3.6/site-packages/virtualenv/__init__.py'),
('python3.7 -m virtualenv --version', 'virtualenv 20.0.7 from /home/docs/.pyenv/versions/3.7.9/lib/python3.7/site-packages/virtualenv/__init__.py'),
('python3.8 -m virtualenv --version', 'virtualenv 20.0.7 from /home/docs/.pyenv/versions/3.8.6/lib/python3.8/site-packages/virtualenv/__init__.py'),
('python3.9 -m virtualenv --version', 'virtualenv 20.0.7 from /home/docs/.pyenv/versions/3.9.1/lib/python3.9/site-packages/virtualenv/__init__.py'),
('python3.10 -m virtualenv --version', 'virtualenv 20.0.7 from /home/docs/.pyenv/versions/3.10.0b4/lib/python3.10/site-packages/virtualenv/__init__.py'),
# others
('node --version', 'v8.10.0'),
('npm --version', '3.5.2'),
('conda --version', 'conda 4.6.14'),
('conda --version', 'conda 4.9.2'),
('cargo --version', 'cargo 1.46.0 (149022b1d 2020-07-17)'),
('git --version', 'git version 2.17.1'),
('jsdoc --version', 'JSDoc 3.6.6 (Sun, 20 Sep 2020 02:25:14 GMT)'),
('cat /usr/local/lib/node_modules/typedoc/package.json | grep -E "version.:"', '"version": "0.20.20"'),
]
)
def test_command_versions_image_70(command, expected_output):
Expand Down
5 changes: 3 additions & 2 deletions tests/utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from docker import APIClient
import docker


def run_command_in_container(container_image, command):
client = APIClient()
# CircleCI exports environment variables that ``.from_env()`` uses
client = docker.from_env().api

# Create the container
container = client.create_container(
Expand Down