Git Product home page Git Product logo

rules_py's Introduction

Aspect's Bazel rules for Python

aspect_rules_py is a layer on top of rules_python, the standard Python ruleset hosted at https://github.com/bazelbuild/rules_python. The lower layer of rules_python is currently reused, dealing with the toolchain and dependencies.

However, this ruleset introduces a new implementation of py_library, py_binary, and py_test. Our philosophy is to behave more like idiomatic python ecosystem tools, where rules_python is closely tied to the way Google does Python development in their internal monorepo, google3.

Layer Legacy Recommended
rules: BUILD file UI rules_python rules_py
gazelle: generate BUILD files rules_python rules_python [1]
pip_parse: fetch and install deps from pypi rules_python rules_python
toolchain: fetch hermetic interpreter rules_python rules_python

Need help? This ruleset has support provided by https://aspect.dev.

[1] we will likely fork the extension for performance, using TreeSitter to parse Python code rather than a Python program.

Differences

We think you'll love rules_py because:

Note

What about the "starlarkification" effort in rules_python?

We think this is only useful within Google, because the semantics of the rules will remain identical. Even though the code will live in bazelbuild/rules_python rather than bazelbuild/bazel, it still cannot change without breaking Google-internal usage, and has all the ergonomic bugs above due to the way the runtime is stubbed.

Installation

Follow instructions from the release you wish to use: https://github.com/aspect-build/rules_py/releases

Using with Gazelle

In any ancestor BUILD file of the Python code, add these lines to instruct Gazelle to create rules_py variants of the py_* rules:

# gazelle:map_kind py_library py_library @aspect_rules_py//py:defs.bzl
# gazelle:map_kind py_binary py_binary @aspect_rules_py//py:defs.bzl
# gazelle:map_kind py_test py_test @aspect_rules_py//py:defs.bzl

rules_py's People

Contributors

renovate[bot] avatar mattem avatar alexeagle avatar gregmagolan avatar thesayyn avatar f0rmiga avatar dependabot[bot] avatar wade-arista avatar mvukov avatar linzhp avatar tellett avatar scasagrande avatar siddharthab avatar shinypb avatar kpark-hrp avatar dzbarsky avatar sfc-gh-dszot avatar btobolaski 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.