pypa / setuptools-scm

the blessed package to manage your versions by scm tags

Home Page:https://setuptools-scm.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LookupError: pyproject.toml does not contain a tool.setuptools_scm section

ThomasWaldmann opened this issue · comments

commented

Just seen that with borgbackup 1.2-maint branch - this used to work since recently.

(borg-env) tw@mba2020 borg % python setup.py clean clean2
Detected OpenSSL [via pkg-config]
Detected and preferring liblz4 [via pkg-config]
Detected and preferring libzstd [via pkg-config]
Detected and preferring libxxhash [via pkg-config]
/Users/tw/w/borg-env/lib/python3.11/site-packages/setuptools/__init__.py:80: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
!!

        ********************************************************************************
        Requirements should be satisfied by a PEP 517 installer.
        If you are using pip, you can try `pip install --use-pep517`.
        ********************************************************************************

!!
  dist.fetch_build_eggs(dist.setup_requires)
[09/25/23 14:00:36] ERROR    pyproject.toml does not contain a tool.setuptools_scm section                                                                                 setuptools.py:123
                             Traceback (most recent call last):                                                                                                                             
                               File "/Users/tw/w/borg-env/lib/python3.11/site-packages/setuptools_scm/_integration/pyproject_reading.py", line 53, in read_pyproject                        
                                 section = defn.get("tool", {})[tool_name]                                                                                                                  
                                           ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^                                                                                                                  
                             KeyError: 'setuptools_scm'                                                                                                                                     
                                                                                                                                                                                            
                             The above exception was the direct cause of the following exception:                                                                                           
                                                                                                                                                                                            
                             Traceback (most recent call last):                                                                                                                             
                               File "/Users/tw/w/borg-env/lib/python3.11/site-packages/setuptools_scm/_integration/setuptools.py", line 121, in infer_version                               
                                 config = _config.Configuration.from_file(dist_name=dist_name)                                                                                              
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                              
                               File "/Users/tw/w/borg-env/lib/python3.11/site-packages/setuptools_scm/_config.py", line 128, in from_file                                                   
                                 pyproject_data = _read_pyproject(name, _load_toml=_load_toml)                                                                                              
                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                              
                               File "/Users/tw/w/borg-env/lib/python3.11/site-packages/setuptools_scm/_integration/pyproject_reading.py", line 55, in read_pyproject                        
                                 raise LookupError(f"{name} does not contain a tool.{tool_name} section") from e                                                                            
                             LookupError: pyproject.toml does not contain a tool.setuptools_scm section     
commented

Note: borg 1.2 is using a minimal pyproject.toml.

otoh, our master branch has migrated most stuff to pyproject.toml.

@ThomasWaldmann thank for the note a bugfix is already on the way (this is a regression triggered by a bugfix)

commented

Looks like this bug just reappeared in setuptools-scm 8.1.0 (again seen with borgbackup 1.2-maint branch). With 8.0.x I don't see this crash:

(borg-env) tw@server:~/w/borg$ pip install -U "setuptools-scm == 8.1.0"
Collecting setuptools-scm==8.1.0
  Using cached setuptools_scm-8.1.0-py3-none-any.whl.metadata (6.6 kB)
Requirement already satisfied: packaging>=20 in /mnt/fastssd/tw/w/borg-env/lib/python3.12/site-packages (from setuptools-scm==8.1.0) (24.1)
Requirement already satisfied: setuptools in /mnt/fastssd/tw/w/borg-env/lib/python3.12/site-packages (from setuptools-scm==8.1.0) (70.3.0)
Using cached setuptools_scm-8.1.0-py3-none-any.whl (43 kB)
Installing collected packages: setuptools-scm
  Attempting uninstall: setuptools-scm
    Found existing installation: setuptools-scm 8.0.4
    Uninstalling setuptools-scm-8.0.4:
      Successfully uninstalled setuptools-scm-8.0.4
Successfully installed setuptools-scm-8.1.0
(borg-env) tw@server:~/w/borg$ python setup.py clean
Detected OpenSSL [via pkg-config]
Detected and preferring liblz4 [via pkg-config]
Detected and preferring libzstd [via pkg-config]
Detected and preferring libxxhash [via pkg-config]
/mnt/fastssd/tw/w/borg-env/lib/python3.12/site-packages/setuptools/__init__.py:80: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
!!

        ********************************************************************************
        Requirements should be satisfied by a PEP 517 installer.
        If you are using pip, you can try `pip install --use-pep517`.
        ********************************************************************************

!!
  dist.fetch_build_eggs(dist.setup_requires)
WARNING setuptools_scm.pyproject_reading toml section missing 'pyproject.toml does not contain a tool.setuptools_scm section'
Traceback (most recent call last):
  File "/mnt/fastssd/tw/w/borg-env/lib/python3.12/site-packages/setuptools_scm/_integration/pyproject_reading.py", line 36, in read_pyproject
    section = defn.get("tool", {})[tool_name]
              ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: 'setuptools_scm'
running clean