Skip to content

Commit 9f959b6

Browse files
authored
Merge pull request #64 from ewanwm/feature_dynamic_python_module_versions
Feature dynamic python module versions
2 parents 9592bd6 + 8e0973c commit 9f959b6

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

.github/workflows/pypi-distribution.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: Publish to PyPi
22

33
on:
4-
release:
5-
types: [published]
4+
push:
5+
tags:
6+
- '*'
67
workflow_dispatch:
78

89
jobs:

CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
77
set(CMAKE_CUDA_ARCHITECTURES 75)
88
endif()
99

10-
project(nuTens)
10+
# set the project name and version
11+
project(nuTens VERSION 0.1.0)
1112

1213
# Changes default install path to be a subdirectory of the build dir.
1314
# Can set build dir at configure time with -DCMAKE_INSTALL_PREFIX=/install/path

pyproject.toml

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
[project]
33
name = "nuTens"
4-
version = "0.0.3"
54
description="Library to calculate neutrino oscillation probabilities using tensors"
65
readme = "README.md"
76
authors = [
@@ -24,6 +23,7 @@ classifiers = [
2423
dependencies = [
2524
"torch"
2625
]
26+
dynamic = ["version"]
2727

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

4040
[tool.scikit-build.cmake]
4141
args = ["-DNT_ENABLE_PYTHON=ON"]
42+
43+
[tool.scikit-build.metadata.version]
44+
provider = "scikit_build_core.metadata.setuptools_scm"
45+
46+
[tool.scikit-build.sdist]
47+
include = ["src/package/_version.py"]
48+
49+
[tool.setuptools_scm] # Section required
50+
write_to = "_version.py"

python/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ endif()
1010
target_link_libraries( _pyNuTens PUBLIC nuTens )
1111

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

1515
install( TARGETS _pyNuTens DESTINATION nuTens/ )

0 commit comments

Comments
 (0)