Point72 / Point72/csp

Ensure that adapters can be constructed in a simpler manner than they are currently

Open
#272 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

adapter: general type: enhancement
Dominant language
Python
Stars
441
Forks
90
Avg merge
1d 12m
Merged PRs (30d)
5

Description

1. Adapters + Impls where the Impl is tiny:

https://github.com/Point72/csp/blob/234f94cfd9924ca479485b97d56f7cc91141f3d2/examples/04_writing_adapters/e2_pullinput.py#L19

MyPullAdapter = py_pull_adapter_def("MyPullAdapter", MyPullAdapterImpl, ts[int], interval=timedelta, num_ticks=int)

One would expect we could do this via type annotations in some form or another, or something like pydantic since the py_pull_adapter_def mostly serves to wrap the impl inputs.

2. Minimal Managers / other places where excess classes are needed

https://github.com/Point72/csp/blob/234f94cfd9924ca479485b97d56f7cc91141f3d2/examples/04_writing_adapters/e3_adaptermanager_pullinput.py
https://github.com/Point72/csp/blob/main/examples/04_writing_adapters/e5_adaptermanager_pushinput.py

These examples requires 4+ classes (!!):

  • MyAdapterManager
  • MyAdapterManagerImpl
  • MyManagedSimAdapterImpl
  • MyManagedSimAdapter

This is pretty bad UX/design.

3. Automatic py_push_adapter_def / py_output_adapter_def, etc

Similar to the above, we often create these "anonymous" objects for binding the adapter-specific code to the engine wrapping necessary, I think we can consolidate this in some form
https://github.com/Point72/csp/blob/234f94cfd9924ca479485b97d56f7cc91141f3d2/csp/adapters/kafka.py#L187

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the adapter patterns in examples/04_writing_adapters/e2_pullinput.py, e3_adaptermanager_pullinput.py, and e5_adaptermanager_pushinput.py, then inspect csp/adapters/kafka.py for the anonymous wrapper pattern. Done means proposing and implementing a coherent simpler construction approach that covers pull adapters, managed adapters, and push/output adapter definitions while reducing unnecessary classes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
developer-experience, stream-processing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.