https://github.com/soulteary/go-python-ast
Get Python AST with Go.
https://github.com/soulteary/go-python-ast
go python python-ast
Last synced: 3 months ago
JSON representation
Get Python AST with Go.
- Host: GitHub
- URL: https://github.com/soulteary/go-python-ast
- Owner: soulteary
- License: apache-2.0
- Created: 2023-05-26T09:24:49.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-26T12:13:24.000Z (about 2 years ago)
- Last Synced: 2025-02-05T12:46:59.472Z (5 months ago)
- Topics: go, python, python-ast
- Language: Go
- Homepage: https://soulteary.com/2023/05/22/using-golang-and-docker-to-implement-python-computing-services.html
- Size: 21.5 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go Python AST
Get Python AST with Go.
## Usage
Start Go Python AST service, `8080` for HTTP client and `8081` for GRPC client.
```bash
# docker image base debian
docker run --rm -it -p 8080:8080 -p 8081:8081 soulteary/go-python-ast
# or alpine base
docker run --rm -it -p 8080:8080 -p 8081:8081 soulteary/go-python-ast:alpine
```You can use the following commands to test the HTTP API.
```bash
# curl --request POST 'http://127.0.0.1:8080/api/convert' --header 'Content-Type: application/json' --data-raw 'print("hello world")'"{\"Module\": {\"body\": [{\"Expr\": {\"value\": {\"Call\": {\"func\": {\"Name\": {\"id\": \"print\", \"ctx\": \"Load\"}}, \"args\": [{\"Str\": {\"s\": \"hello world\"}}], \"keywords\": []}}}}]}}"
```You can use the following commands to test the GRPC API.
```bash
cd example/grpc-client
go run main.go
```## Tutorial
- [Using Golang and Docker to implement Python computing services](https://soulteary.com/2023/05/22/using-golang-and-docker-to-implement-python-computing-services.html)
## Dev
```bash
docker build -t soulteary/go-python-ast . -f docker/Dockerfile
```## Credits
- [Docker Python in Go](https://github.com/soulteary/docker-python-in-go), the principle.