Comments (3)
Minimal example
Directory structure
WORKSPACE
foo/
BUILD
foo/
__init__.py
lib.py
main.py
Contents
WORKSPACE
:
git_repository(
name = "subpar",
remote = "https://github.com/google/subpar",
tag = "1.0.0",
)
foo/BUILD
:
load("@subpar//:subpar.bzl", "par_binary")
py_library(
name = "foo",
srcs = ["foo/lib.py"],
imports = ["."],
)
par_binary(
name = "foo_main",
srcs = ["foo/main.py"],
main = "foo/main.py",
deps = [
":foo",
],
)
foo/foo/__init__.py
: empty
foo/foo/lib.py
:
x = 123
foo/foo/main.py
:
from foo.lib import x
print "x = %d" % x
Result
➤ bazel run //foo:foo_main.par
.................
INFO: Analysed target //foo:foo_main.par (11 packages loaded).
INFO: Found 1 target...
Target //foo:foo_main.par up-to-date:
bazel-bin/foo/foo_main.par
INFO: Elapsed time: 3.884s, Critical Path: 0.27s
INFO: Build completed successfully, 15 total actions
INFO: Running command line: bazel-bin/foo/foo_main.par
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File ".../.cache/bazel/.../execroot/__main__/bazel-out/local-fastbuild/bin/foo/foo_main.par/__main__.py", line 6, in <module>
ImportError: No module named lib
ERROR: Non-zero return code '1' from command: Process exited with status 1
from subpar.
Currently blocked on bazel: bazelbuild/bazel#2617
from subpar.
Actually, in this case, it should work, but my brittle workaround is finding the wrong foo
first. I should be able to reorder the heuristic.
from subpar.
Related Issues (20)
- Fix tests to use proper select() for python version
- Tests fail for centos7 configuration
- Tests may fail when run via `bazel test` HOT 1
- Incompatible search for main files
- Development Best Practices HOT 1
- bazel 0.27.1 deprecated API usages
- Move subpar to the bazelbuild org HOT 1
- Conflicting package names HOT 1
- CODEOWNERS HOT 1
- cython modules import fails when running par file HOT 1
- Why is the generated dpkg_parser having a #!/usr/bin/python3 shebang? HOT 1
- Flag --incompatible_no_implicit_file_export will break Subpar in Bazel 1.2.1
- Flag --incompatible_no_implicit_file_export will break Subpar in a future Bazel release
- [Documentation] Should README setup example use http_archive rather than git_repository? HOT 1
- Running `bazel-bin/*.par ` has ModuleNotFoundError: No module named issue
- Support hermetically built python interperters
- Python cannot run Subpars larger than 2GiB because they are Zip64 formatted.
- Subpar is failing on Bazel CI since the upgrade to Ubuntu 20.04 HOT 1
- Migration guide for existing subpar users now that it is "unmaintained and considered deprecated"?
- Build fails with bazel 0.25 --incompatible_use_python_toolchains HOT 19
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from subpar.