Skip to content

Commit

Permalink
let python module get its version dynamically from the current tag an…
Browse files Browse the repository at this point in the history
…d branch so that they can be uploaded to test pypi without overlapping
  • Loading branch information
ewanwm committed Sep 25, 2024
1 parent 9592bd6 commit 26c316f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
set(CMAKE_CUDA_ARCHITECTURES 75)
endif()

project(nuTens)
# set the project name and version
project(nuTens VERSION 0.0.3)

# Changes default install path to be a subdirectory of the build dir.
# Can set build dir at configure time with -DCMAKE_INSTALL_PREFIX=/install/path
Expand Down
11 changes: 10 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

[project]
name = "nuTens"
version = "0.0.3"
description="Library to calculate neutrino oscillation probabilities using tensors"
readme = "README.md"
authors = [
Expand All @@ -24,6 +23,7 @@ classifiers = [
dependencies = [
"torch"
]
dynamic = ["version"]

[project.urls]
Repository = "https://github.com/ewanwm/nuTens"
Expand All @@ -39,3 +39,12 @@ build-frontend = "build[uv]"

[tool.scikit-build.cmake]
args = ["-DNT_ENABLE_PYTHON=ON"]

[tool.scikit-build.metadata.version]
provider = "scikit_build_core.metadata.setuptools_scm"

[tool.scikit-build.sdist]
include = ["src/package/_version.py"]

[tool.setuptools_scm] # Section required
write_to = "_version.py"
2 changes: 1 addition & 1 deletion python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ endif()
target_link_libraries( _pyNuTens PUBLIC nuTens )

# This is passing in the version as a define just as an example
target_compile_definitions( _pyNuTens PRIVATE VERSION_INFO=${PROJECT_VERSION} )
target_compile_definitions( _pyNuTens PRIVATE VERSION_INFO=${CMAKE_PROJECT_VERSION} )

install( TARGETS _pyNuTens DESTINATION nuTens/ )

0 comments on commit 26c316f

Please sign in to comment.