tox
tox copied to clipboard
provide Docker packaging
Beside providing tox as a Python package it could be helpful to also provide an "official" Docker image that's set up with correct Pythons and tox installed. This came out of https://github.com/tox-dev/tox/pull/943. Any version of this needs to:
- automate docker image update as part of the release process (Azure Pipelines has docker support),
- add image files,
- add tests (Azure Pipelines has docker support).
It's to be determined if this should leave as part of this repository; or should it instead be a separate project.
Who would be the intended audience for this?
People not wanting to install python/tox on their machine, but would prefer to invoke it from tox; think of it as instead of tox you could just do docker run tox:latest -v .:/w. The second option has no setup cost given you already have docker up and running. I would now see it as part of tox-dev organization, but under a different repo hooked up against the docker cloud. It would repackage the latest version from PyPi after every tox release.
That sounds indeed handy.
Did anything ever come of this?
Sounds like something that would be accepted to the official docker library as well https://docs.docker.com/docker-hub/official_images/#creating-an-official-image
Would be great if someone could make a contribution for this.
Hi guys, I'm happy to share an initial version of my Docker image packaging for tox π
This multi-arch Docker image neatly packages tox v4 along with all currently active Python versions. The image is secure, compact, and easy to use.
At this moment, the image only supports the following platforms:
linux/arm64/v8linux/amd64
Please give it a try and share your feedback π
I'm especially interested in discussing current image limitations and would love to hear from maintainers and users about the following:
- tox v3 is not supported. Does it make sense to have the v3 version of the image? For how long v3 will be maintained?
- It is not possible to install additional Python versions into a running container because the image doesn't include any build dependencies. I thought that for most cases it would be sufficient to have active CPython versions installed. Otherwise, it should be possible to build a custom image based on
31z4/tox. - For the same reason as above testing Python code that requires building C extensions is not supported.
As for the official Docker image, I could help with that too. I've been maintaining official images for Zookeeper and Storm since 2016, so I have some relevant experience βΊοΈ Although, before contributing to the official docker library I'd love to gather some feedback from the community about the current version, fix discovered issues and address limitations if needed.
toy v3 is no longer officially supported by the tox core team. So imho there is need for a docker image.
I moved from compiling Python using pyenv to installing from deadsnakes PPA π Not only it drastically reduced build times, but also resulted in a smaller image (321MB vs 387MB). I realized that compiling Python is out of scope of building a Docker image for tox.
Everybody who is interested, please check the latest image tag.
I think a tox docker image should provide similar tags to the official python image tags. At least latest,slim,alpine and maybe the -buster,-bullseye families too. This way users of this image can pick what they need. I'd expect slim to be slim, but I'd be surely using the most bloated latest tag to run a CI: if I am not packaging an application in the image I won't care about the image size.
I'd rather opt for an image that can build most source distributions out-of-the-box, provided it features git, mercurial and a bunch of preinstalled development libraries (namely CPython headers) just as the python:latest does.
As for the vendored python interpreters, I think settling for the active python versions is a sensible default but I would expect
- active pypy versions be included as well!
- an easy mechanism to extend the tox image with additional interpreters like legacy CPythons, development CPythons (alphas, betas and RCs but also locally modified/hacked interpreters) and other Python implementations (Jython, RustPython and whatnot)
Thanks for your feedback @n1ngu π
I think a tox docker image should provide similar tags to the official python image tags. At least latest,slim,alpine and maybe the -buster,-bullseye families too.
I'm not sure about having several image variants right now. Because building and maintaining such variants would require extra effort. But I'm still not sure how popular the image would be. I don't think that absence of the alpine or debian based version will be a blocker for many users.
if I am not packaging an application in the image I won't care about the image size.
Good point.
I'd rather opt for an image that can build most source distributions out-of-the-box.
Makes sense. As usability benchmark I took flask and mypy and updated the image so that both packages can be tested using it out-of-the-box. See flask demo.
active pypy versions be included as well!
PyPy is not included at the moment. But maybe I'll add in the future.
an easy mechanism to extend the tox image with additional interpreters
That's doable by creating a derivative image. I added a short example to the README.