diff --git a/docs/configuration.md b/docs/configuration.md index ebbd085d149..7c64129d1ab 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 @@ -389,35 +388,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 f2a8129f231..bf2f0948d03 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}", @@ -305,7 +300,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 25fec8ce72f..2bc524bed41 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 89882ddfd05..d15530a76ad 100644 --- a/src/poetry/utils/env/__init__.py +++ b/src/poetry/utils/env/__init__.py @@ -67,7 +67,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 60f49e99889..2e28e68fb9d 100644 --- a/src/poetry/utils/env/env_manager.py +++ b/src/poetry/utils/env/env_manager.py @@ -643,8 +643,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 {} @@ -652,25 +650,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 e78361f8480..5879676c691 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 1c443dbee30..53641dcb1d7 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -534,7 +534,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 ec88be4510d..737ec373474 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 18551c5af6e..82c63426b90 100644 --- a/tests/masonry/builders/test_editable_builder.py +++ b/tests/masonry/builders/test_editable_builder.py @@ -272,7 +272,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 dee66ba6a9f..2b38b60a1e8 100644 --- a/tests/test_factory.py +++ b/tests/test_factory.py @@ -554,7 +554,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 43d30c81d89..745b33a091d 100644 --- a/tests/utils/env/test_env.py +++ b/tests/utils/env/test_env.py @@ -313,15 +313,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()), ], ) @@ -339,14 +331,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 88d973da3c7..7724e891118 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", ) @@ -1179,7 +1178,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="non-package-mode-py3.7", ) @@ -1229,7 +1227,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", )