Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] pyproject.toml-only project does not support editable installation #3226

Closed
moshez opened this issue Mar 28, 2022 · 2 comments
Closed

Comments

@moshez
Copy link

moshez commented Mar 28, 2022

setuptools version

setuptools==61.0.0

Python version

Python 3.10.0

OS

Debian 11.1

Additional environment information

Probably does not matter, but this is running inside a Docker container inside an Alpine VM on an Intel Mac

Description

Trying pip install -e . on a project that has pyproject.toml but no setup.cfg gives the following:

ERROR: Project file:///home/developer/src/packaging-test has a 'pyproject.toml' and its build backend is missing the 'build_editable' hook. Since it does not have a 'setup.py' nor a 'setup.cfg', it cannot be installed in editable mode. Consider using a build backend that supports PEP 660.

Expected behavior

The same behavior that happens when an empty setup.cfg exists: the editable install succeeds, and relevant files are importable.

How to Reproduce

Pre-requisites:

  • Pip 22.0.4
  • Empty file one_python.py
  • Minimal pyproject.toml
$ pip --version
pip 22.0.4 from /home/developer/venv/packaging-test/lib/python3.10/site-packages/pip (python 3.10)
$ ls
one_python.py  pyproject.toml
$ cat pyproject.toml
[build-system]
requires = ["setuptools==61.0.0"]
build-backend = "setuptools.build_meta"
$ wc -c one_python.py 
0 one_python.py

An editable install fails:

$ pip install -e .
Obtaining file:///home/developer/src/packaging-test
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
ERROR: Project file:///home/developer/src/packaging-test has a 'pyproject.toml' and its build backend is missing the 'build_editable' hook. Since it does not have a 'setup.py' nor a 'setup.cfg', it cannot be installed in editable mode. Consider using a build backend that supports PEP 660.

Output

Obtaining file:///home/developer/src/packaging-test
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
ERROR: Project file:///home/developer/src/packaging-test has a 'pyproject.toml' and its build backend is missing the 'build_editable' hook. Since it does not have a 'setup.py' nor a 'setup.cfg', it cannot be installed in editable mode. Consider using a build backend that supports PEP 660.

For reference, the following things work:

A non-editable install succeeds:

$ pip install .
Processing /home/developer/src/packaging-test
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: one-python
  Building wheel for one-python (pyproject.toml) ... done
  Created wheel for one-python: filename=one_python-0.0.0-py3-none-any.whl size=1147 sha256=b458720439656246e39e4a4975950227cfd04114821b2b1e7a37bf3c444600fe
  Stored in directory: /home/developer/.cache/pip/wheels/54/a5/23/ea1c47be2f99b77892adebb70a760f7b94e5de40af92367e16
Successfully built one-python
Installing collected packages: one-python
  Attempting uninstall: one-python
    Found existing installation: one-python 0.0.0
    Uninstalling one-python-0.0.0:
      Successfully uninstalled one-python-0.0.0
Successfully installed one-python-0.0.0

Creating an empty setup.cfg causes an editable install to succeed:

$ touch setup.cfg
$ pip install -e .
Obtaining file:///home/developer/src/packaging-test
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Installing collected packages: one-python
  Attempting uninstall: one-python
    Found existing installation: one-python 0.0.0
    Uninstalling one-python-0.0.0:
      Successfully uninstalled one-python-0.0.0
  Running setup.py develop for one-python
Successfully installed one-python-0.0.0
@moshez moshez added bug Needs Triage Issues that need to be evaluated for severity and status. labels Mar 28, 2022
@di
Copy link
Member

di commented Mar 28, 2022

I think this is a duplicate of #2816.

@abravalheri
Copy link
Contributor

abravalheri commented Mar 28, 2022

Hi @moshez, I think I will close this issue as a duplicate, as pointed out by Dustin (it is best to keep the conversation centralized in one place).

The existing workaround is to keep either setup.cfg (an empty file will suffice, but you can also keep your flake8 configuration there) or setup.py (with the minimal setuptools stub import setuptools; setuptools.setup()).

@abravalheri abravalheri added duplicate and removed bug Needs Triage Issues that need to be evaluated for severity and status. labels Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants