Skip to content

Commit fe3a7b8

Browse files
authored
infra: Add starpls and basedpyright (#14)
* infra: Add starpls and basedpyright * fix: Fix formatting Added tools starpls and basepyright from bazelregistry. Signed-off-by: Nicolae Dicu <[email protected]>
1 parent 2fcb43a commit fe3a7b8

File tree

5 files changed

+44
-1
lines changed

5 files changed

+44
-1
lines changed

.vscode/extensions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,8 @@
1414

1515
// Linting and formatting for Python (LSP via ruff server)
1616
"charliermarsh.ruff",
17+
18+
// BasedPyright for python various type checking improvements and pylance features
19+
"detachhead.basedpyright",
1720
]
1821
}

.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@
5252
]
5353
},
5454

55+
"bazel.lsp.command": "bazel",
56+
"bazel.lsp.args": [
57+
"run",
58+
"//:starpls_server"
59+
],
5560

5661
// RST Settings
5762
"[restructuredtext]": {

BUILD

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,21 @@
1313
load("@score_cr_checker//:cr_checker.bzl", "copyright_checker")
1414
load("@score_dash_license_checker//:dash.bzl", "dash_license_checker")
1515
load("@score_format_checker//:macros.bzl", "use_format_targets")
16+
load("@score_python_basics//:defs.bzl", "score_virtualenv")
17+
load("@score_starpls_lsp//:starpls.bzl", "setup_starpls")
1618
load("//:project_config.bzl", "PROJECT_CONFIG")
1719

20+
setup_starpls(
21+
name = "starpls_server",
22+
visibility = ["//visibility:public"],
23+
)
24+
25+
score_virtualenv(
26+
name = "ide_support",
27+
reqs = [],
28+
venv_name = ".venv",
29+
)
30+
1831
copyright_checker(
1932
name = "copyright",
2033
srcs = [

MODULE.bazel

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ module(
1515
version = "1.0",
1616
)
1717

18+
bazel_dep(name = "rules_python", version = "1.0.0")
19+
20+
PYTHON_VERSION = "3.12"
21+
22+
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
23+
python.toolchain(
24+
is_default = True,
25+
python_version = PYTHON_VERSION,
26+
)
27+
use_repo(python)
28+
1829
# Add GoogleTest dependency
1930
bazel_dep(name = "googletest", version = "1.14.0")
2031

@@ -23,6 +34,8 @@ bazel_dep(name = "rules_rust", version = "0.56.0")
2334

2435
# Checker rule for CopyRight checks/fixs
2536
bazel_dep(name = "score_cr_checker", version = "0.2.2")
37+
bazel_dep(name = "score_python_basics", version = "0.3.0")
38+
bazel_dep(name = "score_starpls_lsp", version = "0.1.0")
2639

2740
# C/C++ rules for Bazel
2841
bazel_dep(name = "rules_cc", version = "0.1.1")
@@ -44,6 +57,6 @@ register_toolchains("@llvm_toolchain//:all")
4457
bazel_dep(name = "score_dash_license_checker", version = "0.1.1")
4558

4659
# Format checker
47-
bazel_dep(name = "score_format_checker", version = "0.1.0")
60+
bazel_dep(name = "score_format_checker", version = "0.1.1")
4861
bazel_dep(name = "aspect_rules_lint", version = "1.0.3")
4962
bazel_dep(name = "buildifier_prebuilt", version = "7.3.1")

pyproject.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[tool.basedpyright]
2+
extends = "bazel-bin/ide_support.runfiles/score_python_basics~/pyproject.toml"
3+
verboseOutput = true
4+
5+
exclude = [
6+
"**/__pycache__",
7+
"**/.*",
8+
"**/bazel-*",
9+
]

0 commit comments

Comments
 (0)