-
Notifications
You must be signed in to change notification settings - Fork 126
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 15 commits
33c20b5
d251d7f
7e66688
75f220e
3911d26
98a4131
bff3e51
45fd8cd
4d48707
d462dec
0d4b3b2
d8ba7be
496a037
3c269af
9fce33a
60dccaa
2b224f2
7a73635
3a91378
842d7e3
731ec60
a41aec9
7ed95d0
efe25a0
cb674ea
e915c23
7a3f4e8
25a0f4c
07d5516
62a7f78
89722ab
9e098f4
4cc5231
262e624
393529d
ae47094
6578f8b
9a36e98
20e12bb
be34578
d0943a5
16f5eb5
3c157f8
5931f6e
09ab4c1
80931ce
7250020
360b38a
fe2b300
a162536
fb02402
508ed15
4f954ea
83642d6
c853653
9943b2d
0f54fc0
f1ccef6
4986061
ba6a5c5
83cf748
a773816
6d743a5
7b2c9c4
e3d0212
a21f4be
4785cea
f3cf788
cfe8d7d
bae5841
2abda82
19128e9
c0eb846
215d563
cd54709
c70b781
1e12fcb
f94903f
9f8a6af
c74ae05
01f218a
2428f59
26d2580
6afef23
8ead9dd
badca35
7d13953
42ed44c
1b6a325
0b00e9e
22feff0
cd307b4
05d1769
ee7630e
911dc36
ceb6f6b
598a193
83a2178
360444b
2a57425
01a4f7b
2fa0204
9f34377
ad2cbb2
7954d84
11b5073
30d0867
27f4819
e82b5c1
071faec
3956145
b763504
f7a4338
ee1ec48
202b636
ddd292e
ca87cec
aeb7b12
69fc9ef
e220493
9330895
790c07a
9068629
b513192
b9ac748
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,11 +1,7 @@ | ||
| 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 |
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") | ||
|
|
||
|
|
@@ -12,6 +13,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", | ||
| }, | ||
|
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", | ||
|
|
@@ -47,6 +53,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"), | ||
|
|
@@ -150,6 +157,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.