Skip to content

Commit

Permalink
Fix version.py so pip_package works (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
wwwillchen authored Apr 24, 2024
1 parent 0b54af7 commit d642364
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
8 changes: 7 additions & 1 deletion mesop/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ py_library(
],
visibility = ["//build_defs:mesop_users"],
deps = [
"//mesop/pip_package:version",
":version",
# REF(//scripts/scaffold_component.py):insert_component_import
"//mesop/components/embed:py",
"//mesop/components/table:py",
Expand Down Expand Up @@ -50,6 +50,12 @@ py_library(
],
)

py_library(
name = "version",
srcs = ["version.py"],
visibility = ["//build_defs:mesop_internal"],
)

py_library(
name = "example_index",
srcs = ["example_index.py"],
Expand Down
2 changes: 1 addition & 1 deletion mesop/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@
)
from mesop.features import page as page
from mesop.key import Key as Key
from mesop.pip_package.version import VERSION
from mesop.runtime import runtime
from mesop.server.colab_run import colab_run as colab_run
from mesop.server.wsgi_app import wsgi_app
from mesop.version import VERSION

__version__ = VERSION

Expand Down
12 changes: 1 addition & 11 deletions mesop/pip_package/BUILD
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
# Description:
# Tools for building the Mesop pip package.
load("//build_defs:defaults.bzl", "py_binary", "py_library")

package(
default_visibility = ["//build_defs:mesop_internal"],
)

licenses(["notice"])

py_library(
name = "version",
srcs = ["version.py"],
visibility = ["//build_defs:mesop_internal"],
)

sh_binary(
name = "build_pip_package",
srcs = ["build_pip_package.sh"],
Expand All @@ -24,9 +14,9 @@ sh_binary(
"requirements.txt",
"setup.cfg",
"setup.py",
"version.py",
":deterministic_tar_gz",
"//mesop", # Main Mesop target
"//mesop:version.py",
"//mesop/bin", # CLI binary
"//mesop/labs", # Mesop labs target
],
Expand Down
6 changes: 5 additions & 1 deletion mesop/pip_package/build_pip_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ build() (
mv -f "mesop/pip_package/requirements.txt" .
mv -f "mesop/pip_package/setup.cfg" .
mv -f "mesop/pip_package/setup.py" .
mv -f "mesop/pip_package/version.py" .
# version.py is copied because it's used in two ways:
# 1) used by ./setup.py (see note how it must be imported without
# depending on the rest of mesop package)
# 2) used by mesop/__init__.py as a constant in the public API
cp "mesop/version.py" .
rm -rf "mesop/pip_package"

rm -f mesop/mesop # bazel py_binary sh wrapper
Expand Down
File renamed without changes.

0 comments on commit d642364

Please sign in to comment.