Repository navigation
Versioning scheme #6
Description
Activity
Cc: @blowekamp
I am a big fan of SimpleITK's automatic generation of PEP 440 version tag based on SimpleITK's repo. This creates a version which defines a location anywhere in the next, master or release branches.
However, if this python packaging system does not readily support building an arbitrary spot in the SimpleITK repo then there is no need for that fancyness, and a more manual tag could be done.
If it's a manually updated version, then how can nightly, or development packages be created?
I am a big fan of SimpleITK's automatic generation of PEP 440 version tag based on SimpleITK's repo.
This is great. The python-versioneer allow to generate package compliant with PEP-440 very easily. Additionally, when the package is built from the source distribution (which is a tar.gz archive that is not associated with a git checkout), the correct version information are also available.
It can be configured quite easily with a adding few line of config to
setup.cfg, here is an example.The different versioning scheme are detailed here
This approach means that the versioning of the wheels will be based on the tag associated with
SimpleITK/SimpleITKPythonPackagerepository. Nothing prevent the tag associated with this project to match the one associated with upstream SimpleITK. That way the generated wheels will have the same major/minor/patch version.Let me know what you think.
There is some really great stuff to already do this in SimpleITK:
https://github.com/SimpleITK/SimpleITK/blob/master/CMake/sitkSourceVersion.cmake
https://github.com/SimpleITK/SimpleITK/blob/master/CMake/sitkSourceVersionVars.cmake.inWhat I'd ideally like to see is some file similar to "cmake/_version.py" make some CMake call to run CMake script ( https://github.com/SimpleITK/SimpleITK/blob/master/Version.cmake ), to get the SimpleITK defined versions. The propagate those to the Python Packaging.
Does scikit-build provide a way to call execute CMake? And a way to exchange variables?
see is some file similar to "cmake/_version.py" make some CMake call to run CMake script
Makes sense. We could then use all the logic of python-versioneer and plug the SimpleITK custom implementation in a file named
SimpleITK/_version.pyDoes scikit-build provide a way to call execute CMake?
Not yet. That said, similarly to cmaker.configure, we could add a
cmaker.runmethod ...And a way to exchange variables?
What do you exactly mean by "exchange" ?
What do you exactly mean by "exchange" ?
By "exchange" I mean a general term for some type of information transfer between the python code and the CMake code. This could take the form of arguments to CMake, and returned values form the CMake process. This could be the python code produced command line arguments for the CMake script execution from python argument, and python has the ability to read a CMakeCache style file? Or maybe CMake produces python code which gets executed? I method for communicated this information back and forth is useful, and it would be good to have some abstraction on this. This abstraction I think is useful and generic.
For reference here is a produced generated sitkSourceVersionVars.cmake, based on introspection of the git repository. It is generated based solely on the git repo and tags:
`macro( _set_if_not_empty var value )
if( NOT "${value}" STREQUAL "" )
set( ${var} "${value}" )
endif()
endmacro()set( _GIT_VERSION_MAJOR "0" )
set( _GIT_VERSION_MINOR "10" )
_set_if_not_empty( _GIT_VERSION_PATCH "0" )
_set_if_not_empty( _GIT_VERSION_TWEAK "" )
_set_if_not_empty( _GIT_VERSION_RC "" )
_set_if_not_empty( _GIT_VERSION_POST "" )
_set_if_not_empty( _GIT_VERSION_DEV "200" )
_set_if_not_empty( _GIT_VERSION_HASH "78a4f" )`This is then combined with manual configured info here:
https://github.com/SimpleITK/SimpleITK/blob/master/Version.cmake
https://github.com/SimpleITK/SimpleITK/blob/ec23b1a8efe86da1bbd4fc5d206df3cbc18893bd/CMakeLists.txt#L23-L50I suspect ff we can get the values of the CMake variables matching
SimpleITK_VERSION_*over to python and into versioner thing should work nicely.
Moving forward, few options:
For a simple example, see scikit-build/scikit-ci@01987f0