Closed ilumsden closed 10 months ago
Is this PR is off the unmerged DTL PR? The reason I am asking is it is difficult to see what changes are relevant to the purpose of the PR.
Is is still work in progress PR?
All that's left is testing to make sure it works correctly. Haven't gotten to that yet.
@JaeseungYeom @hariharan-devarajan @vsoch now that the DTL PR is merged, I've fixed up this PR. It's now fully ready for review.
This PR adds a dedicated Python API to DYAD. This API will not be built/installed by Autotools. Instead, it will use setuptools/pip for its build/install process. This will allow us to host the Python API on PyPI if desired.
In terms of the interface, there are only 3 things a user may have to interact with:
dyad_open
functiondyad_open_local
functionDyad
classMost users will only use
dyad_open
. This function is a drop-in replacement for the built-inopen
function. Internally, this function is a "context manager" (see this page for more info). It creates a globalDyad
object (if not created previously) and uses theDyad
object and built-inopen
function to carry out data production/consumption. When usingdyad_open
, DYAD will always be configured with environment variables.The
dyad_open_local
function is provided to allow users to programmatically configure DYAD. When usingdyad_open_local
, users will first manually create aDyad
object and initialize it with theinit
orinit_env
methods. Then, users will invokedyad_open_local
. This function takes the same arguments as the built-inopen
plus an additional positional argument calleddyad_ctx
. This argument is the last required positional (i.e., it comes after all positionals from the built-inopen
function), and it accepts a pre-initializedDyad
object.This PR is currently work-in-progress. The API is mostly complete, but packaging (i.e., setuptools stuff) and basic testing are still required.