Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
^\.editorconfig$
^\.git$
^\.github$
^tmp$
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,6 @@ _processedLockFile.lock
R/jaspColumnEncoderVersion.R

inst/include/Common

# scratch space (python-interface work)
/tmp/
5 changes: 4 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,12 @@ location of the parent directory (e.g., the default is '-I\"../inst/include/jasp
exit 1
fi

SRC_SOURCES="$(cd src/ && ls *.cpp | tr '\n' ' ')"
SRC_SOURCES="$(cd src/ && { ls *.cpp 2>/dev/null; ls core/*.cpp 2>/dev/null; ls adapters/rcpp/*.cpp 2>/dev/null; } | tr '\n' ' ')"
JASPCOMMON_SOURCES="../${COMMON_DIR}/columntype.cpp"

# core/ is the R-free middle, adapters/rcpp the R binding layer (python-interface refactor)
PKG_CXXFLAGS="${PKG_CXXFLAGS} -I\".\" -I\"core\" -I\"adapters/rcpp\""

if [ "${JASP_R_INTERFACE_LIBRARY}" != "" ]; then
PKG_CXXFLAGS=-DJASP_R_INTERFACE_LIBRARY\ ${PKG_CXXFLAGS}
fi
Expand Down
5 changes: 4 additions & 1 deletion configure.win
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,12 @@ location of the parent directory (e.g., the default is '-I\"../inst/include/jasp
exit 1
fi

SRC_SOURCES="$(cd src/ && ls *.cpp | tr '\n' ' ')"
SRC_SOURCES="$(cd src/ && { ls *.cpp 2>/dev/null; ls core/*.cpp 2>/dev/null; ls adapters/rcpp/*.cpp 2>/dev/null; } | tr '\n' ' ')"
JASPCOMMON_SOURCES="../${COMMON_DIR}/columntype.cpp"

# core/ is the R-free middle, adapters/rcpp the R binding layer (python-interface refactor)
PKG_CXXFLAGS="${PKG_CXXFLAGS} -I\".\" -I\"core\" -I\"adapters/rcpp\""

if [ "${JASP_R_INTERFACE_LIBRARY}" != "" ]; then
PKG_CXXFLAGS=-DJASP_R_INTERFACE_LIBRARY\ ${PKG_CXXFLAGS}
fi
Expand Down
4 changes: 4 additions & 0 deletions python/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build/
__pycache__/
*.egg-info/
.pytest_cache/
30 changes: 30 additions & 0 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
cmake_minimum_required(VERSION 3.20)
project(jaspresults_python CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# python/ lives in jasp-desktop/Engine/jaspBase/python
get_filename_component(JASPBASE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/.." ABSOLUTE)
get_filename_component(JASP_DESKTOP_ROOT "${JASPBASE_ROOT}/../.." ABSOLUTE)

set(COMMON_DIR "${JASP_DESKTOP_ROOT}/Common" CACHE PATH "location of jasp-desktop/Common")
message(STATUS "jaspresults python: using Common at ${COMMON_DIR}")
if(NOT EXISTS "${COMMON_DIR}/json/json_value.cpp")
message(FATAL_ERROR "Common/json not found at ${COMMON_DIR} — pass -DCOMMON_DIR=")
endif()

# The R-free core (shared with the R engine build of jaspBase).
file(GLOB CORE_SOURCES CONFIGURE_DEPENDS "${JASPBASE_ROOT}/src/core/*.cpp")

find_package(pybind11 CONFIG REQUIRED)
pybind11_add_module(_jaspresults
${CORE_SOURCES}
src/_jaspresults/pyConversions.cpp
src/_jaspresults/pyModule.cpp)
target_include_directories(_jaspresults PRIVATE
"${JASPBASE_ROOT}/src/core"
"${COMMON_DIR}"
"src/_jaspresults")

install(TARGETS _jaspresults DESTINATION jaspresults)
19 changes: 19 additions & 0 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[build-system]
requires = ["scikit-build-core>=0.10", "pybind11>=2.13"]
build-backend = "scikit_build_core.build"

[project]
name = "jaspresults"
version = "0.20.0"
description = "JASP results engine driven from Python: same R-free C++ core that backs the R engine (jaspBase)."
readme = { text = "Python interface for the jaspResults C++ core, see tmp/plan-python-interface.md in the jaspBase repo.", content-type = "text/plain" }
requires-python = ">=3.10"
license = { text = "GPL-2.0-or-later" }

[project.optional-dependencies]
data = ["numpy", "pandas"]
test = ["pytest", "numpy", "pandas"]

[tool.scikit-build]
cmake.version = ">=3.20"
wheel.packages = ["src/jaspresults"]
Loading
Loading