semvec/pypi-packages huggingface dataset:
goastpy 0.1.10
Python Wrapper for Go AST Parser
Requires Python: >=3.6
Keywords: GO,GOLANG,PYTHON,AST,GOPY,PYGO,PARSER,ASTPARSER,goastpy,astpy,pyast,goast,gopy,golangast,abstract syntax tree

# 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!
cpp2py 0.0.2
convert c/cpp code to python.
Keywords: cpp,c,cpp2py,cpp2python

# cpp2py
A tool to convert c/c++ code to python code


# how to install:
pip install cpp2py


# how to use in python:

import cpp2py
cpp2py.c2py(input_c_file_path, output_py_file_name)
cpp2py.py2c(input_py_file_path, output_c_file_name)


```
from cpp2py import cpp2py
cpp2py.c2py('./c1.c', 'c1.py')

```

c1.c:

```
int main(int argc, char **argv)
{
int a=1;
int b=2;
int c;
c=a+b;
return 0;
}
```

generated:
c1.py

```
def main(argc, argv):
	a = 1
	b = 2
	c = a+b
	return 0


```




# how to use in cmd(TBD):

python -m cpp2py -i input_c_file_path -o output_py_file_path -f convert_format
eg: python -m cpp2py -i input_file.c -o output.py -f c2py

convert_format: c2py py2c cpp2py py2cpp



# current stage

```
c2py C
py2c X
cpp2py X
py2cpp X

x--not finished
y--finished
C--partly working

```