bazel-contrib / bazel-contrib/rules_uv

rules_uv and cc toolchain

Open
#163 2 comments 2 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
29
Forks
12
PR merge metrics
No merged PRs in 30d

Description

Hey all,

I want to use `create_venv` to built a virtual environment which includes `python-ldap`.
`python-ldap` does *not* ship wheels, bindings must be compiled from source during installation (see https://www.python-ldap.org/en/python-ldap-3.4.3/installing.html).

With `rules_uv`, building a venv would fallback to searching for `clang` and fail during `bazel run`:
```
bazel run //:create_venv
....
creating build/temp.linux-x86_64-cpython-312/Modules
clang -pthread -fno-strict-overflow -Wsign-compare -Wunreachable-code -DNDEBUG -g -O3 -Wall -fPIC -fPIC -DHAVE_SASL -DHAVE_TLS -DLDAPMODULE_VERSION=3.4.3 "-DLDAPMODULE_AUTHOR=python-ldap project" "-DLDAPMODULE_LICENSE=Python style" -IModules -I/home/timotheus/.cache/uv/builds-v0/.tmpI2PFRO/include -I/home/timotheus/.cache/bazel/_bazel_timotheus/8eab503e08f341c0f5040098b6ae80b5/external/rules_python~~python~python_3_12_3_x86_64-unknown-linux-gnu/include/python3.12 -c Modules/LDAPObject.c -o build/temp.linux-x86_64-cpython-312/Modules/LDAPObject.o

[stderr]
/home/timotheus/.cache/uv/builds-v0/.tmpI2PFRO/lib/python3.12/site-packages/setuptools/_distutils/dist.py:261: UserWarning: Unknown distribution option: 'test_suite'
warnings.warn(msg)
no previously-included directories found matching 'Doc/.build'
error: command 'clang' failed: No such file or directory
```

In our project, we already have a `cc` toolchain registered via `rules_cc`.
Is it possible to tell `rules_uv` to use that toolchain instead of searching for `clang`?

Regards
Timi

Contributor guide

Open the contributing guide

Research direction

Start by reading how rules_uv's create_venv invokes builds for source-only Python packages, then compare that with the project's existing rules_cc toolchain registration. Verify the behavior with the python-ldap installation scenario shown in the issue; done means bazel run can build the package using the registered cc toolchain instead of searching for clang.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.