diff --git a/docs/configuration.md b/docs/configuration.md index 98f9bff2471..aa619217995 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -56,7 +56,6 @@ virtualenvs.create = true virtualenvs.in-project = null virtualenvs.options.always-copy = true virtualenvs.options.no-pip = false -virtualenvs.options.no-setuptools = false virtualenvs.options.system-site-packages = false virtualenvs.path = "{cache-dir}/virtualenvs" # /path/to/cache/directory/virtualenvs virtualenvs.prefer-active-python = false @@ -391,35 +390,10 @@ Poetry, for its internal operations, uses the `pip` wheel embedded in the `virtu in Poetry's runtime environment. If a user runs `poetry run pip` when this option is set to `true`, the `pip` the embedded instance of `pip` is used. -You can safely set this, along with `no-setuptools`, to `true`, if you desire a virtual environment with no additional -packages. This is desirable for production environments. +You can safely set this to `true`, if you desire a virtual environment with no additional packages. +This is desirable for production environments. {{% /note %}} -### `virtualenvs.options.no-setuptools` - -**Type**: `boolean` - -**Default**: `false` - -**Environment Variable**: `POETRY_VIRTUALENVS_OPTIONS_NO_SETUPTOOLS` - -*Introduced in 1.2.0* - -If set to `true` the `--no-setuptools` parameter is passed to `virtualenv` on creation of the virtual environment. This -means when a new virtual environment is created, `setuptools` will not be installed in the environment. Poetry, for its -internal operations, does not require `setuptools` and this can safely be set to `true`. - -For environments using python 3.12 or later, `virtualenv` defaults to not -installing `setuptools` when creating a virtual environment. -In such environments this poetry configuration option therefore has no effect: -`setuptools` is not installed either way. -If your project relies on `setuptools`, you should declare it as a dependency. - -{{% warning %}} -Some development tools like IDEs, make an assumption that `setuptools` (and other) packages are always present and -available within a virtual environment. This can cause some features in these tools to not work as expected. -{{% /warning %}} - ### `virtualenvs.options.system-site-packages` **Type**: `boolean` diff --git a/src/poetry/config/config.py b/src/poetry/config/config.py index 2188f8284e0..b253465ce20 100644 --- a/src/poetry/config/config.py +++ b/src/poetry/config/config.py @@ -114,12 +114,7 @@ class Config: "options": { "always-copy": False, "system-site-packages": False, - # we default to False here in order to prevent development environment - # breakages for IDEs etc. as when working in these environments - # assumptions are often made about virtual environments having pip and - # setuptools. "no-pip": False, - "no-setuptools": False, }, "prefer-active-python": False, "prompt": "{project_name}-py{python_version}", @@ -303,7 +298,6 @@ def _get_normalizer(name: str) -> Callable[[str], Any]: "virtualenvs.in-project", "virtualenvs.options.always-copy", "virtualenvs.options.no-pip", - "virtualenvs.options.no-setuptools", "virtualenvs.options.system-site-packages", "virtualenvs.options.prefer-active-python", "experimental.system-git-client", diff --git a/src/poetry/console/commands/config.py b/src/poetry/console/commands/config.py index 8b862226689..f1fc7760ab4 100644 --- a/src/poetry/console/commands/config.py +++ b/src/poetry/console/commands/config.py @@ -66,10 +66,6 @@ def unique_config_values(self) -> dict[str, tuple[Any, Any]]: boolean_normalizer, ), "virtualenvs.options.no-pip": (boolean_validator, boolean_normalizer), - "virtualenvs.options.no-setuptools": ( - boolean_validator, - boolean_normalizer, - ), "virtualenvs.path": (str, lambda val: str(Path(val))), "virtualenvs.prefer-active-python": (boolean_validator, boolean_normalizer), "virtualenvs.prompt": (str, str), diff --git a/src/poetry/utils/env/__init__.py b/src/poetry/utils/env/__init__.py index b460a545595..521c4a4f96f 100644 --- a/src/poetry/utils/env/__init__.py +++ b/src/poetry/utils/env/__init__.py @@ -69,7 +69,7 @@ def build_environment( if not env or poetry.package.build_script: with ephemeral_environment( executable=env.python if env else None, - flags={"no-pip": True, "no-setuptools": True, "no-wheel": True}, + flags={"no-pip": True}, ) as venv: if io: requires = [ diff --git a/src/poetry/utils/env/env_manager.py b/src/poetry/utils/env/env_manager.py index a0fd02463df..093a248a7e8 100644 --- a/src/poetry/utils/env/env_manager.py +++ b/src/poetry/utils/env/env_manager.py @@ -625,8 +625,6 @@ def build_venv( executable: Path | None = None, flags: dict[str, str | bool] | None = None, with_pip: bool | None = None, - with_wheel: bool | None = None, - with_setuptools: bool | None = None, prompt: str | None = None, ) -> virtualenv.run.session.Session: flags = flags or {} @@ -634,25 +632,9 @@ def build_venv( if with_pip is not None: flags["no-pip"] = not with_pip - if with_wheel is not None: - wheel_flags: dict[str, str | bool] = ( - {"wheel": "bundle"} if with_wheel else {"no-wheel": True} - ) - flags.update(wheel_flags) - - if with_setuptools is not None: - setuptools_flags: dict[str, str | bool] = ( - {"setuptools": "bundle"} if with_setuptools else {"no-setuptools": True} - ) - flags.update(setuptools_flags) - flags.setdefault("no-pip", True) - - if "setuptools" not in flags and "no-setuptools" not in flags: - flags["no-setuptools"] = True - - if "wheel" not in flags and "no-wheel" not in flags: - flags["no-wheel"] = True + flags.setdefault("no-setuptools", True) + flags.setdefault("no-wheel", True) if WINDOWS: path = get_real_windows_path(path) diff --git a/src/poetry/utils/isolated_build.py b/src/poetry/utils/isolated_build.py index 5e7cc103cb4..e4ea88bda86 100644 --- a/src/poetry/utils/isolated_build.py +++ b/src/poetry/utils/isolated_build.py @@ -136,7 +136,7 @@ def isolated_builder( with ephemeral_environment( executable=python_executable, - flags={"no-pip": True, "no-setuptools": True, "no-wheel": True}, + flags={"no-pip": True}, ) as venv: env = IsolatedEnv(venv, pool) stdout = StringIO() diff --git a/tests/conftest.py b/tests/conftest.py index 05e1c6cbfec..40bd0b97149 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -506,7 +506,6 @@ def venv_flags_default() -> dict[str, bool]: "always-copy": False, "system-site-packages": False, "no-pip": False, - "no-setuptools": False, } diff --git a/tests/console/commands/env/test_use.py b/tests/console/commands/env/test_use.py index 662e3434939..478ef414ef8 100644 --- a/tests/console/commands/env/test_use.py +++ b/tests/console/commands/env/test_use.py @@ -77,7 +77,6 @@ def test_activate_activates_non_existing_virtualenv_no_envs_file( "always-copy": False, "system-site-packages": False, "no-pip": False, - "no-setuptools": False, }, prompt="simple-project-py3.7", ) diff --git a/tests/console/commands/test_config.py b/tests/console/commands/test_config.py index 218d47f8032..14e74776751 100644 --- a/tests/console/commands/test_config.py +++ b/tests/console/commands/test_config.py @@ -66,7 +66,6 @@ def test_list_displays_default_value_if_not_set( virtualenvs.in-project = null virtualenvs.options.always-copy = false virtualenvs.options.no-pip = false -virtualenvs.options.no-setuptools = false virtualenvs.options.system-site-packages = false virtualenvs.path = {venv_path} # {config_cache_dir / 'virtualenvs'} virtualenvs.prefer-active-python = false @@ -99,7 +98,6 @@ def test_list_displays_set_get_setting( virtualenvs.in-project = null virtualenvs.options.always-copy = false virtualenvs.options.no-pip = false -virtualenvs.options.no-setuptools = false virtualenvs.options.system-site-packages = false virtualenvs.path = {venv_path} # {config_cache_dir / 'virtualenvs'} virtualenvs.prefer-active-python = false @@ -153,7 +151,6 @@ def test_unset_setting( virtualenvs.in-project = null virtualenvs.options.always-copy = false virtualenvs.options.no-pip = false -virtualenvs.options.no-setuptools = false virtualenvs.options.system-site-packages = false virtualenvs.path = {venv_path} # {config_cache_dir / 'virtualenvs'} virtualenvs.prefer-active-python = false @@ -185,7 +182,6 @@ def test_unset_repo_setting( virtualenvs.in-project = null virtualenvs.options.always-copy = false virtualenvs.options.no-pip = false -virtualenvs.options.no-setuptools = false virtualenvs.options.system-site-packages = false virtualenvs.path = {venv_path} # {config_cache_dir / 'virtualenvs'} virtualenvs.prefer-active-python = false @@ -315,7 +311,6 @@ def test_list_displays_set_get_local_setting( virtualenvs.in-project = null virtualenvs.options.always-copy = false virtualenvs.options.no-pip = false -virtualenvs.options.no-setuptools = false virtualenvs.options.system-site-packages = false virtualenvs.path = {venv_path} # {config_cache_dir / 'virtualenvs'} virtualenvs.prefer-active-python = false @@ -356,7 +351,6 @@ def test_list_must_not_display_sources_from_pyproject_toml( virtualenvs.in-project = null virtualenvs.options.always-copy = false virtualenvs.options.no-pip = false -virtualenvs.options.no-setuptools = false virtualenvs.options.system-site-packages = false virtualenvs.path = {venv_path} # {config_cache_dir / 'virtualenvs'} virtualenvs.prefer-active-python = false diff --git a/tests/masonry/builders/test_editable_builder.py b/tests/masonry/builders/test_editable_builder.py index 6e297175814..1240201df59 100644 --- a/tests/masonry/builders/test_editable_builder.py +++ b/tests/masonry/builders/test_editable_builder.py @@ -260,7 +260,7 @@ def test_builder_setup_generation_runs_with_pip_editable( poetry = Factory().create_poetry(extended_project) # we need a venv with pip and setuptools since we are verifying setup.py builds - with ephemeral_environment(flags={"no-setuptools": False, "no-pip": False}) as venv: + with ephemeral_environment(flags={"no-pip": False}) as venv: builder = EditableBuilder(poetry, venv, NullIO()) builder.build() diff --git a/tests/test_factory.py b/tests/test_factory.py index 5cc433bb3c0..b13f7132fee 100644 --- a/tests/test_factory.py +++ b/tests/test_factory.py @@ -571,7 +571,6 @@ def test_create_poetry_with_local_config(fixture_dir: FixtureDirGetter) -> None: assert not poetry.config.get("virtualenvs.create") assert not poetry.config.get("virtualenvs.options.always-copy") assert not poetry.config.get("virtualenvs.options.no-pip") - assert not poetry.config.get("virtualenvs.options.no-setuptools") assert not poetry.config.get("virtualenvs.options.system-site-packages") diff --git a/tests/utils/env/test_env.py b/tests/utils/env/test_env.py index e3ee2f2c473..5761fd02115 100644 --- a/tests/utils/env/test_env.py +++ b/tests/utils/env/test_env.py @@ -312,15 +312,7 @@ def test_env_system_packages_are_relative_to_lib( ("flags", "packages"), [ ({"no-pip": False}, {"pip"}), - ({"no-pip": False, "no-wheel": True}, {"pip"}), - ({"no-pip": False, "no-wheel": False}, {"pip", "wheel"}), ({"no-pip": True}, set()), - ({"no-setuptools": False}, {"setuptools"}), - ({"no-setuptools": True}, set()), - ({"setuptools": "bundle"}, {"setuptools"}), - ({"no-pip": True, "no-setuptools": False}, {"setuptools"}), - ({"no-wheel": False}, {"wheel"}), - ({"wheel": "bundle"}, {"wheel"}), ({}, set()), ], ) @@ -338,14 +330,6 @@ def test_env_no_pip( if package.name != "sqlite3" } - # For python >= 3.12, virtualenv defaults to "--no-setuptools" and "--no-wheel" - # behaviour, so setting these values to False becomes meaningless. - if sys.version_info >= (3, 12): - if not flags.get("no-setuptools", True): - packages.discard("setuptools") - if not flags.get("no-wheel", True): - packages.discard("wheel") - assert installed_packages == packages diff --git a/tests/utils/env/test_env_manager.py b/tests/utils/env/test_env_manager.py index c44aa52727e..891d0a4702c 100644 --- a/tests/utils/env/test_env_manager.py +++ b/tests/utils/env/test_env_manager.py @@ -150,7 +150,6 @@ def test_activate_in_project_venv_no_explicit_config( "always-copy": False, "system-site-packages": False, "no-pip": False, - "no-setuptools": False, }, prompt="simple-project-py3.7", ) @@ -1181,7 +1180,6 @@ def test_create_venv_project_name_empty_sets_correct_prompt( "always-copy": False, "system-site-packages": False, "no-pip": False, - "no-setuptools": False, }, prompt="virtualenv-py3.7", ) @@ -1231,7 +1229,6 @@ def mock_check_output(cmd: str, *args: Any, **kwargs: Any) -> str: "always-copy": False, "system-site-packages": False, "no-pip": False, - "no-setuptools": False, }, prompt="simple-project-py3.5", )