Skip to content

Commit

Permalink
Merge pull request #108 from cvpaperchallenge/107/feat-support-larger…
Browse files Browse the repository at this point in the history
…-python-version

feat: support larger python version
  • Loading branch information
gatheluck authored Jul 25, 2024
2 parents aaf7915 + a3d89d6 commit 8f59e3e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu]
python-version: ["3.8", "3.9"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
include:
- os: ubuntu
image: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Ascender

![stable](https://img.shields.io/badge/stable-v0.1.3-blue)
![python versions](https://img.shields.io/badge/python-3.8%20%7C%203.9-blue)
![python versions](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue)
[![tests](https://github.com/cvpaperchallenge/Ascender/actions/workflows/lint-and-test.yaml/badge.svg)](https://github.com/cvpaperchallenge/Ascender/actions/workflows/lint-and-test.yaml)
[![MIT License](https://img.shields.io/github/license/cvpaperchallenge/Ascender?color=green)](LICENSE)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
Expand Down
36 changes: 20 additions & 16 deletions environments/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,25 @@ ENV DEBIAN_FRONTEND="noninteractive" \
LANG="C.UTF-8" \
PYTHONPATH=${APPLICATION_DIRECTORY}

# Following is needed to install python 3.7
RUN apt update && apt install --no-install-recommends -y software-properties-common
RUN add-apt-repository ppa:deadsnakes/ppa

RUN apt update && apt install --no-install-recommends -y \
git curl make ssh openssh-client \
python${PYTHON_VERSION} python3-pip python-is-python3

# Following is needed to swtich default python3 version
# For detail, please check following link https://unix.stackexchange.com/questions/410579/change-the-python3-default-version-in-ubuntu
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python${PYTHON_VERSION} 1 \
&& update-alternatives --set python3 /usr/bin/python${PYTHON_VERSION} \
# `requests` needs to be upgraded to avoid RequestsDependencyWarning
# ref: https://stackoverflow.com/questions/56155627/requestsdependencywarning-urllib3-1-25-2-or-chardet-3-0-4-doesnt-match-a-s
&& python3 -m pip install --upgrade pip setuptools requests \
RUN apt update -y && apt install --no-install-recommends -y software-properties-common \
# Add deadsnakes PPA to install older Python versions
&& add-apt-repository ppa:deadsnakes/ppa \
&& apt-get update && apt-get install -y \
# Install specified Python
python${PYTHON_VERSION} python${PYTHON_VERSION}-dev python3-pip python3-dev python-is-python3 \
build-essential openssl libssl-dev libffi-dev ca-certificates git curl make ssh openssh-client \
&& update-ca-certificates \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Swtich default python3 version
RUN update-alternatives --install /usr/bin/python python /usr/bin/python${PYTHON_VERSION} 1 \
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python${PYTHON_VERSION} 1

# Install pip for specified Python version
RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python${PYTHON_VERSION}

RUN python3 -m pip install --upgrade pip setuptools requests wheel six urllib3 \
&& python3 -m pip install poetry

# Add user. Without this, following process is executed as admin.
Expand All @@ -41,6 +45,6 @@ WORKDIR ${APPLICATION_DIRECTORY}

# If ${RUN_POETRY_INSTALL_AT_BUILD_TIME} = "true", install Python package by Poetry and move .venv under ${HOME}.
# This process is for CI (GitHub Actions). To prevent overwrite by volume of docker compose, .venv is moved under ${HOME}.
COPY --chown=${UID}:${GID} pyproject.toml poetry.lock poetry.toml .
COPY --chown=${UID}:${GID} pyproject.toml poetry.lock poetry.toml ./
RUN test ${RUN_POETRY_INSTALL_AT_BUILD_TIME} = "true" && poetry install || echo "skip to run poetry install."
RUN test ${RUN_POETRY_INSTALL_AT_BUILD_TIME} = "true" && mv ${APPLICATION_DIRECTORY}/.venv ${HOME}/.venv || echo "skip to move .venv."
2 changes: 1 addition & 1 deletion environments/gpu/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
build:
args:
- BASE_IMAGE=nvidia/cuda:11.0.3-devel-ubuntu20.04
- PYTHON_VERSION=3.8
- PYTHON_VERSION=3.12
- UID=${HOST_UID-1000}
- GID=${HOST_GID-1000}
- PROJECT_NAME=${PROJECT_NAME_ENV}
Expand Down

0 comments on commit 8f59e3e

Please sign in to comment.