Skip to content

Difficulties upgrading PLY #13399

Open
Open

Description

@nstarman

Description

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.

Additional context

See https://github.com/dabeaz/ply/blob/master/CHANGES.

PLY files are also not compatible with modern python syntax preferences ( #13396 )

Activity

  1. mhvk commented on Jul 10, 2023

    @mhvk
    Contributor

    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).

  2. eerovaher commented on Jul 10, 2023

    @eerovaher
    Member

    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.

  3. mhvk commented on May 26, 2025

    @mhvk
    Contributor

    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.

  4. nstarman commented on May 26, 2025

    @nstarman
    MemberAuthor

    Wow stdlib is comparatively fast

  5. stratakis commented on Jan 12, 2026

    @stratakis
    Contributor

    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'?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions