-
Notifications
You must be signed in to change notification settings - Fork 650
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
SDK namespace package #55
Changes from all commits
de56e3e
10a69b6
e7fe15f
5965d98
31952de
de39649
8827a38
2b527fb
3d29bb1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,15 +16,14 @@ | |
import setuptools | ||
|
||
BASE_DIR = os.path.dirname(__file__) | ||
VERSION_FILENAME = os.path.join( | ||
BASE_DIR, "src", "opentelemetry", "internal", "version.py") | ||
VERSION_FILENAME = os.path.join(BASE_DIR, "src", "opentelemetry", "version.py") | ||
PACKAGE_INFO = {} | ||
with open(VERSION_FILENAME) as f: | ||
exec(f.read(), PACKAGE_INFO) #pylint:disable=exec-used | ||
exec(f.read(), PACKAGE_INFO) | ||
|
||
setuptools.setup( | ||
name="opentelemetry-api", | ||
version=PACKAGE_INFO["__version__"], # noqa | ||
version=PACKAGE_INFO["__version__"], | ||
author="OpenTelemetry Authors", | ||
author_email="[email protected]", | ||
classifiers=[ | ||
|
@@ -47,7 +46,8 @@ | |
extras_require={}, | ||
license="Apache-2.0", | ||
package_dir={"": "src"}, | ||
packages=setuptools.find_namespace_packages(where="src"), | ||
packages=setuptools.find_namespace_packages(where="src", | ||
include="opentelemetry.*"), | ||
url=("https://github.com/open-telemetry/opentelemetry-python" | ||
"/tree/master/opentelemetry-api"), | ||
zip_safe=False, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,15 +15,16 @@ | |
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) | ||
BASE_DIR = os.path.dirname(__file__) | ||
VERSION_FILENAME = os.path.join(BASE_DIR, "src", "opentelemetry", "sdk", | ||
"version.py") | ||
PACKAGE_INFO = {} | ||
with open(VERSION_FILENAME) as f: | ||
exec(f.read(), PACKAGE_INFO) | ||
|
||
setuptools.setup( | ||
name="opentelemetry-sdk", | ||
version=package_info["__version__"], # noqa | ||
version=PACKAGE_INFO["__version__"], | ||
author="OpenTelemetry Authors", | ||
author_email="[email protected]", | ||
classifiers=[ | ||
|
@@ -41,11 +42,14 @@ | |
include_package_data=True, | ||
long_description=open("README.rst").read(), | ||
install_requires=[ | ||
"opentelemetry-api==0.1.dev0" | ||
], | ||
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", | ||
packages=setuptools.find_namespace_packages(where="src", | ||
include="opentelemetry.sdk.*"), | ||
url=("https://github.com/open-telemetry/opentelemetry-python" | ||
"/tree/master/opentelemetry-sdk"), | ||
zip_safe=False, | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# 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. | ||
|
||
from opentelemetry import trace as trace_api | ||
|
||
|
||
class Tracer(trace_api.Tracer): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# 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 unittest | ||
|
||
from opentelemetry import trace as trace_api | ||
from opentelemetry.sdk import trace | ||
|
||
|
||
class TestTracer(unittest.TestCase): | ||
|
||
def test_extends_api(self): | ||
tracer = trace.Tracer() | ||
self.assertIsInstance(tracer, trace_api.Tracer) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tox] | ||
skipsdist = True | ||
envlist = py{34,35,36,37}-test, lint, py37-mypy, docs | ||
envlist = py{34,35,36,37}-test-{api,sdk}, lint, py37-mypy, docs | ||
|
||
[travis] | ||
python = | ||
|
@@ -11,24 +11,32 @@ deps = | |
mypy: mypy~=0.711 | ||
|
||
setenv = | ||
PYTHONPATH={toxinidir}/opentelemetry-api/src/ | ||
mypy: MYPYPATH={env:PYTHONPATH} | ||
mypy: MYPYPATH={toxinidir}/opentelemetry-api/src/ | ||
|
||
changedir = | ||
test: opentelemetry-api/tests | ||
test-api: opentelemetry-api/tests | ||
test-sdk: opentelemetry-sdk/tests | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We may not want separate test targets in the long run, but this was the easiest way to get test discovery to work since There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We want to remove |
||
|
||
commands_pre = | ||
test-api: pip install -e {toxinidir}/opentelemetry-api | ||
test-sdk: pip install -e {toxinidir}/opentelemetry-api | ||
test-sdk: pip install -e {toxinidir}/opentelemetry-sdk | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be better to install these as regular deps so they're not reinstalled on each run. There may be another better way to do this. |
||
|
||
commands = | ||
py37-mypy: mypy opentelemetry-api/src/opentelemetry/ | ||
mypy: mypy --namespace-packages opentelemetry-api/src/opentelemetry/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See python/mypy#1645, mypy fails to find |
||
; For test code, we don't want to enforce the full mypy strictness | ||
py37-mypy: mypy --config-file=mypy-relaxed.ini opentelemetry-api/tests/ opentelemetry-api/setup.py | ||
test: python -m unittest discover | ||
mypy: mypy --namespace-packages --config-file=mypy-relaxed.ini opentelemetry-api/tests/ | ||
test-{api,sdk}: python -m unittest discover | ||
|
||
[testenv:lint] | ||
deps = | ||
pylint~=2.3 | ||
flake8~=3.7 | ||
isort~=4.3 | ||
|
||
commands_pre = | ||
pip install -e {toxinidir}/opentelemetry-api | ||
|
||
commands = | ||
; Prefer putting everything in one pylint command to profit from duplication | ||
; warnings. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting
PYTHONPATH
instead of installing the package was a kludge. It may be possible to get mypy to pass without settingMYPYPATH
here, but just installing the packages didn't seem to do it.