tox-recreate-hook

(experimental) Allows hooks to be defined which are called when recreating a tox testenv.

Docs

Documentation Build Status Docs Check Status

Tests

Linux Test Status Windows Test Status macOS Test Status Coverage

PyPI

PyPI - Package Version PyPI - Supported Python Versions PyPI - Supported Implementations PyPI - Wheel

Activity

GitHub last commit GitHub commits since tagged version Maintenance PyPI - Downloads

QA

CodeFactor Grade Flake8 Status mypy status

Other

License GitHub top language Requirements Status

Installation

python3 -m pip install tox-recreate-hook --user

Contents

Usage

tox-recreate-hook is configured using the recreate_hook key in the testenv sections of tox.ini. The configuration might look like:

[tox]
envlist = py37, py38, py39, mypy, docs
skip_missing_interpreters = True
isolated_build = True
requires =
    pip>=21
    tox-recreate-hook

[testenv:docs]
changedir = {toxinidir}/doc-source
deps = -r{toxinidir}/doc-source/requirements.txt
commands = sphinx-build -M html . ./build {posargs}
recreate_hook = builtin.rmdir("{toxinidir}/doc-source/build")

recreate_hook can be any valid single-line Python expression, the result of which will be printed to the terminal. tox-recreate-hook ships with several hooks in the builtin module. Hooks can also be defined in custom modules, either on the PYTHONPATH or in toxinidir.

Built In Hooks

rmdir(path)

Remove the given directory and its contents.

rmdir(path)[source]

Remove the given directory and its contents.

Parameters

path (Union[str, Path, PathLike])

Return type

str

Returns

A message in the format 'removing <path>'

Attention

On Windows-like systems using \ as a path separator you may need to use a raw string for the path as the toxinidir substitution may contain backslashes:

recreate_hook = builtin.rmdir(r"{toxinidir}/doc-source/build")

Downloading source code

The tox-recreate-hook source code is available on GitHub, and can be accessed from the following URL: https://github.com/python-coincidence/tox-recreate-hook

If you have git installed, you can clone the repository with the following command:

git clone https://github.com/python-coincidence/tox-recreate-hook
Cloning into 'tox-recreate-hook'...
remote: Enumerating objects: 47, done.
remote: Counting objects: 100% (47/47), done.
remote: Compressing objects: 100% (41/41), done.
remote: Total 173 (delta 16), reused 17 (delta 6), pack-reused 126
Receiving objects: 100% (173/173), 126.56 KiB | 678.00 KiB/s, done.
Resolving deltas: 100% (66/66), done.
Alternatively, the code can be downloaded in a ‘zip’ file by clicking:
Clone or download –> Download Zip
Downloading a 'zip' file of the source code.

Downloading a ‘zip’ file of the source code

Building from source

The recommended way to build tox-recreate-hook is to use tox:

tox -e build

The source and wheel distributions will be in the directory dist.

If you wish, you may also use pep517.build or another PEP 517-compatible build tool.

View the Function Index or browse the Source Code.

Browse the GitHub Repository