inducer / pymbolic

A simple package to do symbolic math (focus on code gen and DSLs)
http://mathema.tician.de/software/pymbolic
Other
106 stars 25 forks source link

Matchpy interop #80

Closed kaushikcfd closed 2 years ago

inducer commented 2 years ago

@kaushikcfd Did you mean for this to be ready for review, or not yet?

kaushikcfd commented 2 years ago

It is ready, just noticed the documentation CI dislikes the patch. Will try to quickly fix it.

kaushikcfd commented 2 years ago

If I don't do from __future__ import annotations on top of pymbolic/interop/matchpy/__init__.py, while building docs I get:

WARNING: Failed to get a function signature for pymbolic.interop.matchpy.match: __str__ returned non-string (type property)
WARNING: Failed to get a function signature for pymbolic.interop.matchpy.match_anywhere: __str__ returned non-string (type property)
WARNING: Failed to get a function signature for pymbolic.interop.matchpy.replace_all: __str__ returned non-string (type property)
WARNING: Failed to get a function signature for pymbolic.interop.matchpy.make_replacement_rule: __str__ returned non-string (type property)

And, if I do the import py<3.7 is unhappy. @inducer, any suggestions? (Thanks!)

kaushikcfd commented 2 years ago

Btw, Py3.6 has reached EOL, do we want to keep testing against it?

alexfikl commented 2 years ago

If I don't do from __future__ import annotations on top of pymbolic/interop/matchpy/__init__.py, while building docs I get:

@kaushikcfd Does this generate all the docs for you? I just tried it locally and sphinx just ignores the whole thing (no idea why though).

kaushikcfd commented 2 years ago

@alexfikl: Thanks! The only reason it was building was the __doc__ on the module was empty in the latter case. I.e. the error persists and is independent of the Python version.

kaushikcfd commented 2 years ago

The error's because of stringifying the class PymbolicOp, because of some metaclass voodoo in matchpy.

>>> str(m.PymbolicOp)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __str__ returned non-string (type property)

__str__ returned non-string (type property)

making this a draft, until I fix it.

kaushikcfd commented 2 years ago

This is ready now, sorry for the premature review request.

inducer commented 2 years ago

LGTM, thanks!