mirror of
				https://github.com/enpaul/tox-poetry-installer.git
				synced 2025-11-04 07:46:06 +00:00 
			
		
		
		
	Merge pull request #26 from enpaul/enp/fixups
Minor fixups ahead of 0.5 release
This commit is contained in:
		@@ -1,6 +1,6 @@
 | 
			
		||||
[tool.poetry]
 | 
			
		||||
name = "tox-poetry-installer"
 | 
			
		||||
version = "0.4.0"
 | 
			
		||||
version = "0.5.0"
 | 
			
		||||
license = "MIT"
 | 
			
		||||
authors = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"]
 | 
			
		||||
description = "Tox plugin to install Tox environment dependencies using the Poetry backend and lockfile"
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
# pylint: disable=missing-docstring
 | 
			
		||||
__title__ = "tox-poetry-installer"
 | 
			
		||||
__summary__ = "Tox plugin to install Tox environment dependencies using the Poetry backend and lockfile"
 | 
			
		||||
__version__ = "0.4.0"
 | 
			
		||||
__version__ = "0.5.0"
 | 
			
		||||
__url__ = "https://github.com/enpaul/tox-poetry-installer/"
 | 
			
		||||
__license__ = "MIT"
 | 
			
		||||
__authors__ = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"]
 | 
			
		||||
 
 | 
			
		||||
@@ -8,6 +8,7 @@ All exceptions should inherit from the common base exception :exc:`ToxPoetryInst
 | 
			
		||||
   +-- LockedDepVersionConflictError
 | 
			
		||||
   +-- LockedDepNotFoundError
 | 
			
		||||
   +-- ExtraNotFoundError
 | 
			
		||||
   +-- LockedDepsRequiredError
 | 
			
		||||
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -5,6 +5,7 @@ specifically related to implementing the hooks (to keep the size/readability of
 | 
			
		||||
themselves manageable).
 | 
			
		||||
"""
 | 
			
		||||
from typing import List
 | 
			
		||||
from typing import Optional
 | 
			
		||||
 | 
			
		||||
from poetry.core.packages import Package as PoetryPackage
 | 
			
		||||
from poetry.factory import Factory as PoetryFactory
 | 
			
		||||
@@ -51,7 +52,7 @@ def tox_addoption(parser: ToxParser):
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@hookimpl
 | 
			
		||||
def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction):
 | 
			
		||||
def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction) -> Optional[bool]:
 | 
			
		||||
    """Install the dependencies for the current environment
 | 
			
		||||
 | 
			
		||||
    Loads the local Poetry environment and the corresponding lockfile then pulls the dependencies
 | 
			
		||||
@@ -69,7 +70,7 @@ def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction):
 | 
			
		||||
        reporter.verbosity1(
 | 
			
		||||
            f"{constants.REPORTER_PREFIX} skipping isolated build env '{action.name}'"
 | 
			
		||||
        )
 | 
			
		||||
        return
 | 
			
		||||
        return None
 | 
			
		||||
 | 
			
		||||
    try:
 | 
			
		||||
        poetry = PoetryFactory().create_poetry(venv.envconfig.config.toxinidir)
 | 
			
		||||
@@ -82,7 +83,7 @@ def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction):
 | 
			
		||||
        reporter.verbosity1(
 | 
			
		||||
            f"{constants.REPORTER_PREFIX} project does not use Poetry for env management, skipping installation of locked dependencies"
 | 
			
		||||
        )
 | 
			
		||||
        return
 | 
			
		||||
        return None
 | 
			
		||||
 | 
			
		||||
    reporter.verbosity1(
 | 
			
		||||
        f"{constants.REPORTER_PREFIX} loaded project pyproject.toml from {poetry.file}"
 | 
			
		||||
@@ -107,16 +108,18 @@ def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction):
 | 
			
		||||
        reporter.verbosity1(
 | 
			
		||||
            f"{constants.REPORTER_PREFIX} env specifies 'skip_install = true', skipping installation of project package"
 | 
			
		||||
        )
 | 
			
		||||
        return
 | 
			
		||||
        return venv.envconfig.require_locked_deps or None
 | 
			
		||||
 | 
			
		||||
    if venv.envconfig.config.skipsdist:
 | 
			
		||||
        reporter.verbosity1(
 | 
			
		||||
            f"{constants.REPORTER_PREFIX} config specifies 'skipsdist = true', skipping installation of project package"
 | 
			
		||||
        )
 | 
			
		||||
        return
 | 
			
		||||
        return venv.envconfig.require_locked_deps or None
 | 
			
		||||
 | 
			
		||||
    _install_project_dependencies(venv, poetry, package_map)
 | 
			
		||||
 | 
			
		||||
    return venv.envconfig.require_locked_deps or None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def _install_env_dependencies(
 | 
			
		||||
    venv: ToxVirtualEnv, poetry: Poetry, packages: PackageMap
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user