{"id":13412744,"url":"https://github.com/google/starlark-go","last_synced_at":"2025-05-12T05:24:43.876Z","repository":{"id":37932633,"uuid":"154343814","full_name":"google/starlark-go","owner":"google","description":"Starlark in Go: the Starlark configuration language, implemented in Go","archived":false,"fork":false,"pushed_at":"2025-04-17T14:37:17.000Z","size":2816,"stargazers_count":2468,"open_issues_count":63,"forks_count":225,"subscribers_count":40,"default_branch":"master","last_synced_at":"2025-05-11T03:09:08.355Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/google.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-10-23T14:35:50.000Z","updated_at":"2025-05-10T09:24:21.000Z","dependencies_parsed_at":"2023-09-21T18:31:11.874Z","dependency_job_id":"c2c2824f-ed96-4201-aa32-3106e644c2bf","html_url":"https://github.com/google/starlark-go","commit_stats":{"total_commits":433,"total_committers":81,"mean_commits":5.345679012345679,"dds":"0.36489607390300227","last_synced_commit":"046347dcd1044f5e568fcf64884b0344f27910c0"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fstarlark-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fstarlark-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fstarlark-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fstarlark-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/google","download_url":"https://codeload.github.com/google/starlark-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253509782,"owners_count":21919589,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T20:01:28.635Z","updated_at":"2025-05-11T03:09:18.108Z","avatar_url":"https://github.com/google.png","language":"Go","funding_links":[],"categories":["Go","开源类库","Go (134)","Open source library","Embeddable Scripting Languages","可嵌入的脚本语言"],"sub_categories":["解释器","Interpreter","Search and Analytic Databases","检索及分析资料库"],"readme":"\n\u003c!-- This file is the project homepage for go.starlark.net --\u003e\n\n# Starlark in Go\n\n[![Go Tests](https://github.com/google/starlark-go/actions/workflows/tests.yml/badge.svg)](https://github.com/google/starlark-go/actions/workflows/tests.yml)\n[![Go Reference](https://pkg.go.dev/badge/go.starlark.net/starlark.svg)](https://pkg.go.dev/go.starlark.net/starlark)\n\nThis is the home of the _Starlark in Go_ project.\nStarlark in Go is an interpreter for Starlark, implemented in Go.\nStarlark was formerly known as Skylark.\nThe import path for the Go package is `\"go.starlark.net/starlark\"`.\n\nStarlark is a dialect of Python intended for use as a configuration language.\nLike Python, it is an untyped dynamic language with high-level data\ntypes, first-class functions with lexical scope, and garbage collection.\nUnlike CPython, independent Starlark threads execute in parallel, so\nStarlark workloads scale well on parallel machines.\nStarlark is a small and simple language with a familiar and highly\nreadable syntax. You can use it as an expressive notation for\nstructured data, defining functions to eliminate repetition, or you\ncan use it to add scripting capabilities to an existing application.\n\nA Starlark interpreter is typically embedded within a larger\napplication, and the application may define additional domain-specific\nfunctions and data types beyond those provided by the core language.\nFor example, Starlark was originally developed for the\n[Bazel build tool](https://bazel.build).\nBazel uses Starlark as the notation both for its BUILD files (like\nMakefiles, these declare the executables, libraries, and tests in a\ndirectory) and for [its macro\nlanguage](https://docs.bazel.build/versions/master/skylark/language.html),\nthrough which Bazel is extended with custom logic to support new\nlanguages and compilers.\n\n\n## Documentation\n\n* Language definition: [doc/spec.md](doc/spec.md)\n\n* About the Go implementation: [doc/impl.md](doc/impl.md)\n\n* API documentation: [pkg.go.dev/go.starlark.net/starlark](https://pkg.go.dev/go.starlark.net/starlark)\n\n* Mailing list: [starlark-go](https://groups.google.com/forum/#!forum/starlark-go)\n\n* Issue tracker: [https://github.com/google/starlark-go/issues](https://github.com/google/starlark-go/issues)\n\n### Getting started\n\nBuild the code:\n\n```shell\n# check out the code and dependencies,\n# and install interpreter in $GOPATH/bin\n$ go install go.starlark.net/cmd/starlark@latest\n```\n\nRun the interpreter:\n\n```console\n$ cat coins.star\ncoins = {\n  'dime': 10,\n  'nickel': 5,\n  'penny': 1,\n  'quarter': 25,\n}\nprint('By name:\\t' + ', '.join(sorted(coins.keys())))\nprint('By value:\\t' + ', '.join(sorted(coins.keys(), key=coins.get)))\n\n$ starlark coins.star\nBy name:\tdime, nickel, penny, quarter\nBy value:\tpenny, nickel, dime, quarter\n```\n\nInteract with the read-eval-print loop (REPL):\n\n```pycon\n$ starlark\n\u003e\u003e\u003e def fibonacci(n):\n...    res = list(range(n))\n...    for i in res[2:]:\n...        res[i] = res[i-2] + res[i-1]\n...    return res\n...\n\u003e\u003e\u003e fibonacci(10)\n[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]\n\u003e\u003e\u003e\n```\n\nWhen you have finished, type `Ctrl-D` to close the REPL's input stream.\n\nEmbed the interpreter in your Go program:\n\n```go\nimport \"go.starlark.net/starlark\"\n\n// Execute Starlark program in a file.\nthread := \u0026starlark.Thread{Name: \"my thread\"}\nglobals, err := starlark.ExecFile(thread, \"fibonacci.star\", nil, nil)\nif err != nil { ... }\n\n// Retrieve a module global.\nfibonacci := globals[\"fibonacci\"]\n\n// Call Starlark function from Go.\nv, err := starlark.Call(thread, fibonacci, starlark.Tuple{starlark.MakeInt(10)}, nil)\nif err != nil { ... }\nfmt.Printf(\"fibonacci(10) = %v\\n\", v) // fibonacci(10) = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]\n```\n\nSee [starlark/example_test.go](starlark/example_test.go) for more examples.\n\n### Contributing\n\nWe welcome submissions but please let us know what you're working on\nif you want to change or add to the Starlark repository.\n\nBefore undertaking to write something new for the Starlark project,\nplease file an issue or claim an existing issue.\nAll significant changes to the language or to the interpreter's Go\nAPI must be discussed before they can be accepted.\nThis gives all participants a chance to validate the design and to\navoid duplication of effort.\n\nDespite some differences, the Go implementation of Starlark strives to\nmatch the behavior of [the Java implementation](https://github.com/bazelbuild/bazel)\nused by Bazel and maintained by the Bazel team.\nFor that reason, proposals to change the language itself should\ngenerally be directed to [the Starlark site](\nhttps://github.com/bazelbuild/starlark/), not to the maintainers of this\nproject.\nOnly once there is consensus that a language change is desirable may\nits Go implementation proceed.\n\nWe use GitHub pull requests for contributions.\n\nPlease complete Google's contributor license agreement (CLA) before\nsending your first change to the project.  If you are the copyright\nholder, you will need to agree to the\n[individual contributor license agreement](https://cla.developers.google.com/about/google-individual),\nwhich can be completed online.\nIf your organization is the copyright holder, the organization will\nneed to agree to the [corporate contributor license agreement](https://cla.developers.google.com/about/google-corporate).\nIf the copyright holder for your contribution has already completed\nthe agreement in connection with another Google open source project,\nit does not need to be completed again.\n\n### Stability\n\nWe reserve the right to make breaking language and API changes at this\nstage in the project, although we will endeavor to keep them to a minimum.\nOnce the Bazel team has finalized the version 1 language specification,\nwe will be more rigorous with interface stability.\n\nWe aim to support the most recent four (go1.x) releases of the Go\ntoolchain. For example, if the latest release is go1.20, we support it\nalong with go1.19, go1.18, and go1.17, but not go1.16.\n\n### Credits\n\nStarlark was designed and implemented in Java by\nJon Brandvein,\nAlan Donovan,\nLaurent Le Brun,\nDmitry Lomov,\nVladimir Moskva,\nFrançois-René Rideau,\nGergely Svigruha, and\nFlorian Weikert,\nstanding on the shoulders of the Python community.\nThe Go implementation was written by Alan Donovan and Jay Conrod;\nits scanner was derived from one written by Russ Cox.\n\n### Legal\n\nStarlark in Go is Copyright (c) 2018 The Bazel Authors.\nAll rights reserved.\n\nIt is provided under a 3-clause BSD license:\n[LICENSE](https://github.com/google/starlark-go/blob/master/LICENSE).\n\nStarlark in Go is not an official Google product.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle%2Fstarlark-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoogle%2Fstarlark-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle%2Fstarlark-go/lists"}