Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial documentation for tox #2307

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tox/README-short.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tox is a generic Python virtual environment management and test command line tool.
52 changes: 52 additions & 0 deletions tox/content.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# What is tox

tox is a generic virtual environment management and test command line tool you can use for:

- checking your package builds and installs correctly under different environments (such as different Python implementations, versions or installation dependencies),
- running your tests in each of the environments with the test tool of choice,
- acting as a frontend to continuous integration servers, greatly reducing boilerplate and merging CI and shell-based testing.

> [tox.wiki](https://tox.wiki)

This image neatly packages tox v4 along with common build dependencies (e.g., `make`, `gcc`, etc) and currently [active CPython versions](https://devguide.python.org/versions/#status-of-python-versions).

# How to use this image

The recommended way of using the image is to mount the directory that contains your tox configuration files and your code as a volume. Assuming your project is within the current directory of the host, use the following command to run tox without any flags:

```bash
docker run -v `pwd`:/tests -it --rm tox
```

Also, you can easily pass subcommands and flags:

```bash
docker run -v `pwd`:/tests -it --rm tox run-parallel -e black,py311
```

Note, that the image is configured with a working directory at `/tests`.

## Installing additional software

If you want to install additional Python versions/implementations or Ubuntu packages you can create a derivative image. Just make sure you switch the user to `root` when needed and switch back to `tox` afterwards:

```Dockerfile
FROM tox

USER root

RUN set -eux; \
apt-get update; \
DEBIAN_FRONTEND=noninteractive \
apt-get install -y --no-install-recommends \
python3.12; \
rm -rf /var/lib/apt/lists/*

USER tox
```

# Versioning

Image tags have the form of `{tox-version}-{image-version}` where `image-version` part is optional and follows [semantic versioning](https://semver.org). For example, expect major image version bump on incompatible changes, like removing the Python version which has reached its end-of-life or changing a base image.

For production use, it's recommended to pin both tox and image versions (e.g., `tox:4.4.7-3.0.1`).
1 change: 1 addition & 0 deletions tox/github-repo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://github.com/31z4/tox-docker
1 change: 1 addition & 0 deletions tox/license.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
View license information for [tox](https://github.com/tox-dev/tox/blob/main/LICENSE) and [Python 3](https://docs.python.org/3/license.html).
1 change: 1 addition & 0 deletions tox/maintainer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[Elisey Zanko](%%GITHUB-REPO%%)