pymc-devs / pymc-devs/pytensor
Make props related functionality a part of the Op baseclass
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 644
- Forks
- 208
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 16
Description
Description
This is in MetaType, but AFAICT only ops ever have props
Generating them dynamically like this means linters / mypy don't believe in op._props() or op._props_dict(). I don't know why this has to be implemented as methods in the MetaClass instead of just in the Op baseclass. Would be great if someone gave a try at it. It also means we could probably get rid of the whole MetaType class, since the only other thing is a string convenience, which definitely need not be defined there.
May also be worth investigating if we can use frozen dataclasses for Ops and automate the props logic (see aesara discussion, but that needs not be done together with addressing the main issue here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with pytensor/graph/utils.py at the linked MetaType implementation and inspect how Op classes use props, _props(), and _props_dict(). Determine whether the props behavior and string convenience can move into Op without changing existing behavior. Done means the refactor is covered by the relevant existing checks and static typing recognizes the props methods; no pull request or test path is named in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100