Skip to content
Draft
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
71 changes: 71 additions & 0 deletions .github/actions/setup-rust/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Setup Rust
description: 'Ensure Rust compiler and utilities are available, and setup caching'

inputs:
kind:
type: choice
description: "Whether to install just a default target, or all targets (e.g. for during deployments / wheel building)"
default: "runner"
options:
- runner
- full
- wasm

runs:
using: 'composite'
steps:
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: clippy, rustfmt

- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ runner.os }}

- name: Setup cargo cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
**/target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- run: rustup target add x86_64-unknown-linux-gnu
shell: bash
if: ${{ inputs.kind == 'runner' && runner.os == 'Linux' }}

- run: |
rustup target add aarch64-unknown-linux-gnu
rustup target add x86_64-unknown-linux-gnu
shell: bash
if: ${{ inputs.kind == 'full' && runner.os == 'Linux' }}

- run: rustup target add x86_64-apple-darwin
shell: bash
if: ${{ inputs.kind == 'runner' && runner.os == 'macOS' }}

- run: |
rustup target add aarch64-apple-darwin
rustup target add x86_64-apple-darwin
shell: bash
if: ${{ inputs.kind == 'full' && runner.os == 'macOS' }}

- run: rustup target add x86_64-pc-windows-msvc
shell: bash
if: ${{ inputs.kind == 'runner' && runner.os == 'Windows' }}

- run: |
rustup target add x86_64-pc-windows-msvc
rustup target add aarch64-pc-windows-msvc
shell: bash
if: ${{ inputs.kind == 'full' && runner.os == 'Windows' }}

- run: rustup target add wasm32-unknown-unknown
shell: bash
if: ${{ inputs.kind == 'wasm' }}
153 changes: 135 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,29 +211,40 @@ jobs:
# Things to exclude if not a full matrix run #
##############################################
- is-full-run: false
os: windows-2022
os: ubuntu-24.04
cibuildwheel: "cp310"

- is-full-run: false
os: ubuntu-24.04
cibuildwheel: "cp312"

- is-full-run: false
os: ubuntu-24.04
cibuildwheel: "cp313"

- is-full-run: false
os: windows-2022
cibuildwheel: "cp311"
cibuildwheel: "cp310"

- is-full-run: false
os: windows-2022
cibuildwheel: "cp312"

# avoid unnecessary use of mac resources
- is-full-run: false
os: windows-2022
cibuildwheel: "cp313"

- is-full-run: false
os: macos-14
cibuildwheel: "cp310"

- is-full-run: false
os: macos-14
cibuildwheel: "cp311"
cibuildwheel: "cp312"

- is-full-run: false
os: macos-14
cibuildwheel: "cp312"
cibuildwheel: "cp313"

runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -417,32 +428,41 @@ jobs:
##############################################
# Things to exclude if not a full matrix run #
##############################################

# Avoid extra resources for windows build
- is-full-run: false
os: windows-2022
os: ubuntu-24.04
python-version: "3.10"

- is-full-run: false
os: ubuntu-24.04
python-version: "3.12"

- is-full-run: false
os: ubuntu-24.04
python-version: "3.13"

- is-full-run: false
os: windows-2022
python-version: "3.11"
python-version: "3.10"

- is-full-run: false
os: windows-2022
python-version: "3.12"

# avoid unnecessary use of mac resources
- is-full-run: false
os: windows-2022
python-version: "3.13"

- is-full-run: false
os: macos-14
python-version: "3.10"

- is-full-run: false
os: macos-14
python-version: "3.11"
python-version: "3.12"

- is-full-run: false
os: macos-14
python-version: "3.12"
python-version: "3.13"

runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -515,6 +535,106 @@ jobs:
- name: Python Test Steps
run: make test

####################################################################################################################
#..................................................................................................................#
#..|########|..|########|..../####\....|########|.............../####\...|########\..|########\....................#
#..|########|..|##|......../##/..\##\..|########|............./##/.\##\..|##|../##/..|##|../##/....................#
#.....|##|.....|##|.........\##\..........|##|...............|##|........|##|./##/...|##|./##/.....................#
#.....|##|.....|########|.....\##\........|##|...............|##|........|##||##/....|##||##/......................#
#.....|##|.....|##|.............\##\......|##|...............|##|........|##|........|##|..........................#
#.....|##|.....|##|........\##\../##/.....|##|................\##\./##/..|##|........|##|..........................#
#.....|##|.....|########|...\####/........|##|.................\####/....|##|........|##|..........................#
#..................................................................................................................#
#...|########|...\##\..../##/...../#####\......./|\........./|\....|########\..|##|........|########|..../####\....#
#...|##|..........\##\../##/...../##/.\##\...../#|#\......./#|#\...|##|../##/..|##|........|##|......../##/..\##\..#
#...|##|...........\##\/##/...../##/...\##\...|##|\#\...../#/|##|..|##|./##/...|##|........|##|.........\##\.......#
#...|########|......|####|...../###########\..|##|.\#\.../#/.|##|..|##||##/....|##|........|########|.....\##\.....#
#...|##|.........../##/\##\....|##|.....|##|..|##|..\#\./#/..|##|..|##|........|##|........|##|.............\##\...#
#...|##|........../##/..\##\...|##|.....|##|..|##|...\#|#/...|##|..|##|........|########|..|##|........\##\./##/...#
#...|########|.../##/....\##\..|##|.....|##|..|##|....\|/....|##|..|##|........|########|..|########|...\####/.....#
#.........................................................................................................#
##############################################################
# Build / test C++ examples (05_cpp) #
##############################################################
test_cpp_examples:
needs:
- initialize
- build

strategy:
matrix:
os:
- ubuntu-24.04
- macos-14
example:
- 1_cpp_node
- 2_cpp_node_with_struct
- 3_cpp_adapter
- 4_c_api_adapter
- 5_c_api_adapter_rust
python-version:
- 3.11

runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: recursive

- name: Set up Python ${{ matrix.python-version }}
uses: ./.github/actions/setup-python
with:
version: '${{ matrix.python-version }}'
cibuildwheel: false

- name: Set up Caches
uses: ./.github/actions/setup-caches

- name: Install python dependencies
run: make requirements

- name: Download wheel
uses: actions/download-artifact@v7
with:
name: csp-dist-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python-version }}

########
# Linux
- name: Install wheel (Linux)
run: |
python -m pip install -U *manylinux*.whl
if: ${{ runner.os == 'Linux' }}

- name: Install build tools (Linux)
run: sudo apt-get install -y cmake build-essential
if: ${{ runner.os == 'Linux' }}

########
# MacOS
- name: Install wheel (OSX arm)
run: |
python -m pip install -U *arm64*.whl
if: ${{ runner.os == 'macOS' && runner.arch == 'ARM64' }}

- name: Install wheel (OSX x86)
run: |
python -m pip install -U *x86*.whl
if: ${{ runner.os == 'macOS' && runner.arch == 'X64' }}

##########
# Steps for Rust depend C API Rust Example (5_c_api_adapter_rust)
- name: Setup Rust
uses: ./.github/actions/setup-rust
if: ${{ matrix.example == '5_c_api_adapter_rust' }}

- name: Build example ${{ matrix.example }} and run tests
run: |
cd examples/05_cpp/${{ matrix.example }}
hatch-build --hooks-only -t wheel
python -m pytest -vvv .

################################################################
#..............................................................#
#..|########|..|########|..../####\....|########|..............#
Expand Down Expand Up @@ -624,15 +744,11 @@ jobs:
os:
- ubuntu-24.04
python-version:
- "3.10"
- "3.11"
package:
- sqlalchemy<2
- perspective-python<3
# - pandas<3
# uncomment the pandas pin once we move off Python 3.10 to ensure we maintain pandas 2.x compatibility
# pandas 3.0 does not support 3.10 so we currently get free coverage, but won't after 3.10 goes EOL
# Min supported version of pandas 2.2
- numpy==1.22.4
- pandas<3

runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -731,6 +847,7 @@ jobs:
- test
- test_sdist
- test_dependencies
- test_cpp_examples

if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-24.04
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ target/
lib/
lib64/
csp/bin/
csp/cmake/
csp/include/
csp/lib/
*.so
Expand Down
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ if(NOT DEFINED CSP_CMAKE_MODULE_PATH)
endif()
list(PREPEND CMAKE_MODULE_PATH "${CSP_CMAKE_MODULE_PATH}")

# Add meta-target for cmake modules and install them with the package
add_library(csp_cmake_modules INTERFACE)
target_include_directories(csp_cmake_modules INTERFACE "${CMAKE_SOURCE_DIR}/cpp/cmake/modules")
install(DIRECTORY "${CMAKE_SOURCE_DIR}/cpp/cmake/modules" DESTINATION "cmake/modules")

###################################################################################################################################################
# Build Configuration #
#######################
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ lint-cpp:

lint-docs:
python -m mdformat --check docs/wiki/ README.md examples/
python -m codespell_lib docs/wiki/ README.md examples/ --skip "*.cpp,*.h"
python -m codespell_lib docs/wiki/ README.md examples/ --skip "*.cpp,*.h,*.d,*.make,*.internal,CMakeConfigureLog.yaml"

# lint: lint-py lint-cpp ## run lints
lint: lint-py lint-docs ## run lints
Expand All @@ -62,7 +62,7 @@ fix-cpp:

fix-docs:
python -m mdformat docs/wiki/ README.md examples/
python -m codespell_lib --write docs/wiki/ README.md examples/ --skip "*.cpp,*.h"
python -m codespell_lib --write docs/wiki/ README.md examples/ --skip "*.cpp,*.h,*.d,*.make,*.internal,CMakeConfigureLog.yaml"

fix: fix-py fix-cpp fix-docs ## run autofixers

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Here is a very simple example of a small `csp` program to calculate a [bid-ask s
```python
import csp
from csp import ts
from datetime import datetime
from csp.utils.datetime import utc_now


@csp.node
Expand All @@ -44,7 +44,7 @@ def my_graph():


if __name__ == '__main__':
csp.run(my_graph, starttime=datetime.utcnow())
csp.run(my_graph, starttime=utc_now())
```

Running this, our output should look like (with some slight variations for current time):
Expand Down
Loading
Loading