Skip to content
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

set up running local jupyter server that can be connected to colab #6

Merged
merged 1 commit into from
Apr 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# xlab
# xlab
23 changes: 15 additions & 8 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ http_archive(
],
)

rules_python_external_version = "0.1.5"

http_archive(
name = "rules_python_external",
sha256 = "bc655e6d402915944e014c3b2cad23d0a97b83a66cc22f20db09c9f8da2e2789",
strip_prefix = "rules_python_external-{version}".format(version = rules_python_external_version),
url = "https://github.com/dillon-giacoppo/rules_python_external/archive/v{version}.zip".format(version = rules_python_external_version),
)

load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")

protobuf_deps()
Expand All @@ -58,15 +67,13 @@ load("@rules_python//python:repositories.bzl", "py_repositories")
py_repositories()

# Only needed if using the packaging rules.
load("@rules_python//python:pip.bzl", "pip3_import", "pip_repositories")
load("@rules_python_external//:repositories.bzl", "rules_python_external_dependencies")

pip_repositories()
rules_python_external_dependencies()

pip3_import(
name = "remote_deps",
load("@rules_python_external//:defs.bzl", "pip_install")

pip_install(
name = "py_deps",
requirements = "//:requirements.txt",
)

load("@remote_deps//:requirements.bzl", "pip_install")

pip_install()
6 changes: 6 additions & 0 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
absl-py>=0.9.0
jupyter_http_over_ws==0.0.8
notebook>=6.0.0
pandas==1.0.1
protobuf==3.11.3
requests==2.23.0
65 changes: 61 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,61 @@
absl-py>=0.9.0
pandas==1.0.1
protobuf==3.11.3
requests==2.23.0
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile requirements.in
#
absl-py==0.9.0 # via -r requirements.in
appnope==0.1.0 # via ipykernel, ipython
attrs==19.3.0 # via jsonschema
backcall==0.1.0 # via ipython
bleach==3.1.4 # via nbconvert
certifi==2020.4.5.1 # via requests
chardet==3.0.4 # via requests
decorator==4.4.2 # via ipython, traitlets
defusedxml==0.6.0 # via nbconvert
entrypoints==0.3 # via nbconvert
idna==2.9 # via requests
importlib-metadata==1.6.0 # via jsonschema
ipykernel==5.2.1 # via notebook
ipython-genutils==0.2.0 # via nbformat, notebook, traitlets
ipython==7.13.0 # via ipykernel
jedi==0.17.0 # via ipython
jinja2==2.11.2 # via nbconvert, notebook
jsonschema==3.2.0 # via nbformat
jupyter-client==6.1.3 # via ipykernel, notebook
jupyter-core==4.6.3 # via jupyter-client, nbconvert, nbformat, notebook
jupyter_http_over_ws==0.0.8 # via -r requirements.in
markupsafe==1.1.1 # via jinja2
mistune==0.8.4 # via nbconvert
nbconvert==5.6.1 # via notebook
nbformat==5.0.6 # via nbconvert, notebook
notebook==6.0.3 # via -r requirements.in, jupyter-http-over-ws
numpy==1.18.3 # via pandas
pandas==1.0.1 # via -r requirements.in
pandocfilters==1.4.2 # via nbconvert
parso==0.7.0 # via jedi
pexpect==4.8.0 # via ipython
pickleshare==0.7.5 # via ipython
prometheus-client==0.7.1 # via notebook
prompt-toolkit==3.0.5 # via ipython
protobuf==3.11.3 # via -r requirements.in
ptyprocess==0.6.0 # via pexpect, terminado
pygments==2.6.1 # via ipython, nbconvert
pyrsistent==0.16.0 # via jsonschema
python-dateutil==2.8.1 # via jupyter-client, pandas
pytz==2019.3 # via pandas
pyzmq==19.0.0 # via jupyter-client, notebook
requests==2.23.0 # via -r requirements.in
send2trash==1.5.0 # via notebook
six==1.14.0 # via absl-py, bleach, jsonschema, jupyter-http-over-ws, protobuf, pyrsistent, python-dateutil, traitlets
terminado==0.8.3 # via notebook
testpath==0.4.4 # via nbconvert
tornado==6.0.4 # via ipykernel, jupyter-client, jupyter-http-over-ws, notebook, terminado
traitlets==4.3.3 # via ipykernel, ipython, jupyter-client, jupyter-core, nbconvert, nbformat, notebook
urllib3==1.25.9 # via requests
wcwidth==0.1.9 # via prompt-toolkit
webencodings==0.5.1 # via bleach
zipp==3.1.0 # via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# setuptools
24 changes: 24 additions & 0 deletions xlab/colab/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
load("@rules_python//python:defs.bzl", "py_binary", "py_library")
load("@py_deps//:requirements.bzl", "requirement")

package(default_visibility = ["//xlab:internal"])

py_binary(
name = "start_local_runtime",
srcs = ["start_local_runtime.py"],
srcs_version = "PY3",
deps = [
":notebook_deps",
requirement("jupyter_http_over_ws"),
requirement("notebook"),
],
)

py_library(
name = "notebook_deps",
srcs_version = "PY3",
deps = [
"//xlab/data/providers:iex",
"//xlab/util/status:errors",
],
)
3 changes: 3 additions & 0 deletions xlab/colab/start_local_runtime.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from notebook.notebookapp import main

main()
5 changes: 5 additions & 0 deletions xlab/colab/start_local_runtime.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# https://research.google.com/colaboratory/local-runtimes.html
bazel run //xlab/colab:start_local_runtime -- \
--NotebookApp.allow_origin='https://colab.research.google.com' \
--port=8888 \
--NotebookApp.port_retries=0
2 changes: 1 addition & 1 deletion xlab/data/providers/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@rules_python//python:defs.bzl", "py_library", "py_test")
load("@remote_deps//:requirements.bzl", "requirement")
load("@py_deps//:requirements.bzl", "requirement")

package(default_visibility = ["//xlab:internal"])

Expand Down
2 changes: 1 addition & 1 deletion xlab/data/scripts/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@rules_python//python:defs.bzl", "py_binary")
load("@remote_deps//:requirements.bzl", "requirement")
load("@py_deps//:requirements.bzl", "requirement")

package(default_visibility = ["//xlab:internal"])

Expand Down
2 changes: 1 addition & 1 deletion xlab/data/store/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@rules_python//python:defs.bzl", "py_library", "py_test")
load("@remote_deps//:requirements.bzl", "requirement")
load("@py_deps//:requirements.bzl", "requirement")

package(default_visibility = ["//xlab:internal"])

Expand Down
2 changes: 1 addition & 1 deletion xlab/data/store/in_memory/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@rules_python//python:defs.bzl", "py_library", "py_test")
load("@remote_deps//:requirements.bzl", "requirement")
load("@py_deps//:requirements.bzl", "requirement")

package(default_visibility = ["//xlab:internal"])

Expand Down
2 changes: 1 addition & 1 deletion xlab/data/store/textproto/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@rules_python//python:defs.bzl", "py_library", "py_test")
load("@remote_deps//:requirements.bzl", "requirement")
load("@py_deps//:requirements.bzl", "requirement")

package(default_visibility = ["//xlab:internal"])

Expand Down
2 changes: 1 addition & 1 deletion xlab/net/http/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@rules_python//python:defs.bzl", "py_library")
load("@remote_deps//:requirements.bzl", "requirement")
load("@py_deps//:requirements.bzl", "requirement")

package(default_visibility = ["//xlab:internal"])

Expand Down
2 changes: 1 addition & 1 deletion xlab/net/proto/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@rules_python//python:defs.bzl", "py_library")
load("@remote_deps//:requirements.bzl", "requirement")
load("@py_deps//:requirements.bzl", "requirement")

package(default_visibility = ["//xlab:internal"])

Expand Down
2 changes: 1 addition & 1 deletion xlab/util/status/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@rules_python//python:defs.bzl", "py_library", "py_test")
load("@com_github_grpc_grpc//bazel:python_rules.bzl", "py_proto_library")
load("@remote_deps//:requirements.bzl", "requirement")
load("@py_deps//:requirements.bzl", "requirement")

package(default_visibility = ["//xlab:internal"])

Expand Down