-
Notifications
You must be signed in to change notification settings - Fork 124
Bazel rules py #3542
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
base: master
Are you sure you want to change the base?
Bazel rules py #3542
Changes from all commits
33c20b5
d251d7f
7e66688
75f220e
3911d26
98a4131
bff3e51
45fd8cd
4d48707
d462dec
0d4b3b2
d8ba7be
496a037
3c269af
9fce33a
ee7630e
911dc36
ceb6f6b
598a193
83a2178
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,8 @@ | ||
| ansible-lint==25.8.1 | ||
| pyqtgraph==0.13.7 | ||
| thefuzz==0.19.0 | ||
| iterfzf==0.5.0.20.0 | ||
| python-Levenshtein==0.25.1 | ||
| psutil==5.9.0 | ||
| PyOpenGL==3.1.6 | ||
| ruff==0.5.5 | ||
| pyqt-toast-notification==1.3.2 | ||
| md-toc==9.0.0 | ||
| grpcio-tools==1.71.0 | ||
| python-Levenshtein==0.25.1 | ||
| typer==0.21.0 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| load("@aspect_rules_py//py:defs.bzl", "py_binary", "py_library") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should you be loading
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think for consistency you are probably correct. I would also assume that if I don't explicitly load it, it uses the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As a matter of fact, I believe that once this rule has been loaded, it will use aspect_build in every single BUILD file. This is shown by other BUILD files not compiling when the necessary libraries aren't explicitly listed as |
||
| load("@rules_python//python:pip.bzl", "compile_pip_requirements") | ||
| load("@thunderscope_deps//:requirements.bzl", "requirement") | ||
|
|
||
|
|
@@ -13,6 +14,11 @@ compile_pip_requirements( | |
| py_binary( | ||
| name = "thunderscope_main", | ||
| srcs = ["thunderscope_main.py"], | ||
| env = { | ||
| "LD_LIBRARY_PATH": "../.thunderscope_main.venv/lib/python3.12/site-packages/PyQt6/Qt6/lib", | ||
| "QTWEBENGINEPROCESS_PATH": "../.thunderscope_main.venv/lib/python3.12/site-packages/PyQt6/Qt6/libexec/QtWebEngineProcess", | ||
| }, | ||
|
Comment on lines
+17
to
+20
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You may want to consider setting these environment variables in Python at runtime so you don't have to copy this for every # PyQt6 bundles Qt as native shared libraries and helper binaries that are not
# discoverable when running under Bazel's sandboxed environment. In particular,
# the dynamic linker cannot find Qt's .so files and QtWebEngine cannot locate its
# QtWebEngineProcess helper unless explicitly told where they live.
# Since the aspect_rules_py virtual env lives in the runfiles tree and its
# location is only known at runtime, we derive these paths from $VIRTUAL_ENV
# here and set the required env vars before importing PyQt6.
qt_path = (
Path(os.environ["VIRTUAL_ENV"])
/ "lib"
/ f"python{sys.version_info.major}.{sys.version_info.minor}"
/ "site-packages"
/ "PyQt6"
/ "Qt6"
)
os.environ["LD_LIBRARY_PATH"] = str(qt_path / "lib")
os.environ["QTWEBENGINEPROCESS_PATH"] = str(qt_path / "libexec" / "QtWebEngineProcess")
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems to work fine as is, without needing to copy paste this to every |
||
| package_collisions = "warning", | ||
| deps = [ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Who is managing this virtual environment? Is it bazel?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I believe it is Bazel by way of the |
||
| ":config", | ||
| ":constants", | ||
|
|
@@ -49,6 +55,7 @@ py_library( | |
| "//software/thunderscope/binary_context_managers:game_controller", | ||
| "//software/thunderscope/binary_context_managers:simulator", | ||
| "//software/thunderscope/binary_context_managers:tigers_autoref", | ||
| requirement("pyqt6"), | ||
| requirement("numpy"), | ||
| requirement("pyqtdarktheme-fork"), | ||
| requirement("pyqtgraph"), | ||
|
|
@@ -152,6 +159,7 @@ py_library( | |
| srcs = ["constants.py"], | ||
| deps = [ | ||
| requirement("protobuf"), | ||
| requirement("pyopengl"), | ||
| ], | ||
| ) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am guessing these will contaminate the dependency tree?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are installations of pyqt6 into the local computer, which we no longer need. I think I need to write an additional line to uninstall an existing version of pyqt6 as well so it doesn't contaminate the tree.