setuptools: [BUG] recent versions of setuptools broke editable mode

setuptools version

65.2

Python version

3.9.13

OS

Ubuntu

Additional environment information

No response

Description

Since some recent releases (likely 64, when PEP-660 was implemented), installing psycopg with -e results in a broken package, where psycopg is an empty namespace.

This is an example of broken run. This is a similar run whose difference is installing psycopg without the -e flag, in order to test a depending package.

Expected behavior

See above

How to Reproduce

A more complete reproduction with stable git reference can be found in https://github.com/tox-dev/tox/issues/2479.

Output

See above

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 6
  • Comments: 20 (9 by maintainers)

Commits related to this issue

Most upvoted comments

@abravalheri I have reported a regression. Things were working previously and now they don’t. I appreciate the hard work behind the hard problem of packaging, don’t get me wrong. Regressions happen.

It is not true that a local directory used to have, or even has, precedence over installed packages:

  • this wasn’t the case in the past
  • this is not the case with packages installed without -e.

Since a certain version, the default behaviour of editable packages changed and now presents a noticeable difference w.r.t. normally-installed packages, and present difficulties developing certain repositories layout (a monorepo where the directory name matches the package name, for instance - like psycopg 3 repository).

So, this is a regression. My questions are:

  • is this regression wanted? As in, is the current behaviour the wanted behaviour? If so please document it (but with a WARNING, not with obscure options which need a pass-through pip command to activate, hence don’t even appear in pip --help) It would seem exceedingly bizarre to me. I invite you to look at the psycopg readme: we used to suggest to hack on the project using -e, whereas now we should explain setuptools internals.

  • is this regression unexpected? It sounds so to me, because other modes work differently (non-editable install, strict-editable, compat-editable). If so, is it expected to be fixed and can it become part of the spec/tests?

Thank you

Sorry for that. I never remember it by heart 😕

These are the options, copied straight from the docs:

pip install -e . --config-settings editable_mode=strict

pip install -e . --config-settings editable_mode=compat

Hi @qci-amos, please note the following caveat for SETUPTOOLS_ENABLE_FEATURES:

Finally, as long as pip allows it, you can use the environment variable SETUPTOOLS_ENABLE_FEATURES=“legacy-editable” to fallback to access the previous implementation and be bug-by-bug compatible.

Pip no longer allows backends to not implement PEP 660. So that is no longer an option.

What’s at stake for me is the ability to use vscode/pylance with my editable repos

I think the right question here is to ask how vscode and pylance allow you to pass customised --config-settings to pip.