diff mbox

Install Python 3.4 in Docker

Message ID 1472194559-7631-1-git-send-email-dja@axtens.net
State Accepted
Headers show

Commit Message

Daniel Axtens Aug. 26, 2016, 6:55 a.m. UTC
Currently, we tox test against Python 3.4. Python 3.4 is included
with Ubuntu 14.04, which is supported for several years to come,
so we want to keep supporting it.

However, Python 3.4 isn't included with Ubuntu 16.04, which is
what the Docker image is based on.

We could downgrade the container to 14.04, but then we'd struggle
to get Python 3.5 into the container. Python 3.5 is the most
recent in the Python 3 series, so we should also be supporting it.

Add the apt sources for Trusty and pull in Python 3.4 from there.

Signed-off-by: Daniel Axtens <dja@axtens.net>

---

This is a bit hacky, but I can't think of anything much better.
If I downgrade to 14.04, you'd need to go through something similar
for 3.5. We could download and build from source, but that seems
even worse.
---
 docker/Dockerfile  | 8 ++++++--
 docker/trusty.list | 3 +++
 2 files changed, 9 insertions(+), 2 deletions(-)
 create mode 100644 docker/trusty.list

Comments

Stephen Finucane Aug. 29, 2016, 11:46 p.m. UTC | #1
On 26 Aug 16:55, Daniel Axtens wrote:
> Currently, we tox test against Python 3.4. Python 3.4 is included
> with Ubuntu 14.04, which is supported for several years to come,
> so we want to keep supporting it.
> 
> However, Python 3.4 isn't included with Ubuntu 16.04, which is
> what the Docker image is based on.
> 
> We could downgrade the container to 14.04, but then we'd struggle
> to get Python 3.5 into the container. Python 3.5 is the most
> recent in the Python 3 series, so we should also be supporting it.
> 
> Add the apt sources for Trusty and pull in Python 3.4 from there.
> 
> Signed-off-by: Daniel Axtens <dja@axtens.net>

I need to test this, but it looks good. Just to confirm, the aim is to
get both Python 3.4 and 3.5 on the system, correct?

Stephen

> ---
> 
> This is a bit hacky, but I can't think of anything much better.
> If I downgrade to 14.04, you'd need to go through something similar
> for 3.5. We could download and build from source, but that seems
> even worse.

No, this is definitely the best approach. I'd be curious to know how
Travis and the likes do this.

Stephen
Daniel Axtens Aug. 30, 2016, 12:50 a.m. UTC | #2
Stephen Finucane <stephenfinucane@hotmail.com> writes:

> On 26 Aug 16:55, Daniel Axtens wrote:
>> Currently, we tox test against Python 3.4. Python 3.4 is included
>> with Ubuntu 14.04, which is supported for several years to come,
>> so we want to keep supporting it.
>> 
>> However, Python 3.4 isn't included with Ubuntu 16.04, which is
>> what the Docker image is based on.
>> 
>> We could downgrade the container to 14.04, but then we'd struggle
>> to get Python 3.5 into the container. Python 3.5 is the most
>> recent in the Python 3 series, so we should also be supporting it.
>> 
>> Add the apt sources for Trusty and pull in Python 3.4 from there.
>> 
>> Signed-off-by: Daniel Axtens <dja@axtens.net>
>
> I need to test this, but it looks good. Just to confirm, the aim is to
> get both Python 3.4 and 3.5 on the system, correct?

Yes, that's right. I can tweak the commit message if you like.

>
> Stephen
>
>> ---
>> 
>> This is a bit hacky, but I can't think of anything much better.
>> If I downgrade to 14.04, you'd need to go through something similar
>> for 3.5. We could download and build from source, but that seems
>> even worse.
>
> No, this is definitely the best approach. I'd be curious to know how
> Travis and the likes do this.

I sadly know more than I would like about how Travis works.
Basically they keep a big bundle of pre-built Pythons on S3 and use
pyenv (think rbenv but for python) to install them and set them up. We
could look into that I guess - but I'm not a big fan: I think unless we
are wanting to test against a much greater range of versions we don't
need the complexity yet.

Regards,
Daniel
Stephen Finucane Sept. 1, 2016, 8:32 p.m. UTC | #3
On 30 Aug 10:50, Daniel Axtens wrote:
> Stephen Finucane <stephenfinucane@hotmail.com> writes:
> 
> > On 26 Aug 16:55, Daniel Axtens wrote:
> >> Currently, we tox test against Python 3.4. Python 3.4 is included
> >> with Ubuntu 14.04, which is supported for several years to come,
> >> so we want to keep supporting it.
> >> 
> >> However, Python 3.4 isn't included with Ubuntu 16.04, which is
> >> what the Docker image is based on.
> >> 
> >> We could downgrade the container to 14.04, but then we'd struggle
> >> to get Python 3.5 into the container. Python 3.5 is the most
> >> recent in the Python 3 series, so we should also be supporting it.
> >> 
> >> Add the apt sources for Trusty and pull in Python 3.4 from there.
> >> 
> >> Signed-off-by: Daniel Axtens <dja@axtens.net>
> >
> > I need to test this, but it looks good. Just to confirm, the aim is to
> > get both Python 3.4 and 3.5 on the system, correct?
> 
> Yes, that's right. I can tweak the commit message if you like.

No need, I'll do that.

Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>

I wonder if it would be worth looking at the 'deadsnake' repo at some
point in the future? Perhaps when Python 3.6 is release?

Stephen
diff mbox

Patch

diff --git a/docker/Dockerfile b/docker/Dockerfile
index ea2a8fc5ab77..77a3a19c4800 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -12,10 +12,14 @@  ENV DEBIAN_FRONTEND noninteractive
 ENV PYTHONUNBUFFERED 1
 
 # System
+# python3.4-minimal libpython3.4-stdlib libpython3.4-minimal \
+# findutils is for python3.4... :/
+COPY docker/trusty.list /etc/apt/sources.list.d/trusty.list
 RUN apt-get update -qq && \
-    apt-get install -y --no-install-recommends \
+    apt-get install -y --no-install-recommends --allow-downgrades \
     python-dev python-pip python-setuptools python-wheel \
-    python3-dev python3-pip python3-setuptools python3-wheel \
+    python3.5-dev python3-pip python3-setuptools python3-wheel \
+    python3.4-dev findutils=4.4.2-7 \
     libmysqlclient-dev mysql-client curl unzip xvfb chromium-chromedriver \
     chromium-browser build-essential && \
     ln -s /usr/lib/chromium-browser/chromedriver /usr/bin/
diff --git a/docker/trusty.list b/docker/trusty.list
new file mode 100644
index 000000000000..8bb92c09a71f
--- /dev/null
+++ b/docker/trusty.list
@@ -0,0 +1,3 @@ 
+deb http://archive.ubuntu.com/ubuntu/ trusty main
+deb http://archive.ubuntu.com/ubuntu/ trusty-updates main
+deb http://security.ubuntu.com/ubuntu trusty-security main