Merge pull request #16235 from a-musing-moose/master

adding python version environmental markers in the new style
diff --git a/examples/csharp/HelloworldXamarin/README.md b/examples/csharp/HelloworldXamarin/README.md
index 4394dcc..e47855d 100644
--- a/examples/csharp/HelloworldXamarin/README.md
+++ b/examples/csharp/HelloworldXamarin/README.md
@@ -8,27 +8,29 @@
 been officially released and is only available via the [daily builds](https://packages.grpc.io/)
 source.
 
+HINT: To download the package, please manually download the latest `.nupkg` packages from "Daily Builds" in [packages.grpc.io](https://packages.grpc.io/) into a local directory. Then add a nuget source that points to that directory (That can be [done in Visual Studio](https://docs.microsoft.com/en-us/nuget/tools/package-manager-ui#package-sources) or Visual Studio for Mac via "Configure nuget sources"). After that, nuget will also explore that directory when looking for packages.
+
 BACKGROUND
 -------------
-The example project supports Xamarin.Android and Xamarin.iOS
+The example project supports `Xamarin.Android` and `Xamarin.iOS`.
 
 For this sample, we've already generated the server and client stubs from [helloworld.proto][].
 
 PREREQUISITES
 -------------
 
-- The latest version Xamarin Studio or Visual Studio 2017 with Xamarin support installed.
+- The latest version Visual Studio 2017 or Visual Studio for Mac with Xamarin support installed.
 
 BUILD
 -------
 
-- Open the `HelloworldXamarin.sln` in Visual Studio (or Xamarin Studio)
+- Open the `HelloworldXamarin.sln` in Visual Studio (or Visual Studio for Mac)
 - Build the solution (Build -> Build All)
 
 Try it!
 -------
 
-You can deploy the example apps directly through Xamarin Studio IDE.
+You can deploy the example apps directly through Visual Studio IDE.
 Deployments can target both Android and iOS (both support physical device
 deployment as well as simulator).
 
diff --git a/src/python/grpcio/grpc/BUILD.bazel b/src/python/grpcio/grpc/BUILD.bazel
new file mode 100644
index 0000000..3f214bf
--- /dev/null
+++ b/src/python/grpcio/grpc/BUILD.bazel
@@ -0,0 +1,82 @@
+load("@grpc_python_dependencies//:requirements.bzl", "requirement")
+
+package(default_visibility = ["//visibility:public"])
+
+py_binary(
+    name = "grpcio",
+    srcs = ["__init__.py"],
+    deps = [
+        ":utilities",
+        ":auth",
+        ":plugin_wrapping",
+        ":channel",
+        ":interceptor",
+        ":server",
+        "//src/python/grpcio/grpc/_cython:cygrpc",
+        "//src/python/grpcio/grpc/beta",
+        "//src/python/grpcio/grpc/experimental",
+        "//src/python/grpcio/grpc/framework",
+        requirement('enum34'),
+        requirement('six'),
+    ],
+    data = [
+        "//:grpc",
+    ],
+    main = "__init__.py",
+    imports = ["../",],
+)
+
+py_library(
+    name = "auth",
+    srcs = ["_auth.py"],
+)
+
+py_library(
+    name = "channel",
+    srcs = ["_channel.py"],
+    deps = [
+        ":common",
+        ":grpcio_metadata",
+    ],
+)
+
+py_library(
+    name = "common",
+    srcs = ["_common.py"],
+)
+
+py_library(
+    name = "grpcio_metadata",
+    srcs = ["_grpcio_metadata.py"],
+)
+
+py_library(
+    name = "interceptor",
+    srcs = ["_interceptor.py"],
+)
+
+py_library(
+    name = "plugin_wrapping",
+    srcs = ["_plugin_wrapping.py"],
+    deps = [
+        ":common",
+    ]
+)
+
+py_library(
+    name = "server",
+    srcs = ["_server.py"],
+    deps = [
+        ":common",
+        ":interceptor",
+    ],
+)
+
+py_library(
+    name = "utilities",
+    srcs = ["_utilities.py"],
+    deps = [
+        ":common",
+    ],
+)
+
diff --git a/src/python/grpcio/grpc/_cython/BUILD.bazel b/src/python/grpcio/grpc/_cython/BUILD.bazel
new file mode 100644
index 0000000..7124e83
--- /dev/null
+++ b/src/python/grpcio/grpc/_cython/BUILD.bazel
@@ -0,0 +1,46 @@
+package(default_visibility = ["//visibility:public"])
+
+load("//bazel:cython_library.bzl", "pyx_library")
+
+pyx_library(
+    name = "cygrpc",
+    srcs = [
+        "__init__.py",
+        "cygrpc.pxd",
+        "cygrpc.pyx",
+        "_cygrpc/grpc_string.pyx.pxi",
+        "_cygrpc/arguments.pyx.pxi",
+        "_cygrpc/call.pyx.pxi",
+        "_cygrpc/channel.pyx.pxi",
+        "_cygrpc/credentials.pyx.pxi",
+        "_cygrpc/completion_queue.pyx.pxi",
+        "_cygrpc/event.pyx.pxi",
+        "_cygrpc/metadata.pyx.pxi",
+        "_cygrpc/operation.pyx.pxi",
+        "_cygrpc/records.pyx.pxi",
+        "_cygrpc/security.pyx.pxi",
+        "_cygrpc/server.pyx.pxi",
+        "_cygrpc/tag.pyx.pxi",
+        "_cygrpc/time.pyx.pxi",
+        "_cygrpc/grpc_gevent.pyx.pxi",
+        "_cygrpc/grpc.pxi",
+        "_cygrpc/arguments.pxd.pxi",
+        "_cygrpc/call.pxd.pxi",
+        "_cygrpc/channel.pxd.pxi",
+        "_cygrpc/credentials.pxd.pxi",
+        "_cygrpc/completion_queue.pxd.pxi",
+        "_cygrpc/event.pxd.pxi",
+        "_cygrpc/metadata.pxd.pxi",
+        "_cygrpc/operation.pxd.pxi",
+        "_cygrpc/records.pxd.pxi",
+        "_cygrpc/security.pxd.pxi",
+        "_cygrpc/server.pxd.pxi",
+        "_cygrpc/tag.pxd.pxi",
+        "_cygrpc/time.pxd.pxi",
+        "_cygrpc/grpc_gevent.pxd.pxi",
+    ],
+    deps = [
+       "//:grpc",
+    ],
+)
+
diff --git a/src/python/grpcio/grpc/beta/BUILD.bazel b/src/python/grpcio/grpc/beta/BUILD.bazel
new file mode 100644
index 0000000..731be5c
--- /dev/null
+++ b/src/python/grpcio/grpc/beta/BUILD.bazel
@@ -0,0 +1,58 @@
+load("@grpc_python_dependencies//:requirements.bzl", "requirement")
+package(default_visibility = ["//visibility:public"])
+
+py_library(
+    name = "beta",
+    srcs = ["__init__.py",],
+    deps = [
+        ":client_adaptations",
+        ":metadata",
+        ":server_adaptations",
+        ":implementations",
+        ":interfaces",
+        ":utilities",
+    ],
+)
+
+py_library(
+    name = "client_adaptations",
+    srcs = ["_client_adaptations.py"],
+    imports=["../../",]
+)
+
+py_library(
+    name = "metadata",
+    srcs = ["_metadata.py"],
+)
+
+py_library(
+    name = "server_adaptations",
+    srcs = ["_server_adaptations.py"],
+    imports=["../../",],
+)
+
+py_library(
+    name = "implementations",
+    srcs = ["implementations.py"],
+    imports=["../../",],
+)
+
+py_library(
+    name = "interfaces",
+    srcs = ["interfaces.py"],
+    deps = [
+        requirement("six"),
+    ],
+    imports=["../../",],
+)
+
+py_library(
+    name = "utilities",
+    srcs = ["utilities.py"],
+    deps = [
+        ":implementations",
+        ":interfaces",
+        "//src/python/grpcio/grpc/framework/foundation",
+    ],
+)
+
diff --git a/src/python/grpcio/grpc/experimental/BUILD.bazel b/src/python/grpcio/grpc/experimental/BUILD.bazel
new file mode 100644
index 0000000..6598d02
--- /dev/null
+++ b/src/python/grpcio/grpc/experimental/BUILD.bazel
@@ -0,0 +1,27 @@
+load("@grpc_python_dependencies//:requirements.bzl", "requirement")
+package(default_visibility = ["//visibility:public"])
+
+py_library(
+    name = "experimental",
+    srcs = ["__init__.py",],
+    deps = [
+        ":gevent",
+        ":session_cache",
+    ],
+)
+
+py_library(
+    name = "gevent",
+    srcs = ["gevent.py"],
+    deps = [
+        "//src/python/grpcio/grpc/_cython:cygrpc",
+    ],
+)
+
+py_library(
+    name = "session_cache",
+    srcs = ["session_cache.py"],
+    deps = [
+        "//src/python/grpcio/grpc/_cython:cygrpc",
+    ],
+)
diff --git a/src/python/grpcio/grpc/framework/BUILD.bazel b/src/python/grpcio/grpc/framework/BUILD.bazel
new file mode 100644
index 0000000..55b4f4d
--- /dev/null
+++ b/src/python/grpcio/grpc/framework/BUILD.bazel
@@ -0,0 +1,11 @@
+package(default_visibility = ["//visibility:public"])
+
+py_library(
+    name = "framework",
+    srcs = ["__init__.py",],
+    deps = [
+        "//src/python/grpcio/grpc/framework/common",
+        "//src/python/grpcio/grpc/framework/foundation",
+        "//src/python/grpcio/grpc/framework/interfaces",
+    ],
+)
diff --git a/src/python/grpcio/grpc/framework/common/BUILD.bazel b/src/python/grpcio/grpc/framework/common/BUILD.bazel
new file mode 100644
index 0000000..9d9ef68
--- /dev/null
+++ b/src/python/grpcio/grpc/framework/common/BUILD.bazel
@@ -0,0 +1,27 @@
+load("@grpc_python_dependencies//:requirements.bzl", "requirement")
+package(default_visibility = ["//visibility:public"])
+
+py_library(
+    name = "common",
+    srcs = ["__init__.py",],
+    deps = [
+        ":cardinality",
+        ":style",
+    ],
+)
+
+py_library(
+    name = "cardinality",
+    srcs = ["cardinality.py"],
+    deps = [
+        requirement("enum34"),
+    ],
+)
+
+py_library(
+    name = "style",
+    srcs = ["style.py"],
+    deps = [
+        requirement("enum34"),
+    ],
+)
diff --git a/src/python/grpcio/grpc/framework/foundation/BUILD.bazel b/src/python/grpcio/grpc/framework/foundation/BUILD.bazel
new file mode 100644
index 0000000..1287fdd
--- /dev/null
+++ b/src/python/grpcio/grpc/framework/foundation/BUILD.bazel
@@ -0,0 +1,61 @@
+load("@grpc_python_dependencies//:requirements.bzl", "requirement")
+package(default_visibility = ["//visibility:public"])
+
+py_library(
+    name = "foundation",
+    srcs = ["__init__.py",],
+    deps = [
+        ":abandonment",
+        ":callable_util",
+        ":future",
+        ":logging_pool",
+        ":stream_util",
+        ":stream",
+    ],
+)
+
+py_library(
+    name = "abandonment",
+    srcs = ["abandonment.py"],
+)
+
+py_library(
+    name = "callable_util",
+    srcs = ["callable_util.py"],
+    deps = [
+        requirement("enum34"),
+        requirement("six"),
+    ],
+)
+
+py_library(
+    name = "future",
+    srcs = ["future.py"],
+    deps = [
+        requirement("six"),
+    ],
+)
+
+py_library(
+    name = "logging_pool",
+    srcs = ["logging_pool.py"],
+    deps = [
+        requirement("futures"),
+    ],
+)
+
+py_library(
+    name = "stream_util",
+    srcs = ["stream_util.py"],
+    deps = [
+        ":stream",
+    ],
+)
+
+py_library(
+    name = "stream",
+    srcs = ["stream.py"],
+    deps = [
+        requirement("six"),
+    ],
+)
diff --git a/src/python/grpcio/grpc/framework/interfaces/BUILD.bazel b/src/python/grpcio/grpc/framework/interfaces/BUILD.bazel
new file mode 100644
index 0000000..b81e196
--- /dev/null
+++ b/src/python/grpcio/grpc/framework/interfaces/BUILD.bazel
@@ -0,0 +1,10 @@
+package(default_visibility = ["//visibility:public"])
+
+py_library(
+    name = "interfaces",
+    srcs = ["__init__.py",],
+    deps = [
+        "//src/python/grpcio/grpc/framework/interfaces/base",
+        "//src/python/grpcio/grpc/framework/interfaces/face",
+    ],
+)
diff --git a/src/python/grpcio/grpc/framework/interfaces/base/BUILD.bazel b/src/python/grpcio/grpc/framework/interfaces/base/BUILD.bazel
new file mode 100644
index 0000000..408a66a
--- /dev/null
+++ b/src/python/grpcio/grpc/framework/interfaces/base/BUILD.bazel
@@ -0,0 +1,29 @@
+load("@grpc_python_dependencies//:requirements.bzl", "requirement")
+package(default_visibility = ["//visibility:public"])
+
+py_library(
+    name = "base_lib",
+    srcs = ["__init__.py",],
+    deps = [
+        ":base",
+        ":utilities",
+    ],
+)
+
+py_library(
+    name = "base",
+    srcs = ["base.py"],
+    deps = [
+        "//src/python/grpcio/grpc/framework/foundation:abandonment",
+        requirement("enum34"),
+        requirement("six"),
+    ],
+)
+
+py_library(
+    name = "utilities",
+    srcs = ["utilities.py"],
+    deps = [
+        requirement("enum34"),
+    ],
+)
diff --git a/src/python/grpcio/grpc/framework/interfaces/face/BUILD.bazel b/src/python/grpcio/grpc/framework/interfaces/face/BUILD.bazel
new file mode 100644
index 0000000..e683e7c
--- /dev/null
+++ b/src/python/grpcio/grpc/framework/interfaces/face/BUILD.bazel
@@ -0,0 +1,32 @@
+load("@grpc_python_dependencies//:requirements.bzl", "requirement")
+package(default_visibility = ["//visibility:public"])
+
+py_library(
+    name = "face",
+    srcs = ["__init__.py",],
+    deps = [
+        ":face_lib",
+        ":utilities",
+    ],
+)
+
+py_library(
+    name = "face_lib",
+    srcs = ["face.py"],
+    deps = [
+        "//src/python/grpcio/grpc/framework/foundation",
+        "//src/python/grpcio/grpc/framework/common",
+        requirement("enum34"),
+        requirement("six"),
+    ],
+)
+
+py_library(
+    name = "utilities",
+    srcs = ["utilities.py"],
+    deps = [
+        "//src/python/grpcio/grpc/framework/common",
+        "//src/python/grpcio/grpc/framework/foundation:stream",
+        ":face_lib",
+    ],
+)
diff --git a/src/python/grpcio_tests/tests/unit/framework/foundation/BUILD.bazel b/src/python/grpcio_tests/tests/unit/framework/foundation/BUILD.bazel
new file mode 100644
index 0000000..d69186e
--- /dev/null
+++ b/src/python/grpcio_tests/tests/unit/framework/foundation/BUILD.bazel
@@ -0,0 +1,17 @@
+package(default_visibility = ["//visibility:public"])
+
+py_library(
+    name = "stream_testing",
+    srcs = ["stream_testing.py"],
+)
+
+py_test(
+    name = "logging_pool_test",
+    srcs = ["_logging_pool_test.py"],
+    main = "_logging_pool_test.py",
+    size = "small",
+    deps = [
+        "//src/python/grpcio/grpc:grpcio",
+    ],
+)
+
diff --git a/tools/internal_ci/linux/grpc_publish_packages.sh b/tools/internal_ci/linux/grpc_publish_packages.sh
index ef943db..1449230 100755
--- a/tools/internal_ci/linux/grpc_publish_packages.sh
+++ b/tools/internal_ci/linux/grpc_publish_packages.sh
@@ -65,6 +65,7 @@
 unzip "$INPUT_ARTIFACTS/csharp_nugets_windows_dotnetcli.zip" -d "$UNZIPPED_CSHARP_PACKAGES"
 CSHARP_PACKAGES=(
   "$UNZIPPED_CSHARP_PACKAGES"/*
+  "$INPUT_ARTIFACTS"/grpc_unity_package.[0-9]*.zip
 )
 
 # Python