Repository: open-telemetry/opentelemetry-python

Issue:
B3 propagator must be distributed as a separate package
As per spec, the propagators must be distributed as separate packages:

>The official list of propagators that MUST be maintained by the OpenTelemetry organization and MUST be distributed as OpenTelemetry extension packages

https://github.com/open-telemetry/opentelemetry-specification/blob/2ebefc181a99dc79bbb4b1d3e85e20b240a5f26f/specification/context/api-propagators.md#propagators-distribution


Discussion:

Resolving patch:
diff --git a/propagator/opentelemetry-propagator-b3/setup.py b/propagator/opentelemetry-propagator-b3/setup.py
new file mode 100644
--- /dev/null
+++ b/propagator/opentelemetry-propagator-b3/setup.py
@@ -0,0 +1,26 @@
+# Copyright The OpenTelemetry Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+import os
+
+import setuptools
+
+BASE_DIR = os.path.dirname(__file__)
+VERSION_FILENAME = os.path.join(
+    BASE_DIR, "src", "opentelemetry", "propagators", "b3", "version.py"
+)
+PACKAGE_INFO = {}
+with open(VERSION_FILENAME) as f:
+    exec(f.read(), PACKAGE_INFO)
+
+setuptools.setup(version=PACKAGE_INFO["__version__"])
diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/trace/propagation/b3_format.py b/propagator/opentelemetry-propagator-b3/src/opentelemetry/propagators/b3/__init__.py
similarity index 100%
rename from opentelemetry-sdk/src/opentelemetry/sdk/trace/propagation/b3_format.py
rename to propagator/opentelemetry-propagator-b3/src/opentelemetry/propagators/b3/__init__.py
diff --git a/propagator/opentelemetry-propagator-b3/src/opentelemetry/propagators/b3/version.py b/propagator/opentelemetry-propagator-b3/src/opentelemetry/propagators/b3/version.py
new file mode 100644
--- /dev/null
+++ b/propagator/opentelemetry-propagator-b3/src/opentelemetry/propagators/b3/version.py
@@ -0,0 +1,15 @@
+# Copyright The OpenTelemetry Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+__version__ = "0.17.dev0"


Test patch:
diff --git a/propagator/opentelemetry-propagator-b3/tests/__init__.py b/propagator/opentelemetry-propagator-b3/tests/__init__.py
new file mode 100644
--- /dev/null
+++ b/propagator/opentelemetry-propagator-b3/tests/__init__.py
@@ -0,0 +1,13 @@
+# Copyright The OpenTelemetry Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
diff --git a/opentelemetry-sdk/tests/trace/propagation/test_b3_format.py b/propagator/opentelemetry-propagator-b3/tests/test_b3_format.py
similarity index 99%
rename from opentelemetry-sdk/tests/trace/propagation/test_b3_format.py
rename to propagator/opentelemetry-propagator-b3/tests/test_b3_format.py
--- a/opentelemetry-sdk/tests/trace/propagation/test_b3_format.py
+++ b/propagator/opentelemetry-propagator-b3/tests/test_b3_format.py
@@ -15,9 +15,9 @@
 import unittest
 from unittest.mock import Mock, patch
 
+import opentelemetry.propagators.b3 as b3_format  # pylint: disable=no-name-in-module,import-error
 import opentelemetry.sdk.trace as trace
 import opentelemetry.sdk.trace.ids_generator as ids_generator
-import opentelemetry.sdk.trace.propagation.b3_format as b3_format
 import opentelemetry.trace as trace_api
 from opentelemetry.context import get_current
 from opentelemetry.trace.propagation.textmap import DictGetter