From 661072a69fa51f2c9fc7ce1eb9d467952913f260 Mon Sep 17 00:00:00 2001 From: Ethan Paul <24588726+enpaul@users.noreply.github.com> Date: Tue, 13 Aug 2024 12:54:28 -0400 Subject: [PATCH] Remove unsafe dependency check Fixes #97 --- README.md | 1 - tests/test_transients.py | 11 ----------- tox_poetry_installer/constants.py | 4 ---- tox_poetry_installer/exceptions.py | 5 ----- tox_poetry_installer/utilities.py | 12 ------------ 5 files changed, 33 deletions(-) diff --git a/README.md b/README.md index cec293a..241c29f 100644 --- a/README.md +++ b/README.md @@ -227,7 +227,6 @@ error will be set to one of the "Status" values below to indicate what the error | `LockedDepNotFoundError` | Indicates that an item specified in the `locked_deps` config option does not match the name of a package in the Poetry lockfile. | | `LockedDepsRequiredError` | Indicates that a test environment with the `require_locked_deps` config option set to `true` also specified unlocked dependencies using the [`deps`](https://tox.readthedocs.io/en/latest/config.html#conf-deps) config option. | | `PoetryNotInstalledError` | Indicates that the `poetry` module could not be imported under the current runtime environment, and `require_poetry = true` was specified. | -| `RequiresUnsafeDepError` | Indicates that the package-under-test depends on a package that Poetry has classified as unsafe and cannot be installed. | > ℹ️ **Note:** One or more of these errors can be caused by the `pyproject.toml` being out > of sync with the Poetry lockfile. If this is the case, than a warning will be logged diff --git a/tests/test_transients.py b/tests/test_transients.py index 46ab34c..2fa573f 100644 --- a/tests/test_transients.py +++ b/tests/test_transients.py @@ -11,17 +11,6 @@ from tox_poetry_installer import exceptions from tox_poetry_installer import utilities -def test_exclude_unsafe(): - """Test that the unsafe packages are properly excluded - - Also ensure that the internal constant matches the value from Poetry - """ - assert Provider.UNSAFE_PACKAGES == constants.UNSAFE_PACKAGES - - for dep in constants.UNSAFE_PACKAGES: - assert not utilities.identify_transients(dep, {}, None) - - def test_allow_missing(): """Test that the ``allow_missing`` parameter works as expected""" with pytest.raises(exceptions.LockedDepNotFoundError): diff --git a/tox_poetry_installer/constants.py b/tox_poetry_installer/constants.py index 5b17def..80ca64c 100644 --- a/tox_poetry_installer/constants.py +++ b/tox_poetry_installer/constants.py @@ -19,9 +19,5 @@ PEP508_VERSION_DELIMITERS: Tuple[str, ...] = ("~=", "==", "!=", ">", "<") # console output. 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 DEFAULT_INSTALL_THREADS: int = 10 diff --git a/tox_poetry_installer/exceptions.py b/tox_poetry_installer/exceptions.py index b789e19..44d476f 100644 --- a/tox_poetry_installer/exceptions.py +++ b/tox_poetry_installer/exceptions.py @@ -11,7 +11,6 @@ All exceptions should inherit from the common base exception :exc:`ToxPoetryInst +-- LockedDepNotFoundError +-- ExtraNotFoundError +-- LockedDepsRequiredError - +-- RequiresUnsafeDepError """ @@ -42,7 +41,3 @@ class ExtraNotFoundError(ToxPoetryInstallerException): class LockedDepsRequiredError(ToxPoetryInstallerException): """Environment cannot specify unlocked dependencies when locked dependencies are required""" - - -class RequiresUnsafeDepError(ToxPoetryInstallerException): - """Package under test depends on an unsafe dependency and cannot be installed""" diff --git a/tox_poetry_installer/utilities.py b/tox_poetry_installer/utilities.py index 0c0221d..8fa6702 100644 --- a/tox_poetry_installer/utilities.py +++ b/tox_poetry_installer/utilities.py @@ -132,13 +132,6 @@ def identify_transients( except KeyError as err: missing = err.args[0] - if missing in constants.UNSAFE_PACKAGES: - logger.warning( - f"Installing package '{missing}' using Poetry is not supported and will be skipped" - ) - logger.debug(f"Skipping {missing}: designated unsafe by Poetry") - return [] - if missing in allow_missing: logger.debug(f"Skipping {missing}: package is allowed to be unlocked") return [] @@ -171,11 +164,6 @@ def find_project_deps( :param extras: Sequence of extra names to include the dependencies of """ - if any(dep.name in constants.UNSAFE_PACKAGES for dep in poetry.package.requires): - raise exceptions.RequiresUnsafeDepError( - f"Project package requires one or more unsafe dependencies ({', '.join(constants.UNSAFE_PACKAGES)}) which cannot be installed with Poetry" - ) - required_dep_names = [ item.name for item in poetry.package.requires if not item.is_optional() ]