Git Product home page Git Product logo

starlark-rust's Introduction

Starlark in Rust

Support Ukraine GitHub link crates.io version docs.rs availability Build status

NOTE: Version 0.4.0 of this library changes maintainer from Google to Facebook.

There are several copies of this repo on GitHub, facebookexperimental/starlark-rust is the canonical one.

This project provides a Rust implementation of the Starlark language. Starlark (formerly codenamed Skylark) is a deterministic language inspired by Python3, used for configuration in the build systems Bazel and Buck. This project was originally developed in this repo, which contains a more extensive history.

There are at least three implementations of Starlark, one in Java, one in Go, and this one in Rust. We mostly follow the Starlark standard. If you are interested in trying out Rust Starlark, you can clone this repo and run:

$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
$ cargo run
$> 1+2
3

Learn More

Read this blog post for an overview of the library, the reasons behind Starlark, and how it might fit in to your project. There is also a 2 minute introductory video.

Features

This project features:

  • Easy interoperability between Rust types and Starlark.
  • Rust-friendly types, so frozen values are Send/Sync, while non-frozen values aren't.
  • Garbage collected values allocated on a heap.
  • Optional runtime-checked types.
  • A linter, to detect code issues in Starlark.
  • IDE integration in the form of LSP.

This project also has three non-goals:

  • We do not aim for API stability between releases, preferring to iterate quickly and refine the API as much as possible. But we do follow SemVer.
  • We do not aim for minimal dependencies, preferring to keep one package with lots of power. But if some dependencies prove tricky, we might add feature flags.
  • We do not aim to work with Rust stable, preferring to take advantage of the unstable features in Rust to improve our code as much as possible. We hope that eventually enough features will be stabilised that using stable is reasonable again.

Components

There are three components:

  • starlark_derive, a proc-macro crate that defines the necessary macros for Starlark. This library is a dependency of starlark the library, which reexports all the relevant pieces, and should not be used directly.
  • starlark the library, a library that defines the parser, evaluator and standard library. Projects wishing to embed Starlark in their environment (with additional types, library functions and features) will make use of this library.
  • starlark the binary, which provides interactive evaluation, IDE features and linter, exposed through a command line. Useful if you want to use vanilla Starlark (but if you do, consider Python3 instead) or as a test-bed for experimenting. Most projects will end up implementing some of this functionality themselves over the starlark library, incorporating their specific extra types etc.

Compatibility

In this section we outline where we don't comply with the Starlark spec.

  • We have plenty of extensions, e.g. type annotations, recursion, top-level for.
  • We don't yet support later additions to Starlark, such as bytes.
  • In some cases creating circular data structures may lead to stack overflows.

Making a release

  1. Check the GitHub Actions are green.
  2. Update CHANGELOG.md with the changes since the last release. This link can help (update to compare against the last release).
  3. Update the version numbers of the two Cargo.toml files. Bump them by 0.0.1 if there are no incompatible changes, or 0.1.0 if there are. Bump the dependency in starlark to point at the latest starlark_derive version.
  4. Copy the files CHANGELOG.md, LICENSE and README.md into each starlark and starlark_derive subdirectory.
  5. Run cargo publish --allow-dirty --dry-run, then without the --dry-run, first in starlark_derive and then starlark directories.
  6. Create a GitHub release with v0.X.Y, using the starlark version as the name.

License

Starlark Rust is Apache License, Version 2.0 licensed, as found in the LICENSE file.

starlark-rust's People

Contributors

stepancheg avatar ndmitchell avatar bobyangyf avatar krallin avatar cjhopman avatar facebook-github-bot avatar vmagro avatar zertosh avatar blackm00n avatar jakobdegen avatar scottcao avatar wendy728 avatar dmitryvinn avatar swgillespie avatar philipcraig avatar pierd avatar ianchilds avatar christolliday avatar zzl0 avatar willstott101 avatar wilfred avatar stephanos avatar kapji avatar rgiese avatar poconn avatar silvergasp avatar milend avatar themarwhal avatar lhvy avatar lebentle avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.