Socket
Book a DemoInstallSign in
Socket

vimagination.zapto.org/python

Package Overview
Dependencies
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vimagination.zapto.org/python

Go Modules
Version
v1.0.0
Version published
Created
Source

python

CI Go Reference Go Report Card

-- import "vimagination.zapto.org/python"

Package python implements a python tokeniser and parser.

Highlights

  • Parse python code into AST.
  • Modify parsed code.
  • Consistant python formatting.

Usage

package main

import (
	"fmt"

	"vimagination.zapto.org/parser"
	"vimagination.zapto.org/python"
)

func main() {
	src := `for name in ["Alice", "Bob", "Charlie"]: print("Hello,", name)`

	tk := parser.NewStringTokeniser(src)

	ast, err := python.Parse(&tk)
	if err != nil {
		fmt.Println(err)

		return
	}

	python.UnwrapConditional(python.UnwrapConditional(ast.Statements[0].CompoundStatement.For.Suite.StatementList.Statements[0].AssignmentStatement.StarredExpression.Expression.ConditionalExpression).(*python.PrimaryExpression).Call.ArgumentList.PositionalArguments[0].AssignmentExpression.Expression.ConditionalExpression).(*python.Atom).Literal.Data = `"Hi,"`

	fmt.Printf("%+s", ast)

	// Output:
	// for name in ["Alice", "Bob", "Charlie"]: print("Hi,", name)
}

Documentation

Full API docs can be found at:

https://pkg.go.dev/vimagination.zapto.org/python

FAQs

Package last updated on 18 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts