Skip to content

dont show warnigns/errors in cases where they add no value #1201

@RonnyPfannschmidt

Description

@RonnyPfannschmidt

Manual version shouldn't trigger setuptools scm

Sorry, I don't quite understand. Could you please explain more?

Let me briefly summarize my current situation. I have a pyproject.toml like this:

[project]
version = "0.1.0"

[build-system]
requires = [
    "setuptools",
    "setuptools-scm",
]

The project layout is as follows:

.git/
python/
└── pytauri-wheel/
    ├── pyproject.toml
    └── ...

I use setuptools-scm only to automatically include files tracked by git in the sdist, so I don't have to maintain a separate MANIFEST.in file. I dont use dynamic versioning.

I build my project with uv build python/pytauri-wheel. This worked fine in 8.*.
In >= 9.0.3, a new warning appears (I'm not sure if it's actually a warning, since I don't see WARN or similar, but it does show up in the terminal output):

(pytauri) PS E:\GitHub\pytauri> uv build --sdist --package=pytauri-wheel
Building source distribution...
+toml section missing 'pyproject.toml does not contain a tool.setuptools_scm section'
+Traceback (most recent call last):
+  File "C:\Users\WSH\AppData\Local\uv\cache\builds-v0\.tmpOuYQHX\lib\site-packages\setuptools_scm\_integration\pyproject_reading.py", line 113, in read_pyproject
+    section = defn.get("tool", {})[tool_name]
+KeyError: 'setuptools_scm'
running egg_info
writing python\pytauri_wheel.egg-info\PKG-INFO
writing dependency_links to python\pytauri_wheel.egg-info\dependency_links.txt
writing entry points to python\pytauri_wheel.egg-info\entry_points.txt
writing requirements to python\pytauri_wheel.egg-info\requires.txt
writing top-level names to python\pytauri_wheel.egg-info\top_level.txt
writing manifest file 'python\pytauri_wheel.egg-info\SOURCES.txt'
+toml section missing 'pyproject.toml does not contain a tool.setuptools_scm section'
+Traceback (most recent call last):
+  File "C:\Users\WSH\AppData\Local\uv\cache\builds-v0\.tmpOuYQHX\lib\site-packages\setuptools_scm\_integration\pyproject_reading.py", line 113, in read_pyproject
+    section = defn.get("tool", {})[tool_name]
+KeyError: 'setuptools_scm'
running sdist
running egg_info
writing python\pytauri_wheel.egg-info\PKG-INFO
writing dependency_links to python\pytauri_wheel.egg-info\dependency_links.txt
writing entry points to python\pytauri_wheel.egg-info\entry_points.txt
writing requirements to python\pytauri_wheel.egg-info\requires.txt
writing top-level names to python\pytauri_wheel.egg-info\top_level.txt
writing manifest file 'python\pytauri_wheel.egg-info\SOURCES.txt'
running check
creating pytauri_wheel-0.7.0
creating pytauri_wheel-0.7.0\icons
creating pytauri_wheel-0.7.0\python\pytauri_wheel
creating pytauri_wheel-0.7.0\python\pytauri_wheel.egg-info
creating pytauri_wheel-0.7.0\src
copying files to pytauri_wheel-0.7.0...
copying .gitignore -> pytauri_wheel-0.7.0
copying CHANGELOG.md -> pytauri_wheel-0.7.0
copying Cargo.toml -> pytauri_wheel-0.7.0
copying README.md -> pytauri_wheel-0.7.0
copying Tauri.toml -> pytauri_wheel-0.7.0
copying build.rs -> pytauri_wheel-0.7.0
copying pyproject.toml -> pytauri_wheel-0.7.0
copying setup.py -> pytauri_wheel-0.7.0
copying icons\README.md -> pytauri_wheel-0.7.0\icons
copying icons\icon.ico -> pytauri_wheel-0.7.0\icons
copying icons\icon.png -> pytauri_wheel-0.7.0\icons
copying python\pytauri_wheel\__init__.py -> pytauri_wheel-0.7.0\python\pytauri_wheel
copying python\pytauri_wheel\lib.py -> pytauri_wheel-0.7.0\python\pytauri_wheel
copying python\pytauri_wheel\py.typed -> pytauri_wheel-0.7.0\python\pytauri_wheel
copying python\pytauri_wheel.egg-info\PKG-INFO -> pytauri_wheel-0.7.0\python\pytauri_wheel.egg-info
copying python\pytauri_wheel.egg-info\SOURCES.txt -> pytauri_wheel-0.7.0\python\pytauri_wheel.egg-info
copying python\pytauri_wheel.egg-info\dependency_links.txt -> pytauri_wheel-0.7.0\python\pytauri_wheel.egg-info
copying python\pytauri_wheel.egg-info\entry_points.txt -> pytauri_wheel-0.7.0\python\pytauri_wheel.egg-info
copying python\pytauri_wheel.egg-info\requires.txt -> pytauri_wheel-0.7.0\python\pytauri_wheel.egg-info
copying python\pytauri_wheel.egg-info\top_level.txt -> pytauri_wheel-0.7.0\python\pytauri_wheel.egg-info
copying src\lib.rs -> pytauri_wheel-0.7.0\src
copying python\pytauri_wheel.egg-info\SOURCES.txt -> pytauri_wheel-0.7.0\python\pytauri_wheel.egg-info
Writing pytauri_wheel-0.7.0\setup.cfg
Creating tar archive
removing 'pytauri_wheel-0.7.0' (and everything under it)
Successfully built dist\pytauri_wheel-0.7.0.tar.gz

If I simply ignore this warning, everything seems to work as it did with 8.*.
However, I wanted to try following the suggestion in the error message and add an empty [tool.setuptools_scm] section to pyproject.toml:

[project]
version = "0.1.0"

[build-system]
requires = [
    "setuptools",
    "setuptools-scm",
]

+[tool.setuptools_scm]
+# None

But after I did this, it turned into the hard error mentioned earlier: #1184 (comment)


After further testing, I found that even in 8.*, adding an empty [tool.setuptools_scm] section causes the same error. (I guess that's why you said "This is expected", sorry I didn't realize this before.)

So if the [tool.setuptools_scm] section does not exist at all, will setuptools-scm automatically search upwards as you mentioned?

What do you suggest for migrating from 8.*? I still want to rely on setuptools-scm's automatic search upwards. Should we just ignore that warning?

Originally posted by @WSH032 in #1184

in the referred text the version is clearly set before - so we ought not to set it ourselfes - i need to validate setuptools behaviour, but i believe its related to when the toml file is actually read

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions