Skip to content

[pyos][question] How do the operators work? #429

@sneakers-the-rat

Description

@sneakers-the-rat

I am trying to piece my way through the code and I figured it would probably be easier to just ask.

Perhaps related to : #427

  • Starting from the docs, I see 6 types of operators: unary, binary, monoid, etc.
  • Those seem to be intended to be accessed from top-level namespaces like graphblas.binary
  • Each of the operator type modules has an __init__.py file that seems to be roughly duplicated between operators. They seem to be populated as a side effect of importing from ..core import operator and import .numpy
  • The .numpy module within each operator type seems to be the place where the operators are actually listed along with a mapping between graphblas and numpy
  • That seems to get packed up into an __all__ and maybe from there that is how they are called, but I am not sure how/where that lookup is actually made
  • There also seems to be some step in core.operator.utils that initializes each of the op classes?

I'm probably missing a lot but that's where I have reached so far. I think this would be a really good thing to have in the docs since it also relates to a few other questions eg. how to document each of the different operator types so someone using the package can discover them and how the code is structured generally. A decent amount of this seems to happen in side effects and by dynamically modifying the modules on/after import. It seems to work fine, which is awesome, so i believe y'all understand how this works but it seems like a lot of cognitive overhead for someone who might be interested in being a contributor.

I was thinking it might be a good think to think out loud about, and i'm happy to be a novice reader/fresh eyes/however you want to call it that can help point out where i get lost when trying to follow the thread.

Part of: pyOpenSci/software-submission#81

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionDiscussing a topic with no specific actions yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions