From 20d02a4fae5c6bad5aa04b978012ee89525b6712 Mon Sep 17 00:00:00 2001 From: Reiley Yang Date: Thu, 27 Jun 2019 14:29:39 -0700 Subject: [PATCH 1/3] improve package layout --- opentelemetry-api/setup.py | 5 +- .../opentelemetry/context}/__init__.py | 0 .../distributedcontext}/__init__.py | 0 .../opentelemetry/internal/__init__.py | 0 .../opentelemetry/internal/version.py | 0 .../opentelemetry/logs}/__init__.py | 0 .../opentelemetry/metrics}/__init__.py | 0 .../opentelemetry/resources}/__init__.py | 0 .../{ => src}/opentelemetry/trace/__init__.py | 0 opentelemetry-sdk/CHANGELOG.md | 4 ++ opentelemetry-sdk/README.rst | 19 +++++++ opentelemetry-sdk/setup.py | 51 +++++++++++++++++++ .../src/opentelemetry/sdk}/__init__.py | 2 + .../src/opentelemetry/sdk/version.py | 15 ++++++ 14 files changed, 94 insertions(+), 2 deletions(-) rename opentelemetry-api/{opentelemetry => src/opentelemetry/context}/__init__.py (100%) rename opentelemetry-api/{opentelemetry/context => src/opentelemetry/distributedcontext}/__init__.py (100%) rename opentelemetry-api/{ => src}/opentelemetry/internal/__init__.py (100%) rename opentelemetry-api/{ => src}/opentelemetry/internal/version.py (100%) rename opentelemetry-api/{opentelemetry/distributedcontext => src/opentelemetry/logs}/__init__.py (100%) rename opentelemetry-api/{opentelemetry/logs => src/opentelemetry/metrics}/__init__.py (100%) rename opentelemetry-api/{opentelemetry/metrics => src/opentelemetry/resources}/__init__.py (100%) rename opentelemetry-api/{ => src}/opentelemetry/trace/__init__.py (100%) create mode 100644 opentelemetry-sdk/CHANGELOG.md create mode 100644 opentelemetry-sdk/README.rst create mode 100644 opentelemetry-sdk/setup.py rename {opentelemetry-api/opentelemetry/resources => opentelemetry-sdk/src/opentelemetry/sdk}/__init__.py (94%) create mode 100644 opentelemetry-sdk/src/opentelemetry/sdk/version.py diff --git a/opentelemetry-api/setup.py b/opentelemetry-api/setup.py index 460417304ff..de97ec88c14 100644 --- a/opentelemetry-api/setup.py +++ b/opentelemetry-api/setup.py @@ -18,7 +18,7 @@ base_dir = os.path.dirname(__file__) package_info = {} -with open(os.path.join(base_dir, "opentelemetry", "internal", "version.py")) as f: +with open(os.path.join(base_dir, "src", "opentelemetry", "internal", "version.py")) as f: exec(f.read(), package_info) setuptools.setup( @@ -45,7 +45,8 @@ ], extras_require={}, license="Apache-2.0", - packages=setuptools.find_namespace_packages(include=["opentelemetry.*"]), + package_dir={"": "src"}, + packages=setuptools.find_namespace_packages(where="src"), url="https://github.com/open-telemetry/opentelemetry-python/tree/master/opentelemetry-api", zip_safe=False, ) diff --git a/opentelemetry-api/opentelemetry/__init__.py b/opentelemetry-api/src/opentelemetry/context/__init__.py similarity index 100% rename from opentelemetry-api/opentelemetry/__init__.py rename to opentelemetry-api/src/opentelemetry/context/__init__.py diff --git a/opentelemetry-api/opentelemetry/context/__init__.py b/opentelemetry-api/src/opentelemetry/distributedcontext/__init__.py similarity index 100% rename from opentelemetry-api/opentelemetry/context/__init__.py rename to opentelemetry-api/src/opentelemetry/distributedcontext/__init__.py diff --git a/opentelemetry-api/opentelemetry/internal/__init__.py b/opentelemetry-api/src/opentelemetry/internal/__init__.py similarity index 100% rename from opentelemetry-api/opentelemetry/internal/__init__.py rename to opentelemetry-api/src/opentelemetry/internal/__init__.py diff --git a/opentelemetry-api/opentelemetry/internal/version.py b/opentelemetry-api/src/opentelemetry/internal/version.py similarity index 100% rename from opentelemetry-api/opentelemetry/internal/version.py rename to opentelemetry-api/src/opentelemetry/internal/version.py diff --git a/opentelemetry-api/opentelemetry/distributedcontext/__init__.py b/opentelemetry-api/src/opentelemetry/logs/__init__.py similarity index 100% rename from opentelemetry-api/opentelemetry/distributedcontext/__init__.py rename to opentelemetry-api/src/opentelemetry/logs/__init__.py diff --git a/opentelemetry-api/opentelemetry/logs/__init__.py b/opentelemetry-api/src/opentelemetry/metrics/__init__.py similarity index 100% rename from opentelemetry-api/opentelemetry/logs/__init__.py rename to opentelemetry-api/src/opentelemetry/metrics/__init__.py diff --git a/opentelemetry-api/opentelemetry/metrics/__init__.py b/opentelemetry-api/src/opentelemetry/resources/__init__.py similarity index 100% rename from opentelemetry-api/opentelemetry/metrics/__init__.py rename to opentelemetry-api/src/opentelemetry/resources/__init__.py diff --git a/opentelemetry-api/opentelemetry/trace/__init__.py b/opentelemetry-api/src/opentelemetry/trace/__init__.py similarity index 100% rename from opentelemetry-api/opentelemetry/trace/__init__.py rename to opentelemetry-api/src/opentelemetry/trace/__init__.py diff --git a/opentelemetry-sdk/CHANGELOG.md b/opentelemetry-sdk/CHANGELOG.md new file mode 100644 index 00000000000..09e4c38c763 --- /dev/null +++ b/opentelemetry-sdk/CHANGELOG.md @@ -0,0 +1,4 @@ +# Changelog + +## Unreleased +- Initial release diff --git a/opentelemetry-sdk/README.rst b/opentelemetry-sdk/README.rst new file mode 100644 index 00000000000..e2bc0f6a72a --- /dev/null +++ b/opentelemetry-sdk/README.rst @@ -0,0 +1,19 @@ +OpenTelemetry Python SDK +============================================================================ + +|pypi| + +.. |pypi| image:: https://badge.fury.io/py/opentelemetry-sdk.svg + :target: https://pypi.org/project/opentelemetry-sdk/ + +Installation +------------ + +:: + + pip install opentelemetry-sdk + +References +---------- + +* `OpenTelemetry Project `_ diff --git a/opentelemetry-sdk/setup.py b/opentelemetry-sdk/setup.py new file mode 100644 index 00000000000..b95fecb27a9 --- /dev/null +++ b/opentelemetry-sdk/setup.py @@ -0,0 +1,51 @@ +# Copyright 2019, 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__) + +package_info = {} +with open(os.path.join(base_dir, "src", "opentelemetry", "sdk", "version.py")) as f: + exec(f.read(), package_info) + +setuptools.setup( + name="opentelemetry-sdk", + version=package_info["__version__"], # noqa + author="OpenTelemetry Authors", + author_email="cncf-opentelemetry-contributors@lists.cncf.io", + classifiers=[ + "Development Status :: 3 - Alpha", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + ], + description="OpenTelemetry Python SDK", + include_package_data=True, + long_description=open("README.rst").read(), + install_requires=[ + ], + extras_require={}, + license="Apache-2.0", + package_dir={"": "src"}, + packages=setuptools.find_namespace_packages(where="src"), + url="https://github.com/open-telemetry/opentelemetry-python/tree/master/opentelemetry-sdk", + zip_safe=False, +) diff --git a/opentelemetry-api/opentelemetry/resources/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/__init__.py similarity index 94% rename from opentelemetry-api/opentelemetry/resources/__init__.py rename to opentelemetry-sdk/src/opentelemetry/sdk/__init__.py index d853a7bcf65..2d52388da33 100644 --- a/opentelemetry-api/opentelemetry/resources/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/__init__.py @@ -11,3 +11,5 @@ # 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. + +from .version import __version__ diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/version.py b/opentelemetry-sdk/src/opentelemetry/sdk/version.py new file mode 100644 index 00000000000..a457c2b6651 --- /dev/null +++ b/opentelemetry-sdk/src/opentelemetry/sdk/version.py @@ -0,0 +1,15 @@ +# Copyright 2019, 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.1.dev0" From 333b9374d01743df5d74b5f805ee1abc0b7a9940 Mon Sep 17 00:00:00 2001 From: Reiley Yang Date: Thu, 27 Jun 2019 18:02:34 -0700 Subject: [PATCH 2/3] update lint path --- tox.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index aa70cf3b3ec..7fdf9032a1e 100644 --- a/tox.ini +++ b/tox.ini @@ -8,5 +8,5 @@ deps = py37-mypy: mypy commands = - py37-lint: pylint opentelemetry-api/opentelemetry/ - py37-mypy: mypy opentelemetry-api/opentelemetry/ + py37-lint: pylint opentelemetry-api/src/opentelemetry/ + py37-mypy: mypy opentelemetry-api/src/opentelemetry/ From dd69d37a60bd810d7041144616aa53dfc99d7e5c Mon Sep 17 00:00:00 2001 From: Reiley Yang Date: Thu, 27 Jun 2019 18:46:11 -0700 Subject: [PATCH 3/3] workaround pylint first, will need to remove opentelemetry/__init__.py eventually --- opentelemetry-api/src/opentelemetry/__init__.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 opentelemetry-api/src/opentelemetry/__init__.py diff --git a/opentelemetry-api/src/opentelemetry/__init__.py b/opentelemetry-api/src/opentelemetry/__init__.py new file mode 100644 index 00000000000..d853a7bcf65 --- /dev/null +++ b/opentelemetry-api/src/opentelemetry/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2019, 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.