goastpy

module
v0.1.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2023 License: MIT

README ΒΆ

GoAstPy - Python Wrapper for Go AST Parser

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

pip install goastpy

πŸ“š Usage

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

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 or submit a pull request. Let's make GoAstPy even better together!

Directories ΒΆ

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL