{"id":19378170,"url":"https://github.com/almarklein/commonast","last_synced_at":"2025-04-23T19:31:49.219Z","repository":{"id":72713726,"uuid":"45035920","full_name":"almarklein/commonast","owner":"almarklein","description":"A common AST description for Python","archived":false,"fork":false,"pushed_at":"2019-12-16T16:13:30.000Z","size":30,"stargazers_count":6,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T19:11:14.219Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/almarklein.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-10-27T11:19:45.000Z","updated_at":"2023-04-14T14:19:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"c57c9c86-0dbd-4447-b3a3-448693f4ea79","html_url":"https://github.com/almarklein/commonast","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/almarklein%2Fcommonast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/almarklein%2Fcommonast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/almarklein%2Fcommonast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/almarklein%2Fcommonast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/almarklein","download_url":"https://codeload.github.com/almarklein/commonast/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250499827,"owners_count":21440692,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T09:05:04.284Z","updated_at":"2025-04-23T19:31:49.212Z","avatar_url":"https://github.com/almarklein.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# commonast\n\nA common AST description for Python\n\nThe aim of this project is to define a common ast description, that is\nthe same for different Python versions and implementations. All code\nis in [commonast.py](https://github.com/flexxui/pscript/blob/master/pscript/commonast.py).\nIt defines a function `parse()` to act as a replacement for\n`ast.parse()`.\n\nFor a definition of the nodes see \n[the nodes docs](https://github.com/almarklein/commonast/blob/master/nodes.md).\n\n## Requirements / support\n\nCommonast has been tested to work on:\n\n* CPython 2.7\n* CPython 3.3\n* CPython 3.4\n* CPython 3.5\n* CPython 3.6\n* CPython 3.7\n* CPython 3.8\n* pypy, pypy3, pypy4\n\n\n## Installation\n\nCopy the [commonast.py](https://github.com/flexxui/pscript/blob/master/pscript/commonast.py)\nmodule to your own project or put it somewhere on your PYTHONPATH.\n\nThis module does not live on pypi and cannot be installed with pip. The\nreason for this is that the ast definition may need to be changed if\nnew Python versions will be supported, which makes that we cannot\nguarantee backward compatibility.\n\n## Purpose\n\nI'm using this in\n[pscript](http://pscript.readthedocs.org)\nso that the code there can be agnostic about Python version and\nimplementation. Also, if me or someone else creates a pure Python AST\nparser that produces commonast, then we can easily use it in PScript\nto allow it to compile itself (which would open up some awesome\npossibilities).\n\nThe module is maintained from the Flexx project for now. That may change\nif commonast becomes used in other projects.\n\nMaybe this project can be useful to others as well. I'd be happy to\nsupport making this more generally useful.\n\n## Related projects\n\n* https://greentreesnakes.readthedocs.org provide the missing docs on Python's ast module. I found this a crucial resource when implementing commonast \n* https://github.com/Psycojoker/baron\n* https://github.com/davidhalter/jedi\n* Python's buildin ast module (a C implemantation)\n* Pythons buildin `lib2to3` module (probably the easiest route for a\n  pure Python ast parser.\n* Some people are [discussing a unified ast parser](https://github.com/davidhalter/jedi/issues/630)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falmarklein%2Fcommonast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falmarklein%2Fcommonast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falmarklein%2Fcommonast/lists"}