{"id":15009137,"url":"https://github.com/atxtechbro/dockerchangemypythonversion","last_synced_at":"2025-12-11T18:01:39.736Z","repository":{"id":214685337,"uuid":"397794329","full_name":"atxtechbro/DockerChangeMyPythonVersion","owner":"atxtechbro","description":"Pythonic way to use Docker to easily switch back and forth between any Python versions from Python 2 to the latest Release Candidate (RC)","archived":false,"fork":false,"pushed_at":"2021-08-22T18:05:58.000Z","size":81,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-19T02:53:09.763Z","etag":null,"topics":["docker","docker-images","python2","python2-7","python27","python3","python35","python36","python37","python38","python39","pythonrc","releasecandidate"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/atxtechbro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-08-19T02:39:18.000Z","updated_at":"2021-08-22T18:06:00.000Z","dependencies_parsed_at":"2023-12-29T23:06:35.346Z","dependency_job_id":null,"html_url":"https://github.com/atxtechbro/DockerChangeMyPythonVersion","commit_stats":null,"previous_names":["atxtechbro/dockerchangemypythonversion"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atxtechbro%2FDockerChangeMyPythonVersion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atxtechbro%2FDockerChangeMyPythonVersion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atxtechbro%2FDockerChangeMyPythonVersion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atxtechbro%2FDockerChangeMyPythonVersion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atxtechbro","download_url":"https://codeload.github.com/atxtechbro/DockerChangeMyPythonVersion/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243204905,"owners_count":20253416,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-images","python2","python2-7","python27","python3","python35","python36","python37","python38","python39","pythonrc","releasecandidate"],"created_at":"2024-09-24T19:23:12.936Z","updated_at":"2025-12-11T18:01:39.729Z","avatar_url":"https://github.com/atxtechbro.png","language":null,"readme":"# $ docker run -it python:3.2.1\n## How to use Docker to install and run any Python version including Python 2 up to the newest Release Candidate (RC)\n### Motivation\nLet's imagine the problem facing a developer needing to use Python 3.7.9 in order to replicate a clients' environment, or a student needing to utilize Python 2.7.18 to complete an assignment. These are just two of many scenarios in which 'downgrading' is something the developer wants to do, albeit temporarily.\n\nThere are many ways to do this, all of which entail additional implementations decisions the developer must confront. For example, before Docker you had to change the PYTHONPATH, and manually download either a Gzipped source tarball or XZ compressed source tarball from python.org. Then the next thing you know, valuable time is wasted Googling which tarball to use instead of time spent developing. According to the Zen of Python, There should be one— and preferably only one —obvious way to do it.\n\nIn the spirit of this sentiment, the Docker way will demonstrate the simplest and least costly solution to the version-change problem. It makes it easy to switch from one version to another, and then easily revert back. The developer does not need to worry about the way it is orchestrated behind the scenes. Essentially, what is happening is Docker is allowing the developer to invoke an isolated image containing a specific version of Python, and that image is quarantined from the rest of their operating system. Indeed, this is the exact problem Docker is made for. However, the subject of containerization and even the installation of Docker are outside the scope of this simple demonstration.  Before proceeding further, please understand that it is assumed you should have a Linux operating system with Docker installed already at this point.\n\n```$ docker run -it python:\u003cmajor\u003e.\u003cminor\u003e.\u003cmicro\u003e```\n\nDocker will start a Python session in the specified version immediately, but if we don't have it, Docker will recognize this and download the image for us which could take about a minute.\n\n\nIf either *major*, *minor*, or *micro* is not specified, Docker will default to downloading the most recent version available within the boundaries the developer has specified. To get the newest version of python type *python* without the colon\n\n\n```$ docker run -it python:3.7.9```\n\n\n```\nPython 3.7.9 (default, Feb  9 2021, 08:33:04) \n[GCC 8.3.0] on linux\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n```\n\n\nPerfect. I had that installed already and it was trivially easy. What if I need to go all the way back to Python 2.7 but I have never downloaded Python 2 because I learned Python after Python 3 came out?\n\n\n```$ docker run -it python:2.7.18```\n\nUnable to find image 'python:2.7.18' locally\n2.7.18: Pulling from library/python\n7e2b2a5af8f6: Pull complete \n09b6f03ffac4: Pull complete \ndc3f0c679f0f: Pull complete \nfd4b47407fc3: Pull complete \nb32f6bf7d96d: Pull complete \n6f4489a7e4cf: Pull complete \naf4b99ad9ef0: Pull complete \n39db0bc48c26: Pull complete \nacb4a89489fc: Pull complete \nDigest: sha256:cfa62318c459b1fde9e0841c619906d15ada5910d625176e24bf692cf8a2601d\nStatus: Downloaded newer image for python:2.7.18\nPython 2.7.18 (default, Apr 20 2020, 19:27:10) \n[GCC 8.3.0] on linux2\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n\n\n\nLet's imagine a developer just finished reading PEP 618 -- Add Optional Length-Checking To zip\n\nWouldn't it be nice to be able to switch back and forth with ease so we can better understand the proposed change? Reading the PEP in it's entirety is great if you're up for it, but running the code in a quick python:rc session and then seeing how it behaves differently is really a cool thing to experience. \n\n```\ndocker run -it python:rc\nPython 3.10.0rc1 (default, Aug  3 2021, 19:28:36) [GCC 8.3.0] on linux\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n\n\u003e\u003e\u003e zipper = zip(['with', 'we', 'version'], ['docker', 'redefine', 'control', 'a straggler appeared'], strict = False)\n\u003e\u003e\u003e list(zipper)\n```\n\n\n```[('with', 'docker'), ('we', 'redefine'), ('version', 'control')]```\n\n\n```\n\u003e\u003e\u003e zipper = zip(['with', 'we', 'version'], ['docker', 'redefine', 'control', 'a straggler appeared'], strict = True)\n\u003e\u003e\u003e list(zipper)\n```\n\n\n```ValueError: zip() argument 2 is longer than argument 1```\n\nEnjoy the stability of replicating a perfect copy of a previous version of Python, or even try out the newest Release Candidate (RC) before it is released to the general public. Creating an isolated image separate from the rest of your operating system is the exact type of problem Docker is good at solving, as well as the most secure and low risk.\n\nYou can use Docker \u0026 Python release switching as a time machine to the future and past\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatxtechbro%2Fdockerchangemypythonversion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatxtechbro%2Fdockerchangemypythonversion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatxtechbro%2Fdockerchangemypythonversion/lists"}