Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature dynamic python module versions #64

Merged
merged 3 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/pypi-distribution.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Publish to PyPi

on:
release:
types: [published]
push:
tags:
- '*'
workflow_dispatch:

jobs:
Expand Down
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.1.0)

# 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/ )
Loading