Skip to content

python-helpers/docker-image-management

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 

Repository files navigation

Management of Python-related tools and container images

Table of Content (ToC)

Table of contents generated with markdown-toc

Overview

References

Projects this repository helps to manage

Light images to support Machine Learning (ML) in Python

Images to support Data Processing Pipelines (DPP)

Images to support development on C++ and Python stacks

General C++/Python development

Python Machine Learning (ML)

Python cloud images

Python tools for OpenTravelData (OPTD)

Quality Assurance (QA) for OpenTravelData (OPTD)

Python bindings for OpenTravelData (OPTD)

Python bindings for OpenTREP

Python installation

Procedures

New Python stable version

Add the new Python version to the C++/Python Docker images

$ cat ubuntu2204/Dockerfile
...
# Python 3.12.3
RUN pyenv install 3.12.3 && \
    pyenv global 3.12.3 && \
    python -mpip install -U pip pipenv
RUN pyenv global system || echo "No default system version of Python. Sticking to 3.12.3"
...
  • Keeping at least one of the older versions of Python (3.10.13 and 3.11.8 here) gives the teams managing downstream Docker images the time to catch up.

Update the Python environment of the Python Jupyter Docker image

The ML Python Jupyter Docker images are built on top of the generic C++/Python images, described in the section above. The Python versions are therefore controlled by those Docker images.

The Python virtual environment specifications need however to be upgraded. Files to update:

Update the Python environment of the Python light Docker image

The default Python versions for light images (e.g., Alpine, Debian and Debian Slim), as maintained by Docker itself (on GitHub and on Docker Hub), are usually the latest Python stable versions, only a few days after they have been released. There is hence no need to upgrade the Python version on the light Docker images.

Non Docker projects to update

Machine Learning (ML) induction

Reference: ML-related Python induction project

Note that this Git repository is also a sub-module of the Python Jupyter Docker image project

There are two folders in that project where the Python setup has to be updated:

$ pipenv install
  pipenv requirements > requirements.txt
  git add requirements.txt
  git commit -m "Upgreded the Python dependencies"

Then, the ML Docker project (see above) should be updated to point to the new Python ML induction head.

  • Clone the ML Docker project and initialize sub-modules (if needed):
$ mkdir -p ~/dev/ml && git clone https://github.com/machine-learning-helpers/docker-python-jupyter ~/dev/ml/docker-python-jupyter
$ cd ~/dev/ml/docker-python-jupyter
$ git submodule init
$ git submodule update --recursive --force
  • Pull (with Git) the head of the master branch on the ML induction module:
$ cd ~/dev/ml/docker-python-jupyter/notebook/induction
$ git checkout master
$ git pull
  • Add, commit and push (with Git) the newly updated module:
$ cd ~/dev/ml/docker-python-jupyter
$ git add notebook/induction
$ git commit -m "[Modules] Updated the Python ML induction module"
$ git push

Python tools for OpenTravelData (OPTD)

References:

Files to update:

Quality Assurance (QA) for OpenTravelData (OPTD)

References:

Files to update:

Python bindings for OpenTravelData (OPTD)

References:

Files to update:

Publish the component on PyPi:

user@laptop$ cd ~/dev/geo/python-opentraveldata
user@laptop$ rm -rf dist
user@laptop$ python -mbuild
user@laptop$ PYPIURL="https://test.pypi.org"
user@laptop$ twine upload -u __token__ --repository-url ${PYPIURL}/legacy/ dist/*
user@laptop$ PYPIURL="https://pypi.org"
user@laptop$ #keyring set ${PYPIURL}/ __token__
user@laptop$ twine upload -u __token__ --non-interactive dist/*

The result should available on PyPi, e.g., https://pypi.org/project/opentraveldata/0.0.9.post2/

Python bindings for OpenTREP

References:

Files to update:

Publish the component on PyPi:

user@laptop$ rm -rf dist && mkdir dist
user@laptop$ python setup.py sdist bdist_wheel
user@laptop$ PYPIURL="https://test.pypi.org"
user@laptop$ twine upload -u __token__ --repository-url ${PYPIURL}/legacy/ dist/*
user@laptop$ PYPIURL="https://pypi.org"
user@laptop$ #keyring set ${PYPIURL}/ __token__
user@laptop$ twine upload -u __token__ --non-interactive dist/*

The resulting artifact should be available on PyPi, e.g.: https://pypi.org/project/OpenTrepWrapper/0.7.7.post3/

Installation or update of a Python virtual environment

  • In a folder governed by Pipfile:
    • To install the dedicated Python virtual environment:
$ pipenv install; pipenv install --dev
  • To update the dedicated Python virtual environment:
$ pipenv update
  • On MacOS, with the psycopg2 module, there may be some trouble at installation time related to an issue with SSL libraries. It can usually be solved with:
$ LDFLAGS="-I/usr/local/opt/openssl/include" CPPFLAGS="-L/usr/local/opt/openssl/lib" pipenv install psycopg2
Installing psycopg2
Adding psycopg2 to Pipfile's [packages]
✔ Installation Succeeded 
$ pipenv install; pipenv install --dev

About

Management of Docker images across other repositories

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published