Put tox work directories in a cache directory by default
Project description
Put tox work directories in a cache directory by default.
By default, tox will create packaging and test environments in a .tox/ subdirectory in the same directory as the project’s tox.ini or pyproject.toml file.
.tox/
| +-- .pkg/
| +-- docs/
| +-- mypy/
| +-- py39/
| +-- py310/
| +-- py311/
| +-- py312/
| \-- py313/
|
\-- tox.ini
As you interact with more and more projects, those .tox/ directories will proliferate throughout your filesystem.
This default behavior makes it harder to clean up all of your cached environments and can make backups slow (and potentially expensive).
tox-workdir changes the default work directory to point to your user cache directory, keeping your development directories trim and sleek over time.
Installation
If you’re using pipx, inject tox-workdir into your existing tox install:
pipx inject tox tox-workdir
If you’re using a virtual environment, install tox-workdir as a regular package:
pip install tox-workdir
No configuration is needed; installing the plugin immediately changes the default work_dir value.
Work directory paths
Where tox defaults to .tox/, tox-workdir defaults to your user cache directory:
Operating system |
Base path |
|---|---|
Linux |
$XDG_CACHE_DIR/tox-workdir/ |
macOS |
/Users/{user}/Library/Caches/tox-workdir/ |
Windows |
C:\Users\{user}\AppData\Local\kurtmckee\tox-workdir\Cache\ |
Note that $XDG_CACHE_DIR, above, defaults to $HOME/.cache if unset.
A hash of the path to the tox config file is used as a subdirectory for uniqueness.
You can see the workdir value that will be used by running:
tox workdir
Feel-good benefits
To feel good about your choice to install this plugin, simply check how much space .tox/ directories are consuming. Then, think about how much faster your backups will process without all of those .tox/ directories!
Assuming that you have a development directory with a number of project directories, you can run one of the following commands to see how much space is consumed by .tox/ subdirectories.
On Linux and macOS:
$ du -csh */.tox | tail -n 1
10G total
On Windows, using Powershell:
$ (Get-ChildItem -Recurse */.tox | Measure-Object -Property Length -Sum).Sum / 1GB
10.00000000
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tox_workdir-0.1.0.tar.gz.
File metadata
- Download URL: tox_workdir-0.1.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9be41c8939468b60f599efb9a0b70a75feef9d1b0ee801470a5e8c57936c9750
|
|
| MD5 |
a580384e5e13fce50c310701a8056f0f
|
|
| BLAKE2b-256 |
0d5802c5b791b6bf1dd5ceebb3881484bd244f50fa18a113115d240bb0539c28
|
File details
Details for the file tox_workdir-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tox_workdir-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c210b3e2dc9243e829094aaaed6266c569b34a5990ba65890caa3638e9c67c40
|
|
| MD5 |
9f9d930083795ba056dce4c956d59203
|
|
| BLAKE2b-256 |
b8faba933d47a1bfd95847a0fc19addc0dbc3b3e712d8f061f6f53b28e00ee4a
|