File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
src/scikit_build_core/metadata Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -402,16 +402,18 @@ dynamic = ["version"]
402402metadata.version.provider = " scikit_build_core.metadata.setuptools_scm"
403403sdist.include = [" src/package/_version.py" ]
404404
405- [tool .setuptools_scm ]
405+ [tool .setuptools_scm ] # Section required
406406write_to = " src/package/_version.py"
407407```
408408
409409This sets the python project version according to
410410[ git tags] ( https://github.com/pypa/setuptools_scm/blob/fb261332d9b46aa5a258042d85baa5aa7b9f4fa2/README.rst#default-versioning-scheme )
411411or a
412412[ ` .git_archival.txt ` ] ( https://github.com/pypa/setuptools_scm/blob/fb261332d9b46aa5a258042d85baa5aa7b9f4fa2/README.rst#git-archives )
413- file, or equivalents for other VCS systems. With this, you may also to set the
414- cmake project version equivalently, e.g. using
413+ file, or equivalents for other VCS systems.
414+
415+ If you need to set the CMake project version without scikit-build-core (which
416+ provides ` ${SKBUILD_PROJECT_VERSION} ` ), you can use something like
415417[ ` DynamicVersion ` module] ( https://github.com/LecrisUT/CMakeExtraUtils/blob/180604da50a3c3588f9d04e4ebc6abb4e5a0d234/cmake/DynamicVersion.md )
416418from
417419[ github.com/LecrisUT/CMakeExtraUtils] ( https://github.com/LecrisUT/CMakeExtraUtils ) :
Original file line number Diff line number Diff line change @@ -25,7 +25,11 @@ def dynamic_metadata(
2525 from setuptools_scm import Configuration , _get_version
2626
2727 config = Configuration .from_file ("pyproject.toml" )
28- version : str = _get_version (config )
28+ version : str
29+ try :
30+ version = _get_version (config , force_write_version_files = True )
31+ except TypeError : # setuptools_scm < 8
32+ version = _get_version (config )
2933
3034 return version
3135
You can’t perform that action at this time.
0 commit comments