# GoAstPy - Python Wrapper for Go AST Parser
[![GitHub license](https://img.shields.io/github/license/itayg25/goastpy)](https://github.com/itayg25/goastpy/blob/master/LICENSE)
[![GitHub issues](https://img.shields.io/github/issues/itayg25/goastpy)](https://github.com/itayg25/goastpy/issues)
[![GitHub forks](https://img.shields.io/github/forks/itayg25/goastpy)](https://github.com/itayg25/goastpy/network)
[![GitHub stars](https://img.shields.io/github/stars/itayg25/goastpy)](https://github.com/itayg25/goastpy/stargazers)
[![PyPI version](https://badge.fury.io/py/goastpy.svg)](https://pypi.org/project/goastpy/)
[![Downloads](https://pepy.tech/badge/goastpy)](https://pepy.tech/project/goastpy)
`GoAstPy` is a Python wrapper for the built-in Go Abstract Syntax Tree (AST) parser. It allows you to parse and manipulate Go source code from within your Python applications. This package is perfect for developers working with Go code analysis, code generation, or automated refactoring tools in Python.
## 🚀 Installation
```bash
pip install goastpy
```
## 📚 Usage
```python
import goastpy
if __name__ == '__main__':
code = '''
package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
}
'''
parsed_code = goastpy.GoAst(code)
print(parsed_code.ast)
```
With GoAstPy, you can quickly and easily parse Go source code, extract information about its structure, and work with it in your Python projects.
## 🛠️ Building the Go Shared Library
```bash
cd ./goastpy
go build -o goastparser.so -buildmode=c-shared main.go goastparser_export.go
```
This command generates a shared library file (goastparser.so) that is used by the Python wrapper to interface with the Go AST parser.
## 🔖 GitHub Tags
- `golang`
- `python`
- `ast`
- `go-ast-parser`
- `code-analysis`
- `code-generation`
- `refactoring`
## 📖 License
This project is licensed under the MIT License.
## 🌟 Contributing
We welcome contributions from the community! If you find a bug or have a feature request, please [open an issue](https://github.com/itayg25/GoAstPy/issues) or submit a [pull request](https://github.com/itayg25/GoAstPy/pulls). Let's make `GoAstPy` even better together!
Raw data
{
"_id": null,
"home_page": "https://github.com/itayg25/goastpy",
"name": "goastpy",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "GO,GOLANG,PYTHON,AST,GOPY,PYGO,PARSER,ASTPARSER,goastpy,astpy,pyast,goast,gopy,golangast,abstract syntax tree",
"author": "Itay Gersten",
"author_email": "Itay.Gersten@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/d8/77/7a790a61c70d572cd01b5c9a549fff557472b414a9715b9a792019ed7639/goastpy-0.1.10.tar.gz",
"platform": null,
"description": "# GoAstPy - Python Wrapper for Go AST Parser\n\n\n[![GitHub license](https://img.shields.io/github/license/itayg25/goastpy)](https://github.com/itayg25/goastpy/blob/master/LICENSE)\n[![GitHub issues](https://img.shields.io/github/issues/itayg25/goastpy)](https://github.com/itayg25/goastpy/issues)\n[![GitHub forks](https://img.shields.io/github/forks/itayg25/goastpy)](https://github.com/itayg25/goastpy/network)\n[![GitHub stars](https://img.shields.io/github/stars/itayg25/goastpy)](https://github.com/itayg25/goastpy/stargazers)\n[![PyPI version](https://badge.fury.io/py/goastpy.svg)](https://pypi.org/project/goastpy/)\n[![Downloads](https://pepy.tech/badge/goastpy)](https://pepy.tech/project/goastpy)\n\n`GoAstPy` is a Python wrapper for the built-in Go Abstract Syntax Tree (AST) parser. It allows you to parse and manipulate Go source code from within your Python applications. This package is perfect for developers working with Go code analysis, code generation, or automated refactoring tools in Python.\n\n## \ud83d\ude80 Installation\n\n```bash\npip install goastpy\n```\n\n## \ud83d\udcda Usage\n\n```python\nimport goastpy\n\nif __name__ == '__main__':\n code = '''\n package main\n\n import \"fmt\"\n\n func main() {\n fmt.Println(\"Hello, World!\")\n }\n '''\n parsed_code = goastpy.GoAst(code)\n print(parsed_code.ast)\n```\n\nWith GoAstPy, you can quickly and easily parse Go source code, extract information about its structure, and work with it in your Python projects.\n\n## \ud83d\udee0\ufe0f Building the Go Shared Library\n\n```bash\ncd ./goastpy\ngo build -o goastparser.so -buildmode=c-shared main.go goastparser_export.go\n\n```\nThis command generates a shared library file (goastparser.so) that is used by the Python wrapper to interface with the Go AST parser.\n\n## \ud83d\udd16 GitHub Tags\n\n- `golang`\n- `python`\n- `ast`\n- `go-ast-parser`\n- `code-analysis`\n- `code-generation`\n- `refactoring`\n\n## \ud83d\udcd6 License\n\nThis project is licensed under the MIT License.\n\n## \ud83c\udf1f Contributing\n\nWe welcome contributions from the community! If you find a bug or have a feature request, please [open an issue](https://github.com/itayg25/GoAstPy/issues) or submit a [pull request](https://github.com/itayg25/GoAstPy/pulls). Let's make `GoAstPy` even better together!\n\n",
"bugtrack_url": null,
"license": "",
"summary": "Python Wrapper for Go AST Parser",
"version": "0.1.10",
"split_keywords": [
"go",
"golang",
"python",
"ast",
"gopy",
"pygo",
"parser",
"astparser",
"goastpy",
"astpy",
"pyast",
"goast",
"gopy",
"golangast",
"abstract syntax tree"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "88e9921e8eb6a4cd3ec2d361957862003915de2f0edb3a15fa1a1d0707d2bc9f",
"md5": "350c5d8ee4ac4731f5d2bc461fce98d2",
"sha256": "dfaadc0aafd851feb5c72655881be022112a4798d9637dcb48b259469fce4469"
},
"downloads": -1,
"filename": "goastpy-0.1.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "350c5d8ee4ac4731f5d2bc461fce98d2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 4661563,
"upload_time": "2023-04-19T14:29:22",
"upload_time_iso_8601": "2023-04-19T14:29:22.715399Z",
"url": "https://files.pythonhosted.org/packages/88/e9/921e8eb6a4cd3ec2d361957862003915de2f0edb3a15fa1a1d0707d2bc9f/goastpy-0.1.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d8777a790a61c70d572cd01b5c9a549fff557472b414a9715b9a792019ed7639",
"md5": "940ad80676bc717b689047e0e7c1449f",
"sha256": "82a689936f1f0e25f717e1336834a47718561d59b93fbbffb132adfd1e66ace8"
},
"downloads": -1,
"filename": "goastpy-0.1.10.tar.gz",
"has_sig": false,
"md5_digest": "940ad80676bc717b689047e0e7c1449f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 4653680,
"upload_time": "2023-04-19T14:29:26",
"upload_time_iso_8601": "2023-04-19T14:29:26.649621Z",
"url": "https://files.pythonhosted.org/packages/d8/77/7a790a61c70d572cd01b5c9a549fff557472b414a9715b9a792019ed7639/goastpy-0.1.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-19 14:29:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "itayg25",
"github_project": "goastpy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "goastpy"
}