4 Summary: A Python Parser
5 Home-page: https://github.com/davidhalter/parso
7 Author-email: davidhalter88@gmail.com
8 Maintainer: David Halter
9 Maintainer-email: davidhalter88@gmail.com
11 Keywords: python parser parsing
13 Classifier: Development Status :: 4 - Beta
14 Classifier: Environment :: Plugins
15 Classifier: Intended Audience :: Developers
16 Classifier: License :: OSI Approved :: MIT License
17 Classifier: Operating System :: OS Independent
18 Classifier: Programming Language :: Python :: 3
19 Classifier: Programming Language :: Python :: 3.6
20 Classifier: Programming Language :: Python :: 3.7
21 Classifier: Programming Language :: Python :: 3.8
22 Classifier: Programming Language :: Python :: 3.9
23 Classifier: Topic :: Software Development :: Libraries :: Python Modules
24 Classifier: Topic :: Text Editors :: Integrated Development Environments (IDE)
25 Classifier: Topic :: Utilities
26 Classifier: Typing :: Typed
27 Requires-Python: >=3.6
29 Requires-Dist: flake8 (==3.8.3) ; extra == 'qa'
30 Requires-Dist: mypy (==0.782) ; extra == 'qa'
31 Provides-Extra: testing
32 Requires-Dist: docopt ; extra == 'testing'
33 Requires-Dist: pytest (<6.0.0) ; extra == 'testing'
35 ###################################################################
36 parso - A Python Parser
37 ###################################################################
40 .. image:: https://github.com/davidhalter/parso/workflows/Build/badge.svg?branch=master
41 :target: https://github.com/davidhalter/parso/actions
42 :alt: GitHub Actions build status
44 .. image:: https://coveralls.io/repos/github/davidhalter/parso/badge.svg?branch=master
45 :target: https://coveralls.io/github/davidhalter/parso?branch=master
48 .. image:: https://pepy.tech/badge/parso
49 :target: https://pepy.tech/project/parso
52 .. image:: https://raw.githubusercontent.com/davidhalter/parso/master/docs/_static/logo_characters.png
54 Parso is a Python parser that supports error recovery and round-trip parsing
55 for different Python versions (in multiple Python versions). Parso is also able
56 to list multiple syntax errors in your python file.
58 Parso has been battle-tested by jedi_. It was pulled out of jedi to be useful
59 for other projects as well.
61 Parso consists of a small API to parse Python and analyse the syntax tree.
65 .. code-block:: python
68 >>> module = parso.parse('hello + 1', version="3.9")
69 >>> expr = module.children[0]
71 PythonNode(arith_expr, [<Name: hello@1,0>, <Operator: +>, <Number: 1>])
72 >>> print(expr.get_code())
74 >>> name = expr.children[0]
82 To list multiple issues:
84 .. code-block:: python
86 >>> grammar = parso.load_grammar()
87 >>> module = grammar.parse('foo +\nbar\ncontinue')
88 >>> error1, error2 = grammar.iter_errors(module)
90 'SyntaxError: invalid syntax'
92 "SyntaxError: 'continue' not properly in loop"
97 - `Testing <https://parso.readthedocs.io/en/latest/docs/development.html#testing>`_
98 - `PyPI <https://pypi.python.org/pypi/parso>`_
99 - `Docs <https://parso.readthedocs.org/en/latest/>`_
100 - Uses `semantic versioning <https://semver.org/>`_
110 - There will be better support for refactoring and comments. Stay tuned.
111 - There's a WIP PEP8 validator. It's however not in a good shape, yet.
116 - `async`/`await` are already used as keywords in Python3.6.
117 - `from __future__ import print_function` is not ignored.
123 - Guido van Rossum (@gvanrossum) for creating the parser generator pgen2
124 (originally used in lib2to3).
125 - `Salome Schneider <https://www.crepes-schnaegg.ch/cr%C3%AApes-schn%C3%A4gg/kunst-f%C3%BCrs-cr%C3%AApes-mobil/>`_
126 for the extremely awesome parso logo.
129 .. _jedi: https://github.com/davidhalter/jedi
143 - Add basic support for Python 3.11 and 3.12
148 - Various small bugfixes
153 - Various small bugfixes
158 - Dropped Support for Python 2.7, 3.4, 3.5
159 - It's possible to use ``pathlib.Path`` objects now in the API
160 - The stubs are gone, we are now using annotations
161 - ``namedexpr_test`` nodes are now a proper class called ``NamedExpr``
162 - A lot of smaller refactorings
167 - Fixed a couple of smaller bugs (mostly syntax error detection in
168 ``Grammar.iter_errors``)
170 This is going to be the last release that supports Python 2.7, 3.4 and 3.5.
175 - Fix a lot of annoying bugs in the diff parser. The fuzzer did not find
176 issues anymore even after running it for more than 24 hours (500k tests).
177 - Small grammar change: suites can now contain newlines even after a newline.
178 This should really not matter if you don't use error recovery. It allows for
179 nicer error recovery.
185 - Add Grammar.refactor (might still be subject to change until 0.7.0)
190 - Add ``parso.normalizer.Issue.end_pos`` to make it possible to know where an
196 - Dropped Python 2.6/Python 3.3 support
197 - del_stmt names are now considered as a definition
198 (for ``name.is_definition()``)
204 - Add include_setitem to get_definition/is_definition and get_defined_names (#66)
205 - Fix named expression error listing (#89, #90)
206 - Fix some f-string tokenizer issues (#93)
211 - Fix: Some unicode identifiers were not correctly tokenized
212 - Fix: Line continuations in f-strings are now working
217 - **Breaking Change** comp_for is now called sync_comp_for for all Python
218 versions to be compatible with the Python 3.8 Grammar
219 - Added .pyi stubs for a lot of the parso API
220 - Small FileIO changes
226 - FileIO support, it's now possible to use abstract file IO, support is alpha
231 - Fix an f-string tokenizer error
236 - Fix async errors in the diff parser
237 - A fix in iter_errors
238 - This is a very small bugfix release
243 - 20+ bugfixes in the diff parser and 3 in the tokenizer
244 - A fuzzer for the diff parser, to give confidence that the diff parser is in a
246 - Some bugfixes for f-string
251 - Bugfixes in the diff parser and keyword-only arguments
256 - Rewrote the pgen2 parser generator.
261 - A bugfix for the diff parser.
262 - Grammar files can now be loaded from a specific path.
267 - f-strings are now parsed as a part of the normal Python grammar. This makes
268 it way easier to deal with them.
273 - Fixed a few bugs in the caching layer
274 - Added support for Python 3.7
279 - Pulling the library out of Jedi. Some APIs will definitely change.