0

I am searching for a Python lib to parse Python 3 code to some abstract representation. I don't need to modify code. I am fine with analyzation only. AST representation should be ok. What packages are potential candidates? What do you think about it (pros/cons)?

Requirements:

  • abstraction of Python source code as AST (abstract syntax tree) or FST (full syntax tree)
  • utilities to ease working with representation (pretty-printing, searching in representation, etc.)

Candidates:

  • ast
  • astroid
  • baron
  • parso
  • etc.
  • 1
    What do you need that is not provided by the built-in ast module? – BrenBarn Nov 11 '18 at 4:27
  • That's exactly this question is about. :) I am interested in things to look for when comparing parser libs. – thinwybk Nov 11 '18 at 8:25
  • 1
    I don't think that is on topic here. This site is for asking about software that meets certain criteria, not asking what criteria you should ask about. – BrenBarn Nov 11 '18 at 20:54
  • 1
    Ah ok. DId not know that. I adjust the question accordingly. – thinwybk Nov 11 '18 at 20:55
  • 1
    Your question is still not that great because you still didn't specify what your requirements are. Again, the builtin ast module is the obvious choice. If you don't want to use that you need to explain in your question what specific features you need. – BrenBarn Nov 11 '18 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.