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

Feat/test #73

Merged
merged 3 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tmp/
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
- name: Show info
id: info
run: |
uname -a
python3 -V
bazel info
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
bazel-*
examples/*/MODULE.bazel.lock
MODULE.bazel.lock
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ The repository defines Bazel installation rules for [Poetry](https://github.com/
The major difference to pip rules in [rules_python](https://github.com/bazelbuild/rules_python) is that Python packages are installed as `py_library` targets and not as external repositories.
This allows to use platform information of resolved Python toolchains and build cross-platform Python artifacts.

Minimum requirements:

* Bazel 6.x

## Getting started

Expand Down Expand Up @@ -81,4 +84,5 @@ For example, in the following case
```
`pytest` will be loaded from the `repo2` repository.

⚠ Mixing different repositories in one `deps` block may lead to side-effects related to using incompatible versions of transitive dependencies.
> **Note**
> Mixing different repositories in one `deps` block may lead to side-effects related to using incompatible versions of transitive dependencies.
1 change: 0 additions & 1 deletion examples/.gitignore

This file was deleted.

1 change: 1 addition & 0 deletions examples/aspect_rules_py/.bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.x
1 change: 1 addition & 0 deletions examples/cc_toolchain/.bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
last_rc
199 changes: 149 additions & 50 deletions examples/cc_toolchain/poetry.lock

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion examples/cc_toolchain/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@
import pytest

import llama_cpp
from llama_cpp.llama_cpp import _lib as llama_lib
from llama_cpp.llama_cpp import _lib_base_name as lib_base_name
from llama_cpp.llama_cpp import _load_shared_library as load_shared_library


def test_llama_version():
dependencies = tomllib.load(open("poetry.lock", "rb"))
locked = next((package for package in dependencies["package"] if package["name"] == "llama-cpp-python"), None)
assert locked["version"] == llama_cpp.version.__version__
assert locked["version"] == llama_cpp.__version__

assert llama_cpp.llama_max_devices() > 0


def test_llama_library_rpath():
assert llama_lib
lib = load_shared_library(lib_base_name)
assert llama_lib._name == lib._name
with open(lib._name, "rb") as handle:
assert b"bazel-out/" in handle.read()

Expand Down
15 changes: 9 additions & 6 deletions examples/integration_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ BUILD_WORKSPACE_DIRECTORY=$(dirname $(readlink -f WORKSPACE))
if [ ! -z ${TEST_TMPDIR+x} -a $1 != "transitions" ]; then
export TMPDIR=$TEST_TMPDIR
fi
export HOME=$TEST_TMPDIR

cd examples/$1
bazel test ... \
--test_output=errors \
--spawn_strategy=local\
--verbose_failures \
--override_module=rules_poetry=$BUILD_WORKSPACE_DIRECTORY \
--override_repository=rules_poetry=$BUILD_WORKSPACE_DIRECTORY

ARGS="--test_output=errors --spawn_strategy=local --verbose_failures"
ARGS="$ARGS --override_repository=rules_poetry=$BUILD_WORKSPACE_DIRECTORY"
[ -f MODULE.bazel ] && ARGS="$ARGS --override_module=rules_poetry=$BUILD_WORKSPACE_DIRECTORY"

echo "Using $(bazelisk version)"
bazelisk test ... $ARGS

1 change: 1 addition & 0 deletions examples/markers/.bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
last_downstream_green
12 changes: 6 additions & 6 deletions examples/markers/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/simple/.bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
last_green
30 changes: 15 additions & 15 deletions examples/simple/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading