Skip to content

[Bug]: py_venv rule does not create the virtual environment correctly in v 1.5.2 #573

Open
@pouyana

Description

@pouyana

What happened?

Hi,

I tried to use the latest version of rules_py (1.5.2). Sourcing the created venv, does not add the (.venv.venv) at the beginning of the prompt and my own Bazel built libraries (added as deps to the py_venv) cannot be imported in the virtual environment. The latest version that worked with the exact same code is 1.4.0.

Thanks,
Pouyan

Version

Development (host) and target OS/architectures: Ubuntu 24.04/amd64

Output of bazel --version: bazel 8.2.1

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file:

"""Contains all the spider global information module"""

module(
    name = "spider",
    version = "0.0.1",
    compatibility_level = 1,
)

bazel_dep(name = "rules_python", version = "1.4.1")
bazel_dep(name = "aspect_rules_py", version = "1.5.2")

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
    python_version = "3.12",
)

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
    hub_name = "pypi",
    python_version = "3.12",
    requirements_lock = "//:requirements_lock.txt",
)

use_repo(pip, "pypi")

Language(s) and/or frameworks involved:

How to reproduce

* create a simple py_library
* add the py_library as dependency to py_venv
* run the py_venv rule
* source the venv (activate)
-> (venv.venv) is not visible in the shell prompt after activation in v 1.5.2.
-> (venv.venv) is visible in the shell prompt after activation in v 1.4.0.
* try to import the py_library in the the venv
-> Will get module not found error in 1.5.2
-> imports the library without issue in 1.4.0.

Any other information?

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingreproducedValidated bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions