Skip to content

Commit 51e628a

Browse files
committed
remove no-setuptools config option
1 parent 2ad0d93 commit 51e628a

13 files changed

Lines changed: 7 additions & 89 deletions

File tree

docs/configuration.md

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ virtualenvs.create = true
5656
virtualenvs.in-project = null
5757
virtualenvs.options.always-copy = true
5858
virtualenvs.options.no-pip = false
59-
virtualenvs.options.no-setuptools = false
6059
virtualenvs.options.system-site-packages = false
6160
virtualenvs.path = "{cache-dir}/virtualenvs" # /path/to/cache/directory/virtualenvs
6261
virtualenvs.prefer-active-python = false
@@ -391,35 +390,10 @@ Poetry, for its internal operations, uses the `pip` wheel embedded in the `virtu
391390
in Poetry's runtime environment. If a user runs `poetry run pip` when this option is set to `true`, the `pip` the
392391
embedded instance of `pip` is used.
393392

394-
You can safely set this, along with `no-setuptools`, to `true`, if you desire a virtual environment with no additional
395-
packages. This is desirable for production environments.
393+
You can safely set this to `true`, if you desire a virtual environment with no additional packages.
394+
This is desirable for production environments.
396395
{{% /note %}}
397396

398-
### `virtualenvs.options.no-setuptools`
399-
400-
**Type**: `boolean`
401-
402-
**Default**: `false`
403-
404-
**Environment Variable**: `POETRY_VIRTUALENVS_OPTIONS_NO_SETUPTOOLS`
405-
406-
*Introduced in 1.2.0*
407-
408-
If set to `true` the `--no-setuptools` parameter is passed to `virtualenv` on creation of the virtual environment. This
409-
means when a new virtual environment is created, `setuptools` will not be installed in the environment. Poetry, for its
410-
internal operations, does not require `setuptools` and this can safely be set to `true`.
411-
412-
For environments using python 3.12 or later, `virtualenv` defaults to not
413-
installing `setuptools` when creating a virtual environment.
414-
In such environments this poetry configuration option therefore has no effect:
415-
`setuptools` is not installed either way.
416-
If your project relies on `setuptools`, you should declare it as a dependency.
417-
418-
{{% warning %}}
419-
Some development tools like IDEs, make an assumption that `setuptools` (and other) packages are always present and
420-
available within a virtual environment. This can cause some features in these tools to not work as expected.
421-
{{% /warning %}}
422-
423397
### `virtualenvs.options.system-site-packages`
424398

425399
**Type**: `boolean`

src/poetry/config/config.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,7 @@ class Config:
114114
"options": {
115115
"always-copy": False,
116116
"system-site-packages": False,
117-
# we default to False here in order to prevent development environment
118-
# breakages for IDEs etc. as when working in these environments
119-
# assumptions are often made about virtual environments having pip and
120-
# setuptools.
121117
"no-pip": False,
122-
"no-setuptools": False,
123118
},
124119
"prefer-active-python": False,
125120
"prompt": "{project_name}-py{python_version}",
@@ -303,7 +298,6 @@ def _get_normalizer(name: str) -> Callable[[str], Any]:
303298
"virtualenvs.in-project",
304299
"virtualenvs.options.always-copy",
305300
"virtualenvs.options.no-pip",
306-
"virtualenvs.options.no-setuptools",
307301
"virtualenvs.options.system-site-packages",
308302
"virtualenvs.options.prefer-active-python",
309303
"experimental.system-git-client",

src/poetry/console/commands/config.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ def unique_config_values(self) -> dict[str, tuple[Any, Any]]:
6666
boolean_normalizer,
6767
),
6868
"virtualenvs.options.no-pip": (boolean_validator, boolean_normalizer),
69-
"virtualenvs.options.no-setuptools": (
70-
boolean_validator,
71-
boolean_normalizer,
72-
),
7369
"virtualenvs.path": (str, lambda val: str(Path(val))),
7470
"virtualenvs.prefer-active-python": (boolean_validator, boolean_normalizer),
7571
"virtualenvs.prompt": (str, str),

src/poetry/utils/env/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def build_environment(
6969
if not env or poetry.package.build_script:
7070
with ephemeral_environment(
7171
executable=env.python if env else None,
72-
flags={"no-pip": True, "no-setuptools": True, "no-wheel": True},
72+
flags={"no-pip": True},
7373
) as venv:
7474
if io:
7575
requires = [

src/poetry/utils/env/env_manager.py

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -625,34 +625,16 @@ def build_venv(
625625
executable: Path | None = None,
626626
flags: dict[str, str | bool] | None = None,
627627
with_pip: bool | None = None,
628-
with_wheel: bool | None = None,
629-
with_setuptools: bool | None = None,
630628
prompt: str | None = None,
631629
) -> virtualenv.run.session.Session:
632630
flags = flags or {}
633631

634632
if with_pip is not None:
635633
flags["no-pip"] = not with_pip
636634

637-
if with_wheel is not None:
638-
wheel_flags: dict[str, str | bool] = (
639-
{"wheel": "bundle"} if with_wheel else {"no-wheel": True}
640-
)
641-
flags.update(wheel_flags)
642-
643-
if with_setuptools is not None:
644-
setuptools_flags: dict[str, str | bool] = (
645-
{"setuptools": "bundle"} if with_setuptools else {"no-setuptools": True}
646-
)
647-
flags.update(setuptools_flags)
648-
649635
flags.setdefault("no-pip", True)
650-
651-
if "setuptools" not in flags and "no-setuptools" not in flags:
652-
flags["no-setuptools"] = True
653-
654-
if "wheel" not in flags and "no-wheel" not in flags:
655-
flags["no-wheel"] = True
636+
flags.setdefault("no-setuptools", True)
637+
flags.setdefault("no-wheel", True)
656638

657639
if WINDOWS:
658640
path = get_real_windows_path(path)

src/poetry/utils/isolated_build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def isolated_builder(
136136

137137
with ephemeral_environment(
138138
executable=python_executable,
139-
flags={"no-pip": True, "no-setuptools": True, "no-wheel": True},
139+
flags={"no-pip": True},
140140
) as venv:
141141
env = IsolatedEnv(venv, pool)
142142
stdout = StringIO()

tests/conftest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,6 @@ def venv_flags_default() -> dict[str, bool]:
506506
"always-copy": False,
507507
"system-site-packages": False,
508508
"no-pip": False,
509-
"no-setuptools": False,
510509
}
511510

512511

tests/console/commands/env/test_use.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ def test_activate_activates_non_existing_virtualenv_no_envs_file(
7777
"always-copy": False,
7878
"system-site-packages": False,
7979
"no-pip": False,
80-
"no-setuptools": False,
8180
},
8281
prompt="simple-project-py3.7",
8382
)

tests/console/commands/test_config.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ def test_list_displays_default_value_if_not_set(
6666
virtualenvs.in-project = null
6767
virtualenvs.options.always-copy = false
6868
virtualenvs.options.no-pip = false
69-
virtualenvs.options.no-setuptools = false
7069
virtualenvs.options.system-site-packages = false
7170
virtualenvs.path = {venv_path} # {config_cache_dir / 'virtualenvs'}
7271
virtualenvs.prefer-active-python = false
@@ -99,7 +98,6 @@ def test_list_displays_set_get_setting(
9998
virtualenvs.in-project = null
10099
virtualenvs.options.always-copy = false
101100
virtualenvs.options.no-pip = false
102-
virtualenvs.options.no-setuptools = false
103101
virtualenvs.options.system-site-packages = false
104102
virtualenvs.path = {venv_path} # {config_cache_dir / 'virtualenvs'}
105103
virtualenvs.prefer-active-python = false
@@ -153,7 +151,6 @@ def test_unset_setting(
153151
virtualenvs.in-project = null
154152
virtualenvs.options.always-copy = false
155153
virtualenvs.options.no-pip = false
156-
virtualenvs.options.no-setuptools = false
157154
virtualenvs.options.system-site-packages = false
158155
virtualenvs.path = {venv_path} # {config_cache_dir / 'virtualenvs'}
159156
virtualenvs.prefer-active-python = false
@@ -185,7 +182,6 @@ def test_unset_repo_setting(
185182
virtualenvs.in-project = null
186183
virtualenvs.options.always-copy = false
187184
virtualenvs.options.no-pip = false
188-
virtualenvs.options.no-setuptools = false
189185
virtualenvs.options.system-site-packages = false
190186
virtualenvs.path = {venv_path} # {config_cache_dir / 'virtualenvs'}
191187
virtualenvs.prefer-active-python = false
@@ -315,7 +311,6 @@ def test_list_displays_set_get_local_setting(
315311
virtualenvs.in-project = null
316312
virtualenvs.options.always-copy = false
317313
virtualenvs.options.no-pip = false
318-
virtualenvs.options.no-setuptools = false
319314
virtualenvs.options.system-site-packages = false
320315
virtualenvs.path = {venv_path} # {config_cache_dir / 'virtualenvs'}
321316
virtualenvs.prefer-active-python = false
@@ -356,7 +351,6 @@ def test_list_must_not_display_sources_from_pyproject_toml(
356351
virtualenvs.in-project = null
357352
virtualenvs.options.always-copy = false
358353
virtualenvs.options.no-pip = false
359-
virtualenvs.options.no-setuptools = false
360354
virtualenvs.options.system-site-packages = false
361355
virtualenvs.path = {venv_path} # {config_cache_dir / 'virtualenvs'}
362356
virtualenvs.prefer-active-python = false

tests/masonry/builders/test_editable_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def test_builder_setup_generation_runs_with_pip_editable(
260260
poetry = Factory().create_poetry(extended_project)
261261

262262
# we need a venv with pip and setuptools since we are verifying setup.py builds
263-
with ephemeral_environment(flags={"no-setuptools": False, "no-pip": False}) as venv:
263+
with ephemeral_environment(flags={"no-pip": False}) as venv:
264264
builder = EditableBuilder(poetry, venv, NullIO())
265265
builder.build()
266266

0 commit comments

Comments
 (0)