Skip to content

cedarai/rules_pyvenv

Folders and files

NameName
Last commit message
Last commit date
Jul 13, 2023
Oct 11, 2022
Jul 13, 2023
Aug 13, 2021
Aug 13, 2021
Aug 13, 2021
Mar 11, 2023
Aug 13, 2021
Jul 13, 2023
Aug 13, 2021
May 30, 2024

Repository files navigation

Bazel rules for creating Python virtual environments.

See example/ for an example.

Installation

Add the following to your WORKSPACE.

(Note: see the releases page for release-specific WORKSPACE config)

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "rules_pyvenv",
    strip_prefix = "rules_pyvenv-main",
    url = "https://github.com/cedarai/rules_pyvenv/archive/main.tar.gz",
)

These rules require a recent version of Python 3.6+ and rules_python. The environment is built using the venv library that ships with the Python standard library. If using the system-provided Python on Debian/Ubuntu, you may need to run

apt install python3.8-venv

On Windows, you need to enable symlink support.

Example

$ cd example
$ bazel run //:venv env
$ . env/bin/activate