You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PLY no longer writes table files or cached data, like the _lextab files we use. The API has changed significantly and is not obviously / easily adaptable to our current usage. Our version of PLY is 2 years old and works, but we might not be able to update, including for bug fixes, given the incompatibility.
Perhaps this should be an item for future dev-cons.
In #15028, it seems at least possible that our relatively old PLY is causing problems. Maybe it is time to see whether generating the tables on the fly causes much of a problem (presumably, mostly import time for astropy.units).
Having had a quick look, I don't think upgrading to a new PLY may be that hard, but there is a general problem with it, which is that the definitions are all done in docstrings. So, it necessarily doesn't work with -OO, which strips those. In that respect, the lexer/parser files actually were a good idea, since those do always work.
The ply project has now been archived and the author suggest using alternatives: dabeaz/ply@9d7c400
We've tried to update to the latest ply commit in Fedora, as the latest release is way too old, however astropy fails to build with: TypeError: yacc() got an unexpected keyword argument 'tabmodule'. Did you mean 'module'?
Activity
mhvk commentedon Jul 10, 2023
In #15028, it seems at least possible that our relatively old PLY is causing problems. Maybe it is time to see whether generating the tables on the fly causes much of a problem (presumably, mostly import time for
astropy.units).eerovaher commentedon Jul 10, 2023
This issue is not an exact duplicate of #7177, but it is similar enough that it might be a good idea to have all the discussion there.
mhvk commentedon May 26, 2025
Another related issue, #15069.
Having had a quick look, I don't think upgrading to a new PLY may be that hard, but there is a general problem with it, which is that the definitions are all done in docstrings. So, it necessarily doesn't work with
-OO, which strips those. In that respect, the lexer/parser files actually were a good idea, since those do always work.It might be worth investigating other parsing solutions though it seems many are rather slow -- https://github.com/goodmami/python-parsing-benchmarks -- so we'd definitely need to have proper benchmarking. And perhaps should look at what other unit packages use (and compare speeds).
p.s. Not sure how to rank this in priority, since so far the problems have all been for relatively obscure situations.
nstarman commentedon May 26, 2025
Wow stdlib is comparatively fast
stratakis commentedon Jan 12, 2026
The ply project has now been archived and the author suggest using alternatives: dabeaz/ply@9d7c400
We've tried to update to the latest ply commit in Fedora, as the latest release is way too old, however astropy fails to build with:
TypeError: yacc() got an unexpected keyword argument 'tabmodule'. Did you mean 'module'?