Change version to 0.9, address some review nits and use poetry 1.2 rather than pre-release.

This commit is contained in:
Justin Wood 2022-09-07 12:00:37 -04:00
parent a181da95b3
commit 73ddd43284
No known key found for this signature in database
GPG Key ID: E319AAE24BE41C3B
9 changed files with 453 additions and 291 deletions

View File

@ -8,8 +8,7 @@
set -e;
CI_CACHE=$HOME/.cache;
POETRY_VERSION=1.2.0b3;
POETRY_PREVIEW=1;
POETRY_VERSION=1.2.0;
mkdir --parents "$CI_CACHE";

View File

@ -69,7 +69,7 @@ jobs:
~/.cache/pip
~/.cache/pypoetry/cache
~/.poetry
# Hardcoded 'py310' slug here lets this cache piggyback on the 'py38' cache
# Hardcoded 'py310' slug here lets this cache piggyback on the 'py310' cache
# that is generated for the tests above
key: ${{ runner.os }}-py310-${{ hashFiles('**/poetry.lock') }}

View File

@ -2,15 +2,18 @@
See also: [Github Release Page](https://github.com/enpaul/tox-poetry-installer/releases).
## Version 1.0a1
## Version 0.9
View this release on:
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/1.0a1),
[PyPI](https://pypi.org/project/tox-poetry-installer/1.0a1/)
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.9.0),
[PyPI](https://pypi.org/project/tox-poetry-installer/0.9.0/)
- Drop python3.6 support, since Poetry 1.2 dropped py3.6 support
- Support Poetry==1.2.0b3 (prerelease)
- Added direct dep on cleo (prerelease) to support passing in NullIO to poetry functions
- Add support for Poetry-1.2.x (#73)
- Update Black formatting to stable release version
- Remove support for Python-3.6
- Remove support for Poetry-1.1.x
- Fix installing dependencies multiple times when transient dependencies are duplicated in
the dependency tree
## Version 0.8.5

678
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "tox-poetry-installer"
version = "1.0a1"
version = "0.9.0"
license = "MIT"
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"
@ -39,21 +39,21 @@ poetry = ["poetry", "cleo"]
[tool.poetry.dependencies]
python = "^3.7"
cleo = {version = "^1.0.0a5", optional = true, allow-prereleases = true}
poetry = {version = "1.2.0b3", optional = true, allow-prereleases = true}
poetry-core = {version = "1.1.0b3", allow-prereleases = true}
poetry = {version = "^1.2.0", optional = true}
poetry-core = "^1.1.0"
tox = "^3.8.0"
[tool.poetry.group.dev.dependencies]
bandit = "^1.6.2"
black = "^22.3.0"
blacken-docs = { version = "^1.8.0", python = "^3.7" }
ipython = { version = "^7.18.1", python = "^3.7" }
blacken-docs = "^1.8.0"
ipython = "^7.18.1"
mdformat = "^0.6"
mdformat-gfm = "^0.2"
mypy = "^0.930"
pre-commit = "^2.7.1"
pre-commit-hooks = "^3.3.0"
pylint = { version = "^2.13.0", python = "^3.7" }
pylint = "^2.13.0"
pytest = "^6.0.2"
pytest-cov = "^2.10.1"
reorder-python-imports = "^2.3.5"
@ -63,5 +63,5 @@ tox = "^3.20.0"
types-toml = "^0.10.1"
[build-system]
requires = ["poetry-core>=1.1.0b3"]
requires = ["poetry-core>=1.1.0"]
build-backend = "poetry.core.masonry.api"

View File

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

View File

@ -20,6 +20,7 @@ PEP508_VERSION_DELIMITERS: Tuple[str, ...] = ("~=", "==", "!=", ">", "<")
REPORTER_PREFIX: str = f"{__about__.__title__}:"
# Internal list of packages that poetry has deemed unsafe and are excluded from the lockfile
# TODO: This functionality is no longer needed, should remove in a future update.
UNSAFE_PACKAGES: Set[str] = set()
# Number of threads to use for installing dependencies by default

View File

@ -193,7 +193,7 @@ def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction) -> Optional
f"Identified {len(dev_deps)} development dependencies to install to env"
)
else:
dev_deps = set()
dev_deps = []
logger.info("Env does not install development dependencies, skipping")
env_deps = utilities.find_additional_deps(
@ -220,7 +220,7 @@ def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction) -> Optional
f"Identified {len(project_deps)} project dependencies to install to env"
)
else:
project_deps = set()
project_deps = []
logger.info("Env does not install project package dependencies, skipping")
except exceptions.ToxPoetryInstallerException as err:
venv.status = err.__class__.__name__
@ -231,7 +231,7 @@ def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction) -> Optional
logger.error(f"Internal plugin error: {err}")
raise err
dependencies = dev_deps | env_deps | project_deps
dependencies = utilities.dedupe_packages(dev_deps + env_deps + project_deps)
if (
venv.envconfig.config.option.parallel_install_threads
!= constants.DEFAULT_INSTALL_THREADS

View File

@ -182,7 +182,7 @@ def find_project_deps(
venv: "_poetry.VirtualEnv",
poetry: "_poetry.Poetry",
extras: Sequence[str] = (),
) -> Set[PoetryPackage]:
) -> List[PoetryPackage]:
"""Find the root project dependencies
Recursively identify the dependencies of the root project package
@ -218,7 +218,7 @@ def find_project_deps(
dep_name.lower(), packages, venv, allow_missing=[poetry.package.name]
)
return set(dependencies)
return dedupe_packages(dependencies)
def find_additional_deps(
@ -226,7 +226,7 @@ def find_additional_deps(
venv: "_poetry.VirtualEnv",
poetry: "_poetry.Poetry",
dep_names: Sequence[str],
) -> Set[PoetryPackage]:
) -> List[PoetryPackage]:
"""Find additional dependencies
Recursively identify the dependencies of an arbitrary list of package names
@ -243,12 +243,12 @@ def find_additional_deps(
dep_name.lower(), packages, venv, allow_missing=[poetry.package.name]
)
return set(dependencies)
return dedupe_packages(dependencies)
def find_dev_deps(
packages: PackageMap, venv: "_poetry.VirtualEnv", poetry: "_poetry.Poetry"
) -> Set[PoetryPackage]:
) -> List[PoetryPackage]:
"""Find the dev dependencies
Recursively identify the Poetry dev dependencies
@ -277,4 +277,15 @@ def find_dev_deps(
)
# Poetry 1.2 unions these two toml sections.
return dev_group_deps | legacy_dev_group_deps
return dedupe_packages(dev_group_deps + legacy_dev_group_deps)
def dedupe_packages(packages: Sequence[PoetryPackage]) -> List[PoetryPackage]:
"""Deduplicates a sequence of PoetryPackages while preserving ordering
Adapted from StackOverflow: https://stackoverflow.com/a/480227
"""
seen: Set[PoetryPackage] = set()
# Make this faster, avoid method lookup below
seen_add = seen.add
return [p for p in packages if not (p in seen or seen_add(p))]