From 64a677baf5f15353bf7f8995b9d0b8251b51cd4b Mon Sep 17 00:00:00 2001 From: MaximilianSoerenPollak Date: Wed, 18 Feb 2026 09:35:14 +0100 Subject: [PATCH 01/11] Upgrade dev to real dependency --- MODULE.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MODULE.bazel b/MODULE.bazel index e6c032d..dc747f5 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -94,7 +94,7 @@ multitool.hub( ) use_repo(multitool, "yamlfmt_hub") -bazel_dep(name = "score_docs_as_code", version = "3.0.1", dev_dependency = True) +bazel_dep(name = "score_docs_as_code", version = "3.0.1") # bazel_dep(name = "score_platform", version = "0.5.0") bazel_dep(name = "score_process", version = "1.3.2") From b869a5c73ded48f6a40f459858af2cfbae7be9d6 Mon Sep 17 00:00:00 2001 From: MaximilianSoerenPollak Date: Wed, 18 Feb 2026 12:04:06 +0100 Subject: [PATCH 02/11] Fixing tests Fixing python tests, it now works. Seems that behaviour changed in new rules_python. --- .github/workflows/tests.yml | 5 ++--- python_basics/integration_tests/MODULE.bazel | 4 ++-- python_basics/integration_tests/simple-tests/BUILD | 1 - .../integration_tests/simple-tests/test_venv_ok.py | 9 +++++++-- .../test_extra_requirements_ok.py | 5 ++++- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b43c3ec..d3461f8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,9 +9,8 @@ jobs: - name: Checkout repository uses: actions/checkout@v4.2.2 - name: Run python_basics integration tests - run: | - cd python_basics/integration_tests - bazel test //... + shell: bash + run: "cd python_basics/integration_tests \n# Have to create the virtualenv as it's a run command. Otherwise basic_venv is just build and won't be able\n# To execute what we need in the simple-tests.\nbazel run //simple-tests:basic_venv\nbazel test //...\n" - name: Run starpls integration tests run: | cd starpls/integration_tests diff --git a/python_basics/integration_tests/MODULE.bazel b/python_basics/integration_tests/MODULE.bazel index 901c253..1a2959f 100644 --- a/python_basics/integration_tests/MODULE.bazel +++ b/python_basics/integration_tests/MODULE.bazel @@ -16,7 +16,7 @@ # Python version & Pip # ############################################################################### -bazel_dep(name = "rules_python", version = "1.4.1") +bazel_dep(name = "rules_python", version = "1.8.4") PYTHON_VERSION = "3.12" @@ -45,7 +45,7 @@ use_repo(pip, "pip_score_venv_test") # Generic linting and formatting rules # ############################################################################### -bazel_dep(name = "aspect_rules_py", version = "1.4.0") +bazel_dep(name = "aspect_rules_py", version = "1.6.6") bazel_dep(name = "bazel_skylib", version = "1.7.1", dev_dependency = True) diff --git a/python_basics/integration_tests/simple-tests/BUILD b/python_basics/integration_tests/simple-tests/BUILD index cb3db11..1029413 100644 --- a/python_basics/integration_tests/simple-tests/BUILD +++ b/python_basics/integration_tests/simple-tests/BUILD @@ -20,7 +20,6 @@ score_virtualenv( score_py_pytest( name = "venv_ok_test", srcs = ["test_venv_ok.py"], - data = [":basic_venv"], ) score_py_pytest( diff --git a/python_basics/integration_tests/simple-tests/test_venv_ok.py b/python_basics/integration_tests/simple-tests/test_venv_ok.py index 92d6dcc..ae9de27 100644 --- a/python_basics/integration_tests/simple-tests/test_venv_ok.py +++ b/python_basics/integration_tests/simple-tests/test_venv_ok.py @@ -13,10 +13,16 @@ import os import subprocess from pathlib import Path +from python.runfiles import Runfiles def test_venv_ok(): - runfiles = os.getenv("RUNFILES_DIR") + """ + This test checks if the pytest module is available in the runfiles and if it can be used without + installing pytest explicitly inside the virtualenv + """ + if (r := Runfiles.Create()) and (rd := r.EnvVars().get("RUNFILES_DIR")): + runfiles = Path(rd) assert runfiles, "runfiles could not be found, RUNFILES_DIR is not set" packages = os.listdir(runfiles) assert any(x.endswith("pytest") for x in packages), ( @@ -26,7 +32,6 @@ def test_venv_ok(): import pytest # type ignore python_venv_folder = [x for x in packages if "python_3_12_" in x][0] - # Trying to actually use pytest module and collect current test & file proc = subprocess.run( [ diff --git a/python_basics/integration_tests/venv-with-extra-requirements/test_extra_requirements_ok.py b/python_basics/integration_tests/venv-with-extra-requirements/test_extra_requirements_ok.py index f479e87..752c1c5 100644 --- a/python_basics/integration_tests/venv-with-extra-requirements/test_extra_requirements_ok.py +++ b/python_basics/integration_tests/venv-with-extra-requirements/test_extra_requirements_ok.py @@ -11,10 +11,13 @@ # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* import os +from python.runfiles import Runfiles +from pathlib import Path def test_venv_ok(): - runfiles = os.getenv("RUNFILES_DIR") + if (r := Runfiles.Create()) and (rd := r.EnvVars().get("RUNFILES_DIR")): + runfiles = Path(rd) packages = os.listdir(runfiles) assert any(x.endswith("requests") for x in packages), ( f"'Request not found in runfiles: {runfiles}" From 5b9a806a6afc7fc6612fc830977421ac25165e5b Mon Sep 17 00:00:00 2001 From: MaximilianSoerenPollak Date: Wed, 18 Feb 2026 12:06:18 +0100 Subject: [PATCH 03/11] Fix formatter screw up --- .github/workflows/tests.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d3461f8..7c11820 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,7 +10,12 @@ jobs: uses: actions/checkout@v4.2.2 - name: Run python_basics integration tests shell: bash - run: "cd python_basics/integration_tests \n# Have to create the virtualenv as it's a run command. Otherwise basic_venv is just build and won't be able\n# To execute what we need in the simple-tests.\nbazel run //simple-tests:basic_venv\nbazel test //...\n" + run: | + cd python_basics/integration_tests + # Have to create the virtualenv as it's a run command. Otherwise basic_venv is just build and won't be able + # To execute what we need in the simple-tests. + bazel run //simple-tests:basic_venv + bazel test //... - name: Run starpls integration tests run: | cd starpls/integration_tests From 249eb5d978af99930ec4da8c8ceab4dbfba7a5f6 Mon Sep 17 00:00:00 2001 From: MaximilianSoerenPollak Date: Wed, 18 Feb 2026 13:18:56 +0100 Subject: [PATCH 04/11] Add runfiles & fix comment placement --- .github/workflows/tests.yml | 5 ++--- .yamlfmt | 3 +++ python_basics/integration_tests/simple-tests/BUILD | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 .yamlfmt diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7c11820..38dd568 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,11 +9,10 @@ jobs: - name: Checkout repository uses: actions/checkout@v4.2.2 - name: Run python_basics integration tests - shell: bash + # Have to create the virtualenv as it's a run command. Otherwise basic_venv is just build and won't be able + # To execute what we need in the simple-tests. run: | cd python_basics/integration_tests - # Have to create the virtualenv as it's a run command. Otherwise basic_venv is just build and won't be able - # To execute what we need in the simple-tests. bazel run //simple-tests:basic_venv bazel test //... - name: Run starpls integration tests diff --git a/.yamlfmt b/.yamlfmt new file mode 100644 index 0000000..e9d24f9 --- /dev/null +++ b/.yamlfmt @@ -0,0 +1,3 @@ +formatter: + type: basic + retain_line_breaks: true diff --git a/python_basics/integration_tests/simple-tests/BUILD b/python_basics/integration_tests/simple-tests/BUILD index 1029413..8d34928 100644 --- a/python_basics/integration_tests/simple-tests/BUILD +++ b/python_basics/integration_tests/simple-tests/BUILD @@ -20,6 +20,7 @@ score_virtualenv( score_py_pytest( name = "venv_ok_test", srcs = ["test_venv_ok.py"], + deps = ["@rules_python//python/runfiles"], ) score_py_pytest( From cc03d84140ce3123efcb6721bd55df7f4183a3a8 Mon Sep 17 00:00:00 2001 From: MaximilianSoerenPollak Date: Wed, 18 Feb 2026 13:22:49 +0100 Subject: [PATCH 05/11] fix whitespace --- .github/workflows/tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 38dd568..6a9d72a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,10 +11,10 @@ jobs: - name: Run python_basics integration tests # Have to create the virtualenv as it's a run command. Otherwise basic_venv is just build and won't be able # To execute what we need in the simple-tests. - run: | - cd python_basics/integration_tests - bazel run //simple-tests:basic_venv - bazel test //... + run: | + cd python_basics/integration_tests + bazel test //... + bazel run //simple-tests:basic_venv - name: Run starpls integration tests run: | cd starpls/integration_tests From 68e329a6688c56bbc7a4895ca8e6c7cb32c7eb0f Mon Sep 17 00:00:00 2001 From: MaximilianSoerenPollak Date: Wed, 18 Feb 2026 13:24:58 +0100 Subject: [PATCH 06/11] Fix order of commands --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6a9d72a..36f9532 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,8 +13,8 @@ jobs: # To execute what we need in the simple-tests. run: | cd python_basics/integration_tests - bazel test //... bazel run //simple-tests:basic_venv + bazel test //... - name: Run starpls integration tests run: | cd starpls/integration_tests From ffc875cd7fd7b46f28cf960b670852e777f9215f Mon Sep 17 00:00:00 2001 From: MaximilianSoerenPollak Date: Wed, 18 Feb 2026 13:28:26 +0100 Subject: [PATCH 07/11] Missing data --- python_basics/integration_tests/simple-tests/BUILD | 1 + 1 file changed, 1 insertion(+) diff --git a/python_basics/integration_tests/simple-tests/BUILD b/python_basics/integration_tests/simple-tests/BUILD index 8d34928..aadc1c1 100644 --- a/python_basics/integration_tests/simple-tests/BUILD +++ b/python_basics/integration_tests/simple-tests/BUILD @@ -21,6 +21,7 @@ score_py_pytest( name = "venv_ok_test", srcs = ["test_venv_ok.py"], deps = ["@rules_python//python/runfiles"], + data = [":basic_venv"], ) score_py_pytest( From 07e385d964e4dc04100a31890a1b641c3c55d8bd Mon Sep 17 00:00:00 2001 From: MaximilianSoerenPollak Date: Wed, 18 Feb 2026 13:41:16 +0100 Subject: [PATCH 08/11] Fix formatting --- .github/workflows/tests.yml | 3 +-- python_basics/integration_tests/simple-tests/BUILD | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 36f9532..47d7f54 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,8 +13,7 @@ jobs: # To execute what we need in the simple-tests. run: | cd python_basics/integration_tests - bazel run //simple-tests:basic_venv - bazel test //... + bazel run //simple-tests:basic_venv && bazel test //... - name: Run starpls integration tests run: | cd starpls/integration_tests diff --git a/python_basics/integration_tests/simple-tests/BUILD b/python_basics/integration_tests/simple-tests/BUILD index aadc1c1..0554737 100644 --- a/python_basics/integration_tests/simple-tests/BUILD +++ b/python_basics/integration_tests/simple-tests/BUILD @@ -20,8 +20,8 @@ score_virtualenv( score_py_pytest( name = "venv_ok_test", srcs = ["test_venv_ok.py"], - deps = ["@rules_python//python/runfiles"], data = [":basic_venv"], + deps = ["@rules_python//python/runfiles"], ) score_py_pytest( From 095e3e1ed9f2d99d9c070a33207634cb50611030 Mon Sep 17 00:00:00 2001 From: MaximilianSoerenPollak Date: Wed, 18 Feb 2026 14:07:08 +0100 Subject: [PATCH 09/11] Fixing tests? --- python_basics/integration_tests/simple-tests/test_venv_ok.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_basics/integration_tests/simple-tests/test_venv_ok.py b/python_basics/integration_tests/simple-tests/test_venv_ok.py index ae9de27..6259af5 100644 --- a/python_basics/integration_tests/simple-tests/test_venv_ok.py +++ b/python_basics/integration_tests/simple-tests/test_venv_ok.py @@ -31,7 +31,7 @@ def test_venv_ok(): try: import pytest # type ignore - python_venv_folder = [x for x in packages if "python_3_12_" in x][0] + python_venv_folder = Path([x for x in packages if "python_3_12_" in x][0]).resolve() # Trying to actually use pytest module and collect current test & file proc = subprocess.run( [ From 095dcf5329470e070152cbb2d10df880e8f050bb Mon Sep 17 00:00:00 2001 From: MaximilianSoerenPollak Date: Wed, 18 Feb 2026 14:16:21 +0100 Subject: [PATCH 10/11] WIP --- python_basics/integration_tests/simple-tests/test_venv_ok.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_basics/integration_tests/simple-tests/test_venv_ok.py b/python_basics/integration_tests/simple-tests/test_venv_ok.py index 6259af5..ae9de27 100644 --- a/python_basics/integration_tests/simple-tests/test_venv_ok.py +++ b/python_basics/integration_tests/simple-tests/test_venv_ok.py @@ -31,7 +31,7 @@ def test_venv_ok(): try: import pytest # type ignore - python_venv_folder = Path([x for x in packages if "python_3_12_" in x][0]).resolve() + python_venv_folder = [x for x in packages if "python_3_12_" in x][0] # Trying to actually use pytest module and collect current test & file proc = subprocess.run( [ From 165f63587e708599931c61f55357f23ca0707dac Mon Sep 17 00:00:00 2001 From: MaximilianSoerenPollak Date: Wed, 18 Feb 2026 14:30:44 +0100 Subject: [PATCH 11/11] Split command --- .github/workflows/tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 47d7f54..36f9532 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,8 @@ jobs: # To execute what we need in the simple-tests. run: | cd python_basics/integration_tests - bazel run //simple-tests:basic_venv && bazel test //... + bazel run //simple-tests:basic_venv + bazel test //... - name: Run starpls integration tests run: | cd starpls/integration_tests