Skip to content

Commit 4d2f9e6

Browse files
authored
IT-1338: Add docs for v2 API (#55)
1 parent becec97 commit 4d2f9e6

34 files changed

+781
-680
lines changed

.github/workflows/documentation.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: documentation
2+
3+
on: [push, pull_request, workflow_dispatch]
4+
5+
permissions:
6+
contents: write
7+
8+
jobs:
9+
docs:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-python@v5
14+
- name: Install dependencies
15+
run: |
16+
pip install sphinx sphinx_rtd_theme myst_parser isx
17+
- name: Sphinx build
18+
run: |
19+
sphinx-build docs docs/build
20+
- name: Deploy to GitHub Pages
21+
uses: peaceiris/actions-gh-pages@v3
22+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
23+
with:
24+
publish_branch: gh-pages
25+
github_token: ${{ secrets.GITHUB_TOKEN }}
26+
publish_dir: docs/build/
27+
force_orphan: true

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
cmake_minimum_required(VERSION 3.5)
22

3+
project(isx)
4+
35
set(ISX_CMAKE_TOOLS_DIR ${CMAKE_CURRENT_LIST_DIR}/isxcore/tools/cmake)
46
include(${ISX_CMAKE_TOOLS_DIR}/configure.cmake)
57
include(${ISX_CMAKE_TOOLS_DIR}/core.cmake)

Makefile

Lines changed: 59 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
.PHONY: build test
1+
SHELL:=/bin/bash
2+
.PHONY: check_os build rebuild test docs
23

4+
# Build paths
35
BUILD_DIR_ROOT=build
46
BUILD_DIR_MODULES=modules
57
BUILD_TYPE=Release
@@ -8,19 +10,26 @@ BUILD_DIR_BIN=bin
810
BUILD_PATH=$(BUILD_DIR_ROOT)/$(BUILD_TYPE)/$(BUILD_DIR_CMAKE)
911
BUILD_PATH_BIN=$(BUILD_DIR_ROOT)/$(BUILD_TYPE)/$(BUILD_DIR_BIN)
1012

13+
# Test paths
1114
API_TEST_RESULTS_PATH=$(PWD)/apiTestResults.xml
1215
PYTHON_TEST_DIR=$(BUILD_DIR_ROOT)/$(BUILD_TYPE)/bin/isx
1316

17+
# Check for test data dir
1418
ifndef TEST_DATA_DIR
1519
TEST_DATA_DIR=test_data
1620
endif
1721

22+
# Check for third party dir
1823
ifndef THIRD_PARTY_DIR
1924
THIRD_PARTY_DIR=third_party
2025
endif
2126

22-
PYTHON_VERSION=$(shell python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
27+
# Extract python version
28+
ifndef PYTHON_VERSION
29+
PYTHON_VERSION=$(shell python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
30+
endif
2331

32+
# Detect OS
2433
ifeq ($(OS), Windows_NT)
2534
DETECTED_OS = windows
2635
else
@@ -30,6 +39,7 @@ else
3039
else ifeq ($(UNAME_S), Darwin)
3140
DETECTED_OS = mac
3241

42+
# Set the macOS deployment version based on python version
3343
ifeq ($(PYTHON_VERSION), 3.9)
3444
_MACOSX_DEPLOYMENT_TARGET=10.11
3545
else ifeq ($(PYTHON_VERSION), 3.10)
@@ -42,15 +52,17 @@ else
4252
endif
4353
endif
4454

55+
# Build flags for isxcore
4556
VERSION_MAJOR=2
4657
VERSION_MINOR=0
47-
VERSION_PATCH=0
58+
VERSION_PATCH=1
4859
VERSION_BUILD=0
4960
IS_BETA=1
5061
WITH_CUDA=0
5162
ASYNC_API=1
5263
WITH_ALGOS=0
5364

65+
# Construct cmake options
5466
CMAKE_OPTIONS=\
5567
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE)\
5668
-DISX_VERSION_MAJOR=${VERSION_MAJOR}\
@@ -62,6 +74,7 @@ CMAKE_OPTIONS=\
6274
-DISX_ASYNC_API=${ASYNC_API} \
6375
-DISX_WITH_ALGOS=${WITH_ALGOS} \
6476

77+
# Define cmake generator based on OS
6578
ifeq ($(DETECTED_OS), windows)
6679
CMAKE_GENERATOR = Visual Studio 14 2015 Win64
6780
else ifeq ($(DETECTED_OS), linux)
@@ -71,6 +84,22 @@ else ifeq ($(DETECTED_OS), mac)
7184
CMAKE_GENERATOR = Xcode
7285
endif
7386

87+
# Virtual environment vars
88+
ifndef VENV_NAME
89+
VENV_NAME=pyisx
90+
endif
91+
92+
# Define cmake generator based on OS
93+
ifeq ($(DETECTED_OS), windows)
94+
VENV_ACTIVATE = source $(shell conda info --base)/Scripts/activate
95+
else
96+
VENV_ACTIVATE = source $(shell conda info --base)/bin/activate
97+
endif
98+
99+
ifndef BUILD_API
100+
BUILD_API=0
101+
endif
102+
74103
check_os:
75104
@echo "Verifying detected OS"
76105
ifndef DETECTED_OS
@@ -84,6 +113,19 @@ endif
84113

85114
clean:
86115
@rm -rf build
116+
@rm -rf docs/build
117+
118+
ifeq ($(DETECTED_OS), mac)
119+
env:
120+
CONDA_SUBDIR=osx-64 conda create -y -n $(VENV_NAME) python=$(PYTHON_VERSION) && \
121+
$(VENV_ACTIVATE) $(VENV_NAME) && \
122+
conda config --env --set subdir osx-64 && \
123+
python -m pip install build
124+
else
125+
env:
126+
conda create -y -n $(VENV_NAME) python=$(PYTHON_VERSION)
127+
python -m pip install build
128+
endif
87129

88130
ifeq ($(DETECTED_OS), mac)
89131
build: export MACOSX_DEPLOYMENT_TARGET=${_MACOSX_DEPLOYMENT_TARGET}
@@ -94,20 +136,31 @@ build: check_os
94136
THIRD_PARTY_DIR=$(THIRD_PARTY_DIR) cmake $(CMAKE_OPTIONS) -G "$(CMAKE_GENERATOR)" ../../../
95137
ifeq ($(DETECTED_OS), windows)
96138
cd $(BUILD_PATH) && \
97-
"/c/Program Files (x86)/MSBuild/14.0/Bin/MSBuild.exe" Project.sln //p:Configuration=$(BUILD_TYPE) //maxcpucount:8
139+
"/c/Program Files (x86)/MSBuild/14.0/Bin/MSBuild.exe" isx.sln //p:Configuration=$(BUILD_TYPE) //maxcpucount:8
98140
else ifeq ($(DETECTED_OS), linux)
99141
cd $(BUILD_PATH) && \
100142
make -j2
101143
else ifeq ($(DETECTED_OS), mac)
102144
cd $(BUILD_PATH) && \
103-
xcodebuild -alltargets -configuration $(BUILD_TYPE) -project Project.xcodeproj CODE_SIGN_IDENTITY=""
145+
xcodebuild -alltargets -configuration $(BUILD_TYPE) -project isx.xcodeproj CODE_SIGN_IDENTITY=""
104146
endif
105147
cd $(BUILD_PATH_BIN) && \
148+
$(VENV_ACTIVATE) $(VENV_NAME) && \
106149
python -m build
107150

108151
rebuild: clean build
109152

110153
test: build
111-
cd $(BUILD_PATH_BIN)/dist && pip install --force-reinstall isx-*.whl
154+
$(VENV_ACTIVATE) $(VENV_NAME) && \
155+
pip install --force-reinstall '$(shell ls $(BUILD_PATH_BIN)/dist/isx-*.whl)[test]' && \
112156
cd build/Release && \
113157
ISX_TEST_DATA_PATH=$(TEST_DATA_DIR) python -m pytest --disable-warnings -v -s --junit-xml=$(API_TEST_RESULTS_PATH) test $(TEST_ARGS)
158+
159+
ifeq ($(BUILD_API), 1)
160+
docs: build
161+
$(VENV_ACTIVATE) $(VENV_NAME) && \
162+
pip install --force-reinstall '$(shell ls $(BUILD_PATH_BIN)/dist/isx-*.whl)[docs]'
163+
endif
164+
docs:
165+
$(VENV_ACTIVATE) $(VENV_NAME) && \
166+
sphinx-build docs docs/build

README.md

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# pyisx
22

3-
`pyisx` is a python package for interacting with Inscopix data. This package encapsulates the following I/O functionality:
3+
The `pyisx` project is a python binding for [isxcore](https://github.com/inscopix/isxcore), a C++ API for interacting with Inscopix data.
4+
The python package for this binding, named `isx`, is available on [pypi](https://pypi.org/project/isx/) for download.
5+
This package encapsulates the following I/O functionality:
46

5-
* Reading Inscopix files (`.isxd`, `.isxc`, `.isxb`, `.gpio`, `.imu`)
7+
* Reading Inscopix files (`.isxd`, `.isxb`, `.gpio`, `.imu`)
68
* Writing Inscopix files (`.isxd`)
7-
* Exporting Inscopix files to third-party formats (`.mp4`, `.tiff`, `.csv`, `.hdf5`)
9+
* Exporting Inscopix files to third-party formats (`.mp4`, `.tiff`, `.csv`)
810

911
## Install
1012

@@ -14,30 +16,40 @@ Pre-built binaries of this API can be installed from [PyPi](https://pypi.org/pro
1416
pip install isx
1517
```
1618

19+
> **Note:** For Apple Silicon (i.e., macOS arm64 architecture), the package is currently not natively supported. However, it's possible to use anaconda to configure an x86 environment and use the project.
20+
21+
```
22+
CONDA_SUBDIR=osx-64 conda create -n pyisx python=3.12
23+
conda activate pyisx
24+
conda config --env --set subdir osx-64
25+
pip install isx
26+
```
27+
28+
1729
## Supported Platforms
1830

19-
This library has been built and tested on the following operating systems:
31+
This library has been built and tested on the following operating systems, for python versions `3.9 - 3.12`.
2032

2133
| OS | Version | Architecture |
2234
| --------- | ------- | ----- |
2335
| macOS | 13 | x86_64 |
2436
| Ubuntu (Linux) | 20.04 | x86_64 |
2537
| Windows | 11 | amd64 |
2638

27-
Each system has been built and tested on python versions 3.9 - 3.12.
28-
29-
> **Note:** For Apple Silicon (arm64 architectures), the package is currently not natively supported. However, it's possible to use anaconda to configure an x86 environment and use the project.
30-
31-
```
32-
CONDA_SUBDIR=osx-64 conda create -n pyisx python=3.12
33-
conda activate pyisx
34-
conda config --env --set subdir osx-64
35-
```
3639

3740
## Development Guide
3841

3942
This guide documents how to build the python package wheel locally.
4043

44+
1. Clone the repo
45+
46+
Setup the repo and initialize its submodule:
47+
48+
```bash
49+
git clone [email protected]:inscopix/pyisx.git
50+
git submodule update --init
51+
```
52+
4153
1. Setup `isxcore`
4254
Follow the setup instructions for the C++ [isxcore](https://github.com/inscopix/isxcore) repo.
4355

@@ -53,7 +65,7 @@ conda activate pyisx
5365

5466
> **Note**: On macOS systems with Apple Silicon, the conda environment is configured differently, since `isxcore` is currently only built for x86 architectures.
5567
56-
```
68+
```bash
5769
CONDA_SUBDIR=osx-64 conda create -n pyisx python=3.12
5870
conda activate pyisx
5971
conda config --env --set subdir osx-64
@@ -63,24 +75,24 @@ conda config --env --set subdir osx-64
6375

6476
Inside the virtual environment install the following dependencies:
6577

66-
```
78+
```bash
6779
conda install -y build pytest
6880
```
6981

7082
> **Note**: For python 3.12 the `build` package must be installed used `pip` instead.
7183
7284
4. Build the package
7385

74-
```
86+
```bash
7587
make build THIRD_PARTY_DIR=/path/to/third/party/dir
7688
```
7789

7890
5. Run the unit tests
7991

80-
```
92+
```bash
8193
make test THIRD_PARTY_DIR=/path/to/third/party/dir TEST_DATA_DIR=/path/to/test/data/dir
8294
```
8395

8496
# Support
8597

86-
For any questions about this package, please contact [email protected].com.
98+
For any questions or bug reports, please open an issue in our [issue tracker](https://github.com/inscopix/pyisx/issues).

0 commit comments

Comments
 (0)