diff --git a/go-pyprocess/.github/workflows/main.yml b/go-pyprocess/.github/workflows/main.yml deleted file mode 100644 index a760a879..00000000 --- a/go-pyprocess/.github/workflows/main.yml +++ /dev/null @@ -1,386 +0,0 @@ -name: build xo-pyprocess + dependencies - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -env: - # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) - BUILD_TYPE: Release - -jobs: - build: - # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. - # You can convert this to a matrix build if you need cross-platform coverage. - # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix - runs-on: ubuntu-latest - - steps: - - name: checkout source - uses: actions/checkout@v3 - - - name: Install catch2 - # install catch2. see [[https://stackoverflow.com/questions/57982945/how-to-apt-get-install-in-a-github-actions-workflow]] - run: sudo apt-get install -y catch2 - - - name: Install pybind11-dev - run: sudo apt-get install -y pybind11-dev - - # ---------------------------------------------------------------- - - - name: Clone xo-cmake - uses: actions/checkout@v3 - with: - repository: Rconybea/xo-cmake - path: repo/xo-cmake - - - name: Configure xo-cmake - run: cmake -B ${{github.workspace}}/build_xo-cmake -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/xo-cmake - - - name: Build xo-cmake (trivial) - run: cmake --build ${{github.workspace}}/build_xo-cmake --config ${{env.BUILD_TYPE}} - - - name: Install xo-cmake - run: cmake --install ${{github.workspace}}/build_xo-cmake - - # ---------------------------------------------------------------- - - - name: Clone indentlog - uses: actions/checkout@v3 - with: - repository: Rconybea/indentlog - path: repo/indentlog - - - name: Configure indentlog - # configure cmake for indentlog in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_indentlog -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/indentlog - - - name: Build indentlog - run: cmake --build ${{github.workspace}}/build_indentlog --config ${{env.BUILD_TYPE}} - - - name: Install indentlog - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_indentlog - - # ---------------------------------------------------------------- - - - name: Clone subsys - uses: actions/checkout@v3 - with: - repository: Rconybea/subsys - path: repo/subsys - - - name: Configure subsys - # configure cmake for subsys in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_subsys -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/subsys - - - name: Build subsys - run: cmake --build ${{github.workspace}}/build_subsys --config ${{env.BUILD_TYPE}} - - - name: Install subsys - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_subsys - - # ---------------------------------------------------------------- - - - name: Clone refcnt - uses: actions/checkout@v3 - with: - repository: Rconybea/refcnt - path: repo/refcnt - - - name: Configure refcnt - # configure cmake for refcnt in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_refcnt -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/refcnt - - - name: Build refcnt - run: cmake --build ${{github.workspace}}/build_refcnt --config ${{env.BUILD_TYPE}} - - - name: Install refcnt - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_refcnt - - # ---------------------------------------------------------------- - - - name: Clone reflect - uses: actions/checkout@v3 - with: - repository: Rconybea/reflect - path: repo/reflect - - - name: Configure reflect - # configure cmake for reflect in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_reflect -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/reflect - - - name: Build reflect - run: cmake --build ${{github.workspace}}/build_reflect --config ${{env.BUILD_TYPE}} - - - name: Install reflect - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_reflect - - # ---------------------------------------------------------------- - - - name: Clone callback - uses: actions/checkout@v3 - with: - repository: Rconybea/xo-callback - path: repo/callback - - - name: Configure callback - # configure cmake for callback in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_callback -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/callback - - - name: Build callback - run: cmake --build ${{github.workspace}}/build_callback --config ${{env.BUILD_TYPE}} - - - name: Install callback - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_callback - - # ---------------------------------------------------------------- - - - name: Clone webutil - uses: actions/checkout@v3 - with: - repository: Rconybea/xo-webutil - path: repo/webutil - - - name: Configure webutil - # configure cmake for webutil in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_webutil -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/webutil - - - name: Build webutil - run: cmake --build ${{github.workspace}}/build_webutil --config ${{env.BUILD_TYPE}} - - - name: Install webutil - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_webutil - - # ---------------------------------------------------------------- - - - name: Clone pyutil - uses: actions/checkout@v3 - with: - repository: Rconybea/xo-pyutil - path: repo/pyutil - - - name: Configure pyutil - # configure cmake for pyutil in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_pyutil -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/pyutil - - - name: Build pyutil - run: cmake --build ${{github.workspace}}/build_pyutil --config ${{env.BUILD_TYPE}} - - - name: Install pyutil - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_pyutil - - # ---------------------------------------------------------------- - - - name: Clone pywebutil - uses: actions/checkout@v3 - with: - repository: Rconybea/xo-pywebutil - path: repo/pywebutil - - - name: Configure pywebutil - # configure cmake for pywebutil in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_pywebutil -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/pywebutil - - - name: Build pywebutil - run: cmake --build ${{github.workspace}}/build_pywebutil --config ${{env.BUILD_TYPE}} - - - name: Install pywebutil - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_pywebutil - - # ---------------------------------------------------------------- - - - name: Clone printjson - uses: actions/checkout@v3 - with: - repository: Rconybea/xo-printjson - path: repo/printjson - - - name: Configure printjson - # configure cmake for printjson in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_printjson -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/printjson - - - name: Build printjson - run: cmake --build ${{github.workspace}}/build_printjson --config ${{env.BUILD_TYPE}} - - - name: Install printjson - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_printjson - - # ---------------------------------------------------------------- - - - name: Clone randomgen - uses: actions/checkout@v3 - with: - repository: Rconybea/randomgen - path: repo/randomgen - - - name: Configure randomgen - # configure cmake for randomgen in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_randomgen -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/randomgen - - - name: Build randomgen - run: cmake --build ${{github.workspace}}/build_randomgen --config ${{env.BUILD_TYPE}} - - - name: Install randomgen - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_randomgen - - # ---------------------------------------------------------------- - - - name: Clone ordinaltree - uses: actions/checkout@v3 - with: - repository: Rconybea/xo-ordinaltree - path: repo/ordinaltree - - - name: Configure ordinaltree - # configure cmake for ordinaltree in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_ordinaltree -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/ordinaltree - - - name: Build ordinaltree - run: cmake --build ${{github.workspace}}/build_ordinaltree --config ${{env.BUILD_TYPE}} - - - name: Install ordinaltree - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_ordinaltree - - # ---------------------------------------------------------------- - - - name: Clone reactor - uses: actions/checkout@v3 - with: - repository: Rconybea/xo-reactor - path: repo/reactor - - - name: Configure reactor - # configure cmake for reactor in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_reactor -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/reactor - - - name: Build reactor - run: cmake --build ${{github.workspace}}/build_reactor --config ${{env.BUILD_TYPE}} - - - name: Install reactor - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_reactor - - # ---------------------------------------------------------------- - - - name: Clone simulator - uses: actions/checkout@v3 - with: - repository: Rconybea/xo-simulator - path: repo/simulator - - - name: Configure simulator - # configure cmake for simulator in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_simulator -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/simulator - - - name: Build simulator - run: cmake --build ${{github.workspace}}/build_simulator --config ${{env.BUILD_TYPE}} - - - name: Install simulator - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_simulator - - # ---------------------------------------------------------------- - - - name: Clone process - uses: actions/checkout@v3 - with: - repository: Rconybea/xo-process - path: repo/process - - - name: Configure process - # configure cmake for process in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_process -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/process - - - name: Build process - run: cmake --build ${{github.workspace}}/build_process --config ${{env.BUILD_TYPE}} - - - name: Install process - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_process - - # ---------------------------------------------------------------- - - - name: Clone pyreflect - uses: actions/checkout@v3 - with: - repository: Rconybea/xo-pyreflect - path: repo/pyreflect - - - name: Configure pyreflect - # configure cmake for pyreflect in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_pyreflect -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/pyreflect - - - name: Build pyreflect - run: cmake --build ${{github.workspace}}/build_pyreflect --config ${{env.BUILD_TYPE}} - - - name: Install pyreflect - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_pyreflect - - # ---------------------------------------------------------------- - - - name: Clone pyprintjson - uses: actions/checkout@v3 - with: - repository: Rconybea/xo-pyprintjson - path: repo/pyprintjson - - - name: Configure pyprintjson - # configure cmake for pyprintjson in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_pyprintjson -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/pyprintjson - - - name: Build pyprintjson - run: cmake --build ${{github.workspace}}/build_pyprintjson --config ${{env.BUILD_TYPE}} - - - name: Install pyprintjson - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_pyprintjson - - # ---------------------------------------------------------------- - - - name: Clone pyreactor - uses: actions/checkout@v3 - with: - repository: Rconybea/xo-pyreactor - path: repo/pyreactor - - - name: Configure pyreactor - # configure cmake for pyreactor in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_pyreactor -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/pyreactor - - - name: Build pyreactor - run: cmake --build ${{github.workspace}}/build_pyreactor --config ${{env.BUILD_TYPE}} - - - name: Install pyreactor - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_pyreactor - - # ---------------------------------------------------------------- - - - name: Configure self (pyprocess) - # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. - # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type - run: cmake -B ${{github.workspace}}/build_pyprocess -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - - - name: Build self (pyprocess) - # Build your program with the given configuration - run: cmake --build ${{github.workspace}}/build_pyprocess --config ${{env.BUILD_TYPE}} - - - name: Test self (pyprocess) - working-directory: ${{github.workspace}}/build_pyprocess - # Execute tests defined by the CMake configuration. - # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - run: ctest -C ${{env.BUILD_TYPE}} diff --git a/go-pyprocess/.gitignore b/go-pyprocess/.gitignore deleted file mode 100644 index 53a9c92f..00000000 --- a/go-pyprocess/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -# lsp keeps state here -.cache -# typical build directory -.build* -# lsp: symlink to file in build directory (established manually) -compile_commands.json diff --git a/go-pyprocess/CMakeLists.txt b/go-pyprocess/CMakeLists.txt deleted file mode 100644 index e2693076..00000000 --- a/go-pyprocess/CMakeLists.txt +++ /dev/null @@ -1,27 +0,0 @@ -# xo-pyprocess/CMakeLists.txt - -cmake_minimum_required(VERSION 3.10) - -project(xo_pyprocess VERSION 0.1) - -include(GNUInstallDirs) -include(cmake/xo-bootstrap-macros.cmake) - -xo_cxx_toplevel_options3() - -# ---------------------------------------------------------------- -# c++ settings (usually temporary) - -set(PROJECT_CXX_FLAGS "") -add_definitions(${PROJECT_CXX_FLAGS}) - -# ---------------------------------------------------------------- - -add_subdirectory(src/pyprocess) - -# ---------------------------------------------------------------- -# provide find_package() support - -xo_export_cmake_config(${PROJECT_NAME} ${PROJECT_VERSION} ${PROJECT_NAME}Targets) - -# end CMakeLists.txt diff --git a/go-pyprocess/EXAMPLES b/go-pyprocess/EXAMPLES deleted file mode 100644 index a8ce9feb..00000000 --- a/go-pyprocess/EXAMPLES +++ /dev/null @@ -1,57 +0,0 @@ -process module, using pybind11 to wrap c++ implementation - -To demo - -1. build the kalman project - see path/to/kalman/README - - python-compatible .so will be at: - path/to/kalman/build/process_py/process_py.cpython-39-darwin.so - -2. run python: - $ cd path/to/kalman/build/pyprocess - $ python3 - Python 3.9.12 (main, May 13 2022, 08:13:55) - [Clang 11.1.0 ] on darwin - Type "help", "copyright", "credits" or "license" for more information. - >>> - -3. import pybind11 module and run: - >>> import pyprocess - >>> import datetime as dt - >>> from datetime import datetime as clock - >>> t0=clock.now() - # brownian motion, 50% annual volatility - >>> bm=pyprocess.make_brownian_motion(t0, 0.5) - >>> bm - - >>> bm.exterior_sample(t0, [t0, 2.0]) - 2.0 - >>> bm.exterior_sample(t0, [t0, 1.0]) - 1.0 - >>> bm.exterior_sample(t0 + dt.timedelta(days=30, [t0, 1.0])) - 1.959941114989831 - - >>> ebm=pyprocess.make_exponential_brownian_motion(t0, 0.5) - >>> ebm - - >>> ebm.exterior_sample(t + dt.timedelta(days=180, [t0, 50.0])) - 42.3212369005776 - >>> ebm.exterior_sample(t + dt.timedelta(days=180, [t0, 50.0])) - 56.16317742801309 - - >>> r=pyprocess.make_realization_source(ebm, dt.timedelta(seconds=1)) - -4. attach printer - - >>> import reactor_py - >>> p=reactor_py.make_realization_printer() - >>> r.attach_sink(p) - >>> bm.deliver_one() - >>> bm.deliver_one() - >>> r.deliver_one() - [20220718:224818.909576, 0] - 1 - >>> r.deliver_one() - [20220718:224819.909576, -0.000111338] - 1 diff --git a/go-pyprocess/README.md b/go-pyprocess/README.md deleted file mode 100644 index 07725a19..00000000 --- a/go-pyprocess/README.md +++ /dev/null @@ -1,72 +0,0 @@ -# python bindings for c++ stochastic process library (xo-process) - -## Getting Started - -### build + install dependencies - -- [github/Rconybea/xo-process](https://github.com/Rconybea/xo-process) -- [github/Rconybea/xo-reactor](https://github.com/Rconybea/xo-reactor) -- [github/Rconybea/xo-pyutil](https://github.com/Rconybea/xo-pyutil) -- [github/Rconybea/xo-pyreflect](https://github.com/Rconybea/xo-pyreflect) -- [github/Rconybea/xo-pyprintjson](https://github.com/Rconybea/xo-pyprintjson) -- [github/Rconybea/xo-pyreactor](https://github.com/Rconybea/xo-pyreactor) - -### build + install -``` -$ cd xo-pyprocess -$ mkdir build -$ cd build -$ INSTALL_PREFIX=/usr/local # or wherever you prefer, e.g. ~/local -$ cmake \ - -DCMAKE_MODULE_PATH=${INSTALL_PREFIX}/share/cmake \ - -DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} \ - -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} .. -$ make -$ make install -``` -(also see .github/workflows/main.yml) - -## Examples - -Assumes `xo-pyprocess` installed to `~/local2/lib` -``` -PYTHONPATH=~/local2/lib:$PYTHONPATH python ->>> import xo_pyprocess ->>> dir(xo_pyprocess) -['BrownianMotion', 'ExpProcess', 'RealizationSource', 'RealizationTracer', 'StochasticProcess', 'UpxAdapterSink', 'UpxEvent', 'UpxEventStore', 'UpxToConsole', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'make_brownian_motion', 'make_exponential_brownian_motion', 'make_realization_printer', 'make_realization_source', 'make_tracer'] ->>> -``` - -## Development - -# build for unit test coverage -``` -$ cd xo-pyprocess -$ mkdir build-ccov -$ cd build-ccov -$ cmake \ - -DCMAKE_MODULE_PATH=${INSTALL_PREFIX}/share/cmake \ - -DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} \ - -DCODE_COVERAGE=ON \ - -DCMAKE_BUILD_TYPE=Debug .. -``` - -# LSP (language server) support - -LSP looks for compile commands in the root of the source tree; -while Cmake creates them in the root of its build directory. - -``` -$ cd xo-pyprocess -$ ln -s build/compile_commands.json # supply compile commands to LSP -``` - -# Examples - -Assumes `xo-pyprocess` installed to `~/local2/lib` - -``` -PYTHONPATH=~/local2/lib python ->>> import pyprocess ->>> dir(pyprocess) -``` diff --git a/go-pyprocess/cmake/xo-bootstrap-macros.cmake b/go-pyprocess/cmake/xo-bootstrap-macros.cmake deleted file mode 100644 index aba31169..00000000 --- a/go-pyprocess/cmake/xo-bootstrap-macros.cmake +++ /dev/null @@ -1,35 +0,0 @@ -# ---------------------------------------------------------------- -# for example: -# $ PREFIX=/usr/local # for example -# $ cmake -DCMAKE_MODULE_PATH=prefix -DCMAKE_INSTALL_PREFIX=$PREFIX -B .build -# -# will get -# CMAKE_MODULE_PATH -# from xo-cmake-config --cmake-module-path -# -# and expect .cmake macros in -# CMAKE_MODULE_PATH/xo_macros/xo_cxx.cmake -# ---------------------------------------------------------------- - -find_program(XO_CMAKE_CONFIG_EXECUTABLE NAMES xo-cmake-config REQUIRED) - -if ("${XO_CMAKE_CONFIG_EXECUTABLE}" STREQUAL "XO_CMAKE_CONFIG_EXECUTABLE-NOT_FOUND") - message(FATAL "could not find xo-cmake-config executable") -endif() - -message(STATUS "XO_CMAKE_CONFIG_EXECUTABLE=${XO_CMAKE_CONFIG_EXECUTABLE}") - -if (NOT XO_SUBMODULE_BUILD) - if (("${CMAKE_MODULE_PATH}" STREQUAL "") OR ("${CMAKE_MODULE_PATH}" STREQUAL prefix)) - # default to typical install location for xo-project-macros - execute_process(COMMAND ${XO_CMAKE_CONFIG_EXECUTABLE} --cmake-module-path OUTPUT_VARIABLE CMAKE_MODULE_PATH) - message(STATUS "CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}") - endif() -endif() - -# needs to have been installed somewhere on CMAKE_MODULE_PATH, -# (e.g. from xo-cmake with the same value for CMAKE_INSTALL_PREFIX) -# -include(xo_macros/xo_cxx) - -xo_cxx_bootstrap_message() diff --git a/go-pyprocess/cmake/xo_pyprocessConfig.cmake.in b/go-pyprocess/cmake/xo_pyprocessConfig.cmake.in deleted file mode 100644 index 9c15f36a..00000000 --- a/go-pyprocess/cmake/xo_pyprocessConfig.cmake.in +++ /dev/null @@ -1,4 +0,0 @@ -@PACKAGE_INIT@ - -include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") -check_required_components("@PROJECT_NAME@") diff --git a/go-pyprocess/include/README.md b/go-pyprocess/include/README.md deleted file mode 100644 index aca8853c..00000000 --- a/go-pyprocess/include/README.md +++ /dev/null @@ -1 +0,0 @@ -placeholder for future pyprocess #include files diff --git a/go-pyprocess/src/pyprocess/CMakeLists.txt b/go-pyprocess/src/pyprocess/CMakeLists.txt deleted file mode 100644 index 87a23e90..00000000 --- a/go-pyprocess/src/pyprocess/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# xo_pyprocess/src/pyprocess/CMakeLists.txt - -set(SELF_LIB xo_pyprocess) -set(SELF_SRCS pyprocess.cpp) - -xo_pybind11_library(${SELF_LIB} ${PROJECT_NAME}Targets ${SELF_SRCS}) - -xo_pybind11_dependency(${SELF_LIB} process) -xo_pybind11_header_dependency(${SELF_LIB} xo_pyreactor) -xo_pybind11_header_dependency(${SELF_LIB} xo_pywebutil) diff --git a/go-pyprocess/src/pyprocess/pyprocess.cpp b/go-pyprocess/src/pyprocess/pyprocess.cpp deleted file mode 100644 index e5b51dcc..00000000 --- a/go-pyprocess/src/pyprocess/pyprocess.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* @file pyprocess.cpp */ - -// note: need pyprocess/ here bc pyprocess.hpp is generated, located in build directory -#include "pyprocess.hpp" -#include "xo/pywebutil/pywebutil.hpp" -#include "xo/process/init_process.hpp" -#include "xo/process/UpxToConsole.hpp" -#include "xo/process/StochasticProcess.hpp" -#include "xo/process/BrownianMotion.hpp" -#include "xo/process/ExpProcess.hpp" -#include "xo/process/RealizationSource.hpp" -#include "xo/pyreactor/pyreactor.hpp" -#include "xo/reactor/EventStore.hpp" -#include "xo/reactor/PolyAdapterSink.hpp" -#include "xo/randomgen/random_seed.hpp" -#include "xo/randomgen/xoshiro256.hpp" -#include -#include -#include - -/* xo::ref::intrusive_ptr is an intrusively-reference-counted pointer. - * always safe to create one from a T* p - * (since refcount is directly accessible from p) - */ -PYBIND11_DECLARE_HOLDER_TYPE(T, xo::ref::intrusive_ptr, true); - -namespace xo { - using xo::reactor::AbstractSink; - using xo::reactor::AbstractEventStore; - using xo::reactor::StructEventStore; - using xo::reactor::PolyAdapterSink; - using xo::json::PrintJsonSingleton; - using xo::time::utc_nanos; - using xo::rng::Seed; - using xo::rng::xoshiro256ss; - namespace py = pybind11; - - namespace process { - PYBIND11_MODULE(PYPROCESS_MODULE_NAME(), m) { - /* ensure process/ will be initialized */ - InitSubsys::require(); - /* ..and immediately perform init steps */ - Subsystem::initialize_all(); - - /* e.g. py wrapper for xo::reactor::ReactorSource */ - PYREACTOR_IMPORT_MODULE(); - /* e.g. py wrapper for xo::web::EndpointDescr */ - PYWEBUTIL_IMPORT_MODULE(); - - m.doc() = "pybind11 plugin for xo.process"; - - m.def("make_brownian_motion", - [](utc_nanos start_tm, - double annual_volatility) { - Seed seed; - - return BrownianMotion::make(start_tm, - annual_volatility, - seed); - }, - "create new BrownianMotion instance"); - - m.def("make_exponential_brownian_motion", - [](utc_nanos start_tm, - double start_value, - double annual_volatility) { - Seed seed; - - return ExpProcess::make(start_value /*scale*/, - BrownianMotion::make(start_tm, - annual_volatility, - seed)); - }, - py::arg("start_tm"), py::arg("start_value"), py::arg("annual_volatility")); - - py::class_, - xo::rp>>(m, "StochasticProcess") - .def_property_readonly("t0", &StochasticProcess::t0) - .def_property_readonly("t0_value", &StochasticProcess::t0_value) - .def("exterior_sample", &StochasticProcess::exterior_sample) - .def("__repr__", &StochasticProcess::display_string); - - py::class_, - StochasticProcess, - xo::rp>>(m, "BrownianMotion"); - //.def("exterior_sample", &BrownianMotion::exterior_sample) - //.def("__repr__", &BrownianMotion::display_string); - - py::class_, - xo::rp>(m, "ExpProcess") - .def_property_readonly("exponent_process", - [](ExpProcess & self) { - return self.exponent_process().promote(); - }); - - m.def("make_tracer", - &RealizationTracer::make); - - py::class_, - xo::rp>>(m, "RealizationTracer"); - - /* e.g. - * import datetime as dt - * t0=dt.datetime.now() - * ebm=pyprocess.make_exponential_brownian_motion(t0, 0.5) - * s=pyprocess.make_realization_source(ebm, dt.timedelta(seconds=1)) - */ - m.def("make_realization_source", - [](xo::rp> p, - xo::time::nanos sample_dt) - { - auto tracer = RealizationTracer::make(p); - - return RealizationSource::make(tracer, - sample_dt); - }); - - /* note: providing __repr__ changes printing behavior, - * but uses default printer for inherited std::pair<..> - */ - py::class_(m, "UpxEvent") - .def_property_readonly("tm", &UpxEvent::tm) - .def_property_readonly("upx", &UpxEvent::upx) - .def("__repr__", &UpxEvent::display_string); - - py::class_, - reactor::ReactorSource, - xo::rp>>(m, "RealizationSource") - .def_property_readonly("current_ev", &RealizationSource::current_ev); - - py::class_> - (m, "UpxToConsole"); - - using UpxEventStore = StructEventStore; - - /* see also: KalmanFilterStateEventStore in [pyfilter/pyfilter.cpp] - */ - py::class_> - (m, "UpxEventStore") - .def_static("make", &UpxEventStore::make) - .def_property_readonly("empty", &UpxEventStore::empty) - .def_property_readonly("size", &UpxEventStore::size) - .def("last_n", &UpxEventStore::last_n, py::arg("n")) - .def("last_dt", &UpxEventStore::last_dt, py::arg("dt")); - //.def("__repr__", &UpxEventStore::display_string); - - /* temporary -- to reveal compiler errors */ - using UpxAdapterSink = PolyAdapterSink; - - py::class_>(m, "UpxAdapterSink") - .def_static("make", &UpxAdapterSink::make); - - /* prints - * std::pair - * pairs - */ - m.def("make_realization_printer", &UpxToConsole::make); - -#ifdef OBSOLETE - /* this implementation fails -- looks like .so libraries - * have separate typeinfo for std::pair - * and don't find each other. - */ - m.def("make_realization_printer2", - [] - { - return reactor::TemporaryTest::realization_printer(); - }); -#endif - - } /*pyprocess*/ - } /*namespace process*/ -} /*namespace xo*/ - -/* end pyprocess.cpp */ diff --git a/go-pyprocess/src/pyprocess/pyprocess.hpp.in b/go-pyprocess/src/pyprocess/pyprocess.hpp.in deleted file mode 100644 index 938bf0c9..00000000 --- a/go-pyprocess/src/pyprocess/pyprocess.hpp.in +++ /dev/null @@ -1,25 +0,0 @@ -/* @file pyprocess.hpp - * - * automatically generated from src/pyprocess/pyprocess.hpp.in - * see src/pyprocess/CMakeLists.txt - */ - -/* python requires module name = library name - * example: - * PYBIND11_MODULE(PYPROCESS_MODULE_NAME(), m) { ... } - */ -#define PYPROCESS_MODULE_NAME() @SELF_LIB@ - -/* example: - * py::module_::import(PYPROCESS_MODULE_NAME_STR) - */ -#define PYPROCESS_MODULE_NAME_STR "@SELF_LIB@" - -/* example: - * PYPROCESS_IMPORT_MODULE() - * replaces - * py::module_::import("pyprocess") - */ -#define PYPROCESS_IMPORT_MODULE() py::module_::import("@SELF_LIB@") - -/* end pyprocess.hpp */