{"id":13452323,"url":"https://github.com/bazelbuild/starlark","last_synced_at":"2025-03-24T13:44:01.177Z","repository":{"id":37251668,"uuid":"145010913","full_name":"bazelbuild/starlark","owner":"bazelbuild","description":"Starlark Language","archived":false,"fork":false,"pushed_at":"2024-03-07T13:35:49.000Z","size":301,"stargazers_count":2206,"open_issues_count":81,"forks_count":149,"subscribers_count":58,"default_branch":"master","last_synced_at":"2024-04-10T15:58:23.467Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Starlark","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bazelbuild.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-16T16:04:57.000Z","updated_at":"2024-05-07T02:33:06.941Z","dependencies_parsed_at":"2023-02-14T20:15:45.559Z","dependency_job_id":"4d862cc0-2151-4143-935d-a6573db2990f","html_url":"https://github.com/bazelbuild/starlark","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazelbuild%2Fstarlark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazelbuild%2Fstarlark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazelbuild%2Fstarlark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazelbuild%2Fstarlark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bazelbuild","download_url":"https://codeload.github.com/bazelbuild/starlark/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245284301,"owners_count":20590306,"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-31T07:01:20.625Z","updated_at":"2025-03-24T13:44:01.149Z","avatar_url":"https://github.com/bazelbuild.png","language":"Starlark","readme":"# Starlark\n\n[![Build status](https://badge.buildkite.com/8b4240b7092ded039cad0d825d7a6ebff115623ec8af217121.svg)](https://buildkite.com/bazel/starlark)\n\n## Overview\n\nStarlark (formerly known as Skylark) is a language intended for use as a\nconfiguration language. It was designed for the [Bazel](https://bazel.build/)\nbuild system, but may be useful for other projects as well. This repository is\nwhere Starlark features are proposed, discussed, and specified. It contains\ninformation about the language, including the [specification](spec.md). There\nare [multiple implementations of Starlark](https://github.com/laurentlb/awesome-starlark).\n\n\nStarlark is a dialect of [Python](https://www.python.org/). Like Python, it is a\ndynamically typed language with high-level data types, first-class functions\nwith lexical scope, and garbage collection. Independent Starlark threads execute\nin parallel, so Starlark workloads scale well on parallel machines. Starlark is\na small and simple language with a familiar and highly readable syntax. You can\nuse it as an expressive notation for structured data, defining functions to\neliminate repetition, or you can use it to add scripting capabilities to an\nexisting application.\n\nA Starlark interpreter is typically embedded within a larger application, and\nthe application may define additional domain-specific functions and data types\nbeyond those provided by the core language. For example, Starlark was originally\ndeveloped for the Bazel build tool. Bazel uses Starlark as the notation both for\nits BUILD files (like Makefiles, these declare the executables, libraries, and\ntests in a directory) and for its macro language, through which Bazel is\nextended with custom logic to support new languages and compilers.\n\n## Design Principles\n\n*   **Deterministic evaluation**. Executing the same code twice will give the\n    same results.\n*   **Hermetic execution**. Execution cannot access the file system, network,\n    system clock. It is safe to execute untrusted code.\n*   **Parallel evaluation**. Modules can be loaded in parallel. To guarantee a\n    thread-safe execution, shared data becomes immutable.\n*   **Simplicity**. We try to limit the number of concepts needed to understand\n    the code. Users should be able to quickly read and write code, even if they\n    are not experts. The language should avoid pitfalls as much as possible.\n*   **Focus on tooling**. We recognize that the source code will be read,\n    analyzed, modified, by both humans and tools.\n*   **Python-like**. Python is a widely used language. Keeping the language\n    similar to Python can reduce the learning curve and make the semantics more\n    obvious to users.\n\n## Tour\n\nThe code provides an example of the syntax of Starlark:\n\n```python\n# Define a number\nnumber = 18\n\n# Define a dictionary\npeople = {\n    \"Alice\": 22,\n    \"Bob\": 40,\n    \"Charlie\": 55,\n    \"Dave\": 14,\n}\n\nnames = \", \".join(people.keys())  # Alice, Bob, Charlie, Dave\n\n# Define a function\ndef greet(name):\n    \"\"\"Return a greeting.\"\"\"\n    return \"Hello {}!\".format(name)\n\ngreeting = greet(names)\n\nabove30 = [name for name, age in people.items() if age \u003e= 30]\n\nprint(\"{} people are above 30.\".format(len(above30)))\n\ndef fizz_buzz(n):\n    \"\"\"Print Fizz Buzz numbers from 1 to n.\"\"\"\n    for i in range(1, n + 1):\n        s = \"\"\n        if i % 3 == 0:\n            s += \"Fizz\"\n        if i % 5 == 0:\n            s += \"Buzz\"\n        print(s if s else i)\n\nfizz_buzz(20)\n```\n\nIf you've ever used Python, this should look very familiar. In fact, the code\nabove is also a valid Python code. Still, this short example shows most of the\nlanguage. Starlark is indeed a very small language.\n\nFor more information, see:\n\n*   [Discussions for some design choices](design.md)\n*   [Why Starlark was created](https://blog.bazel.build/2017/03/21/design-of-skylark.html)\n    (previously named Skylark)\n*   The [specification](spec.md)\n*   The mailing-list: [starlark@googlegroups.com](https://groups.google.com/forum/#!forum/starlark)\n\n## Build API\n\nThe first use-case of the Starlark language is to describe builds: how to\ncompile a C++ or a Scala library, how to build a project and its dependencies,\nhow to run tests. Describing a build can be surprisingly complex, especially as\na codebase mixes multiple languages and targets multiple platforms.\n\nIn the future, this repository will contain a complete description of the build\nAPI used in Bazel. The goal is to have a clear specification and precise\nsemantics, in order to interoperate with other systems. Ideally, other tools\nwill be able to understand the build API and take advantage of it.\n\n## Evolution\n\nRead about [the design process](process.md) if you want to suggest improvements\nto the specification. Follow the\n[mailing-list](https://groups.google.com/forum/#!forum/starlark) to discuss the\nevolution of Starlark.\n\n## Implementations, tools, and users\n\nSee [Awesome Starlark](https://github.com/laurentlb/awesome-starlark).\n\n","funding_links":[],"categories":["Python","Other Configuration Language","Starlark","Subsets of Python","Frameworks and Metalanguages","Uncategorized","others"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbazelbuild%2Fstarlark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbazelbuild%2Fstarlark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbazelbuild%2Fstarlark/lists"}