6 changed files with 54 additions and 0 deletions
@ -0,0 +1 @@ |
|||||
|
run --incompatible_use_python_toolchains=false --python_top=//:python38 |
||||
@ -0,0 +1,6 @@ |
|||||
|
*.swp |
||||
|
|
||||
|
bazel-bazel* |
||||
|
bazel-bin* |
||||
|
bazel-out* |
||||
|
bazel-testlogs* |
||||
@ -0,0 +1,17 @@ |
|||||
|
load("@rules_python//python:defs.bzl", "py_binary") |
||||
|
load("@my_deps//:requirements.bzl", "requirement") |
||||
|
|
||||
|
py_runtime( |
||||
|
name = "python38", |
||||
|
interpreter_path = "/usr/local/bin/python3.8", |
||||
|
) |
||||
|
|
||||
|
py_binary( |
||||
|
name = "main", |
||||
|
srcs = ["main.py"], |
||||
|
srcs_version = "PY3", |
||||
|
deps = [ |
||||
|
requirement("pyyaml"), |
||||
|
requirement("flask"), |
||||
|
], |
||||
|
) |
||||
@ -0,0 +1,13 @@ |
|||||
|
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") |
||||
|
|
||||
|
http_archive( |
||||
|
name = "rules_python", |
||||
|
url = "https://github.com/bazelbuild/rules_python/releases/download/0.2.0/rules_python-0.2.0.tar.gz", |
||||
|
sha256 = "778197e26c5fbeb07ac2a2c5ae405b30f6cb7ad1f5510ea6fdac03bded96cc6f", |
||||
|
) |
||||
|
|
||||
|
load("@rules_python//python:pip.bzl", "pip_install") |
||||
|
pip_install( |
||||
|
name = "my_deps", |
||||
|
requirements = "//:requirements.txt", |
||||
|
) |
||||
@ -0,0 +1,15 @@ |
|||||
|
import os |
||||
|
import sys |
||||
|
|
||||
|
import flask |
||||
|
import yaml |
||||
|
|
||||
|
|
||||
|
def main(): |
||||
|
print("hello from {}".format(os.getcwd())) |
||||
|
print("version: {}".format(sys.version)) |
||||
|
print("interpreter: {}".format(sys.executable)) |
||||
|
|
||||
|
|
||||
|
if __name__ == "__main__": |
||||
|
main() |
||||
@ -0,0 +1,2 @@ |
|||||
|
pyyaml |
||||
|
flask |
||||
Loading…
Reference in new issue