Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: py_venv doesn't include dependency executables in venv bin/ #423

Open
wevonosky opened this issue Oct 24, 2024 · 4 comments
Open
Labels
bug Something isn't working

Comments

@wevonosky
Copy link

wevonosky commented Oct 24, 2024

What happened?

When making a venv in aspect_rules_py executables generated by dependencies do not make it into the bin folder of the venv.

Version

Development (host) and target OS/architectures:

Output of bazel --version: 7.4.0

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

Language(s) and/or frameworks involved: Same as this repo

How to reproduce

Within this repo:

1. Add alembic to requirements.in file
2. Run `bazel run //:requirements.update`
3. Add `"@pypi_alembic//:pkg"` as dep in `examples/py_binary` build file
4. Run `bazel run //examples/py_binary:py_binary.venv`
5. Inspect the `.examples+py_binary+py_binary.venv/bin/` and see that the alembic executable is not there
6. Create a new directory and cd into it
7. Run with native python `python -m venv env`
8. Run `source env/bin/activate`
9. Run `pip install alembic`
10. The alembic executable is included in the `env/bin` folder.

Any other information?

No response

@wevonosky wevonosky added the bug Something isn't working label Oct 24, 2024
@LarsMichelsen
Copy link

Have the same issue with semgrep, which installs an executable via the package data.

Not sure how relevant this is, but it looks like this feature was added to rules_pyvenv at some point (cedarai/rules_pyvenv#12).

Is there any plan to add this? Can we help?

@alexeagle
Copy link
Member

A contribution here would be great. Note that we've recently switched to use uv for creating the virtualenv, so likely whatever support is needed to make console scripts functional is already available there, we just need to wire it up.

@TimotheusBachinger
Copy link

I don't completely understand. using create_venv from rules_uv correctly populates the bin folder, this is our current workaround, see https://github.com/Checkmk/checkmk/blob/042eb9193a092a22592d56cd3c34f27de8b17eb7/packages/cmk-agent-based/run#L119C19-L119C26

are you planing to switch also to rules_uv? or would you prefer fixing the deployment of the bin folder via py/private/py_venv.bzl?

@mattem
Copy link
Member

mattem commented Nov 7, 2024

We don't use uv directly in the same way rules_uv does, but do so via the Rust crates. The work here is to ensure the parts that create the bin structure is wired up via the Rust code in rules_py.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants