Merge pull request #63 from 9999years/more-install-logging

Add logging for package installation completion
This commit is contained in:
Ethan Paul 2021-10-28 19:53:20 -04:00 committed by GitHub
commit c322e68371
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 4 deletions

View File

@ -2,6 +2,16 @@
See also: [Github Release Page](https://github.com/enpaul/tox-poetry-installer/releases). See also: [Github Release Page](https://github.com/enpaul/tox-poetry-installer/releases).
## Version 0.8.2
View this release on:
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.8.2),
[PyPI](https://pypi.org/project/tox-poetry-installer/0.8.2/)
- Improve debug-level logging for package installation, and time how long installing each
package takes. Contributed by [Rebecca
Turner](https://github.com/9999years).
## Version 0.8.1 ## Version 0.8.1
View this release on: View this release on:

View File

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "tox-poetry-installer" name = "tox-poetry-installer"
version = "0.8.1" version = "0.8.2"
license = "MIT" license = "MIT"
authors = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"] authors = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"]
description = "A plugin for Tox that lets you install test environment dependencies from the Poetry lockfile" description = "A plugin for Tox that lets you install test environment dependencies from the Poetry lockfile"

View File

@ -1,7 +1,7 @@
# pylint: disable=missing-docstring # pylint: disable=missing-docstring
__title__ = "tox-poetry-installer" __title__ = "tox-poetry-installer"
__summary__ = "A plugin for Tox that lets you install test environment dependencies from the Poetry lockfile" __summary__ = "A plugin for Tox that lets you install test environment dependencies from the Poetry lockfile"
__version__ = "0.8.1" __version__ = "0.8.2"
__url__ = "https://github.com/enpaul/tox-poetry-installer/" __url__ = "https://github.com/enpaul/tox-poetry-installer/"
__license__ = "MIT" __license__ = "MIT"
__authors__ = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"] __authors__ = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"]

View File

@ -5,6 +5,7 @@
import concurrent.futures import concurrent.futures
import contextlib import contextlib
import typing import typing
from datetime import datetime
from typing import Sequence from typing import Sequence
from typing import Set from typing import Set
@ -46,6 +47,13 @@ def install(
installed: Set[PoetryPackage] = set() installed: Set[PoetryPackage] = set()
def logged_install(dependency: PoetryPackage) -> None:
start = datetime.now()
logger.debug(f"Installing {dependency}")
pip.install(dependency)
end = datetime.now()
logger.debug(f"Finished installing {dependency} in {end - start}")
@contextlib.contextmanager @contextlib.contextmanager
def _optional_parallelize(): def _optional_parallelize():
"""A bit of cheat, really """A bit of cheat, really
@ -66,8 +74,8 @@ def install(
for dependency in packages: for dependency in packages:
if dependency not in installed: if dependency not in installed:
installed.add(dependency) installed.add(dependency)
logger.debug(f"Installing {dependency}") logger.debug(f"Queuing {dependency}")
executor(pip.install, dependency) executor(logged_install, dependency)
else: else:
logger.debug(f"Skipping {dependency}, already installed") logger.debug(f"Skipping {dependency}, already installed")
logger.debug("Waiting for installs to finish...") logger.debug("Waiting for installs to finish...")