Skip to content

Commit faee778

Browse files
committed
Merge pull request #142 from Point72/pavithraes/docs-restructure
Documentation Restructure
2 parents 5d7eeb7 + fb9d4e7 commit faee778

39 files changed

+3864
-3733
lines changed

docs/wiki/0.-Introduction.md

Lines changed: 0 additions & 871 deletions
This file was deleted.

docs/wiki/5.-Adapters.md

Lines changed: 0 additions & 1517 deletions
This file was deleted.

docs/wiki/6.-Dynamic-Graphs.md

Lines changed: 0 additions & 110 deletions
This file was deleted.

docs/wiki/9.-Caching.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/wiki/Home.md

Lines changed: 26 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,38 @@
1-
`csp` ("Composable Stream Processing") is a functional-like reactive
2-
language that makes time-series stream processing simple to do.  The
3-
main reactive engine is a C++ based engine which has been exposed to
4-
python ( other languages may optionally be extended in future versions
5-
). `csp` applications define a connected graph of components using a
6-
declarative language (which is essentially python).  Once a graph is
7-
constructed it can be run using the C++ engine. Graphs are composed of
8-
some number of "input" adapters, a set of connected calculation "nodes"
9-
and at the end sent off to "output" adapters. Inputs as well as the
10-
engine can be seamlessly run in simulation mode using historical input
11-
adapters or in realtime mode using realtime input adapters.
1+
<picture>
2+
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/Point72/csp/main/docs/img/csp-light.png">
3+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Point72/csp/main/docs/img/csp-dark.png">
4+
<img alt="CSP logo mark - text will be black in light color mode and white in dark color mode." width="50%"/>
5+
</picture>
126

13-
# Contents
7+
CSP (Composable Stream Processing) is a library for high-performance real-time event stream processing in Python.
148

15-
- [0. Introduction](https://github.com/Point72/csp/wiki/0.-Introduction)
16-
- [1. Generic Nodes (csp.baselib)](<https://github.com/Point72/csp/wiki/1.-Generic-Nodes-(csp.baselib)>)
17-
- [2. Math Nodes (csp.math)](<https://github.com/Point72/csp/wiki/2.-Math-Nodes-(csp.math)>)
18-
- [3. Statistics Nodes (csp.stats)](<https://github.com/Point72/csp/wiki/3.-Statistics-Nodes-(csp.stats)>)
19-
- [4. Random Time Series Generation](<https://github.com/Point72/csp/wiki/4.-Random-Time-Series-Generation-(csp.random)>)
20-
- [5. Adapters](https://github.com/Point72/csp/wiki/5.-Adapters)
21-
- [6. Dynamic Graphs](https://github.com/Point72/csp/wiki/6.-Dynamic-Graphs)
22-
- [7. csp.Struct](https://github.com/Point72/csp/wiki/7.-csp.Struct)
23-
- [8. Profiler](https://github.com/Point72/csp/wiki/8.-Profiler)
24-
- [9. Caching](https://github.com/Point72/csp/wiki/9.-Caching)
9+
## Key Features
2510

26-
# Installation
11+
- **Powerful C++ Engine:** Execute the graph using CSP's C++ Graph Processing Engine
12+
- **Simulation (i.e., offline) mode:** Test workflows on historical data and quickly move to real-time data in deployment
13+
- **Infrastructure-agnostic:** Connect to any data format or storage database, using built-in (Parquet, Kafka, etc.) or custom adapters
14+
- **Highly-customizable:** Write your own input and output adapters for any data/storage formats, and real-time adapters for specific workflows
15+
- **PyData interoperability:** Use your favorite libraries from the Scientific Python Ecosystem for numerical and statistical computations
16+
- **Functional/declarative style:** Write concise and composable code for stream processing by building graphs in Python
2717

28-
We ship binary wheels to install `csp` on MacOS and Linux via `pip`:
18+
<!-- ## Applications -->
2919

30-
```bash
31-
pip install csp
32-
```
20+
## Get Started
3321

34-
Other platforms will need to see the instructions to [build `csp` from
35-
source](https://github.com/Point72/csp/wiki/98.-Building-From-Source).
22+
- [Install CSP](Installation) and [write your first CSP program](First-Steps)
23+
- Learn more about [nodes](CSP-Node), [graphs](CSP-Graph), and [execution modes](Execution-Modes)
24+
- Learn to extend CSP with [adapters](Adapters)
3625

37-
We plan to create conda packages on conda-forge and ship binaries for Windows in
38-
the near future.
26+
<!-- - Check out the [examples](Examples) for various CSP features and use cases -->
3927

40-
# Contributing
28+
> \[!TIP\]
29+
> Find relevant docs with GitHub’s search function, use `repo:Point72/csp type:wiki <search terms>` to search the documentation Wiki Pages.
4130
42-
Contributions are welcome on this project. We distribute under the terms of the [Apache 2.0 license](https://github.com/Point72/csp/blob/main/LICENSE).
31+
## Community
4332

44-
For **bug reports** or **small feature requests**, please open an issue on our [issues page](https://github.com/Point72/csp/issues).
33+
- [Contribute](Contribute) to CSP and help improve the project
34+
- Read about future plans in the [project roadmap](Roadmap)
4535

46-
For **questions** or to discuss **larger changes or features**, please use our [discussions page](https://github.com/Point72/csp/discussions).
36+
## License
4737

48-
For **contributions**, please see our [developer documentation](https://github.com/Point72/csp/wiki/99.-Developer). We have `help wanted` and `good first issue` tags on our issues page, so these are a great place to start.
49-
50-
For **documentation updates**, make PRs that update the pages in `/docs/wiki`. The documentation is pushed to the GitHub wiki automatically through a GitHub workflow. Note that direct updates to this wiki will be overwritten.
51-
52-
# Roadmap
53-
54-
We do not have a formal roadmap, but we're happy to discuss features, improvements, new adapters, etc, in our [discussions area](https://github.com/Point72/csp/discussions). Here are some high level items we hope to accomplish in the next few months:
55-
56-
- Support `clang` compiler and full MacOS support ([#33](https://github.com/Point72/csp/issues/33) / [#132](https://github.com/Point72/csp/pull/132))
57-
- Support `msvc` compiler and full Windows support ([#109](https://github.com/Point72/csp/issues/109))
58-
- Establish a better pattern for adapters ([#165](https://github.com/Point72/csp/discussions/165))
59-
60-
## Adapters and Extensions
61-
62-
- Redis Pub/Sub Adapter with [Redis-plus-plus](https://github.com/sewenew/redis-plus-plus) ([#61](https://github.com/Point72/csp/issues/61))
63-
- C++-based websocket adapter
64-
- Client adapter in [#152](https://github.com/Point72/csp/pull/152)
65-
- C++-based HTTP/SSE adapter
66-
- Add support for other graph viewers, including interactive / standalone / Jupyter
67-
68-
## Other Open Source Projects
69-
70-
- `csp-gateway`: Application development framework, built with [FastAPI](https://fastapi.tiangolo.com) and [Perspective](https://github.com/finos/perspective). This is a library we have built internally at Point72 on top of `csp` that we hope to open source later in 2024. It allows for easier construction of modular `csp` applications, along with a pluggable REST/WebSocket API and interactive UI.
38+
CSP is licensed under the Apache 2.0 license. See the [LICENSE](https://github.com/Point72/csp/blob/main/LICENSE) file for details.

docs/wiki/_Footer.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_This wiki is autogenerated. To made updates, open a PR against the original source file in [`docs/wiki`](https://github.com/Point72/csp/tree/main/docs/wiki)._

docs/wiki/_Sidebar.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<!--
2+
This sidebar is displayed on the GitHub Wiki section instead of the default sidebar.
3+
Notes for editors:
4+
- Ensure links don't have the file extensions (i.e., `.md`)
5+
- Do not use colons (':') in page titles, they don't render properly as links in the sidebar
6+
- Use only the filenames in this page (without the filepath and file extension)
7+
-->
8+
9+
**[Home](Home)**
10+
11+
**Get Started (Tutorials)**
12+
13+
- [Installation](Installation)
14+
- [First steps](First-Steps)
15+
16+
<!-- Add more pages when ready -->
17+
18+
**Concepts**
19+
20+
- [CSP Node](CSP-Node)
21+
- [CSP Graph](CSP-Graph)
22+
- [Historical Buffers](Historical-Buffers)
23+
- [Execution Modes](Execution-Modes)
24+
- [Adapters](Adapters)
25+
26+
**How-to guides**
27+
28+
- [Use Statistical Nodes](Use-Statistical-Nodes)
29+
- Use Adapters (coming soon)
30+
- [Add Cycles in Graphs](Add-Cycles-in-Graphs)
31+
- [Create Dynamic Baskets](Create-Dynamic-Baskets)
32+
- Write Adapters:
33+
- [Write Historical Input Adapters](Write-Historical-Input-Adapters)
34+
- [Write Realtime Input Adapters](Write-Realtime-Input-Adapters)
35+
- [Write Output Adapters](Write-Output-Adapters)
36+
- [Profile CSP Code](Profile-CSP-Code)
37+
38+
**References**
39+
40+
- API Reference
41+
- [Base Nodes API](Base-Nodes-API)
42+
- [Base Adapters API](Base-Adapters-API)
43+
- [Math and Logic Nodes API](Math-and-Logic-Nodes-API)
44+
- [Statistical Nodes API](Statistical-Nodes-API)
45+
- [Functional Methods API](Functional-Methods-API)
46+
- [Adapters (Kafka, Parquet, DBReader) API](Input-Output-Adapters-API)
47+
- [Random Time Series Generators API](Random-Time-Series-Generators-API)
48+
- [`csp.Struct` API](csp.Struct-API)
49+
- [`csp.dynamic` API](csp.dynamic-API)
50+
- [`csp.profiler` API](csp.profiler-API)
51+
- [Examples](Examples)
52+
- [Glossary of Terms](Glossary)
53+
54+
**Developer Guide**
55+
56+
- [Contributing](Contribute)
57+
- [Development Setup](Local-Development-Setup)
58+
- [Build CSP from Source](Build-CSP-from-Source)
59+
- [GitHub Conventions (for maintainers)](GitHub-Conventions)
60+
- [Release Process (for maintainers)](Release-Process)
61+
- [Roadmap](Roadmap)
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
`csp.baselib` defines some generally useful adapters, which are also imported directly into the CSP namespace when importing CSP.
2+
3+
These are all graph-time constructs.
4+
5+
## Table of Contents
6+
7+
- [Table of Contents](#table-of-contents)
8+
- [`csp.timer`](#csptimer)
9+
- [`csp.const`](#cspconst)
10+
- [`csp.curve`](#cspcurve)
11+
- [`csp.add_graph_output`](#cspadd_graph_output)
12+
- [`csp.feedback`](#cspfeedback)
13+
14+
## `csp.timer`
15+
16+
```python
17+
csp.timer(
18+
interval: timedelta,
19+
value: '~T' = True,
20+
allow_deviation: bool = False
21+
)
22+
```
23+
24+
This will create a repeating timer edge that will tick on the given `timedelta` with the given value (value defaults to `True`, returning a `ts[bool]`)
25+
26+
Args:
27+
28+
- **`interval`**: how often to tick value
29+
- **`value`**: the actual value that will tick every interval (defaults to the value `True`)
30+
- **`allow_deviation`**: When running in realtime the engine will ensure timers execute exactly when they requested on their intervals.
31+
If your engine begins to lag, timers will still execute at the expected time "in the past" as the engine catches up
32+
(imagine having a `csp.timer` fire every 1/2 second but the engine becomes delayed for 1 second.
33+
By default the half seconds will still execute until time catches up to wallclock).
34+
When `allow_deviation` is `True`, and the engine is in realtime mode, subsequent timers will always be scheduled from the current wallclock + interval,
35+
so they won't end up lagging behind at the expensive of the timer skewing.
36+
37+
## `csp.const`
38+
39+
```python
40+
csp.const(
41+
value: '~T',
42+
delay: timedelta = timedelta()
43+
)
44+
```
45+
46+
This will create an edge that ticks one time with the value provided.
47+
By default this will tick at the start of the engine, delta can be provided to delay the tick
48+
49+
## `csp.curve`
50+
51+
```python
52+
csp.curve(
53+
typ: 'T',
54+
data: typing.Union[list, tuple]
55+
)
56+
```
57+
58+
This allows you to convert a list of non-CSP data into a ticking edge in CSP
59+
60+
Args:
61+
62+
- **`typ`**: is the type of the value of the data of this edge
63+
- **`data`**: is either a list of tuples of `(datetime, value)`, or a tuple of two equal-length numpy ndarrays, the first with datetimes and the second with values.
64+
In either case, that will tick on the returned edge into the engine, and the data must be in time order.
65+
Note that for the list of tuples case, you can also provide tuples of (timedelta, value) where timedelta will be the offset from the engine's start time.
66+
67+
## `csp.add_graph_output`
68+
69+
```python
70+
csp.add_graph_output(
71+
key: object,
72+
input: ts['T'],
73+
tick_count: int = -1,
74+
tick_history: timedelta = timedelta()
75+
)
76+
```
77+
78+
This allows you to connect an edge as a "graph output".
79+
All edges added as outputs will be returned to the caller from `csp.run` as a dictionary of `key: [(datetime, value)]`
80+
(list of datetime, values that ticked on the edge) or if `csp.run` is passed `output_numpy=True`, as a dictionary of
81+
`key: (array, array)` (tuple of two numpy arrays, one with datetimes and one with values).
82+
See [Collecting Graph Outputs](https://github.com/Point72/csp/wiki/0.-Introduction#collecting-graph-outputs)
83+
84+
Args:
85+
86+
- **`key`**: key to return the results as from `csp.run`
87+
- **`input`**: edge to connect
88+
- **`tick_count`**: number of ticks to keep in the buffer (defaults to -1 - all ticks)
89+
- **`tick_history`**: amount of ticks to keep by time window (defaults to keeping all history)
90+
91+
## `csp.feedback`
92+
93+
```python
94+
csp.feedback(typ)
95+
```
96+
97+
`csp.feedback` is a construct that can be used to create artificial loops in the graph.
98+
Use feedbacks in order to delay bind an input to a node in order to be able to create a loop
99+
(think of writing a simulated exchange that takes orders in and needs to feed responses back to the originating node).
100+
101+
`csp.feedback` itself is not an edge, its a construct that allows you to access the delayed edge / bind a delayed input.
102+
103+
Args:
104+
105+
- **`typ`**: type of the edge's data to be bound
106+
107+
Methods:
108+
109+
- **`out()`**: call this method on the feedback object to get the edge which can be wired as an input
110+
- **`bind(x: ts[object])`**: call this to bind an edge to the feedback

0 commit comments

Comments
 (0)