Skip to content

Commit

Permalink
Revert API subpackage move
Browse files Browse the repository at this point in the history
  • Loading branch information
c24t committed Jul 17, 2019
1 parent 8827a38 commit 2b527fb
Show file tree
Hide file tree
Showing 18 changed files with 27 additions and 48 deletions.
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ abstract types for OpenTelemetry implementations.
:maxdepth: 1
:caption: Contents:

opentelemetry.api.trace
opentelemetry.api.loader
opentelemetry.trace
opentelemetry.loader


Indices and tables
Expand Down
4 changes: 0 additions & 4 deletions docs/opentelemetry.api.loader.rst

This file was deleted.

4 changes: 0 additions & 4 deletions docs/opentelemetry.api.trace.rst

This file was deleted.

4 changes: 4 additions & 0 deletions docs/opentelemetry.loader.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
opentelemetry.loader module
===========================

.. automodule:: opentelemetry.loader
4 changes: 4 additions & 0 deletions docs/opentelemetry.trace.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
opentelemetry.trace package
===========================

.. automodule:: opentelemetry.trace
5 changes: 2 additions & 3 deletions opentelemetry-api/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
import setuptools

BASE_DIR = os.path.dirname(__file__)
VERSION_FILENAME = os.path.join(BASE_DIR, "src", "opentelemetry", "api",
"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)
Expand Down Expand Up @@ -48,7 +47,7 @@
license="Apache-2.0",
package_dir={"": "src"},
packages=setuptools.find_namespace_packages(where="src",
include="opentelemetry.api.*"),
include="opentelemetry.*"),
url=("https://github.com/open-telemetry/opentelemetry-python"
"/tree/master/opentelemetry-api"),
zip_safe=False,
Expand Down
19 changes: 0 additions & 19 deletions opentelemetry-api/src/opentelemetry/api/__init__.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

"""
The OpenTelemetry loader module is mainly used internally to load the
implementation for global objects like :func:`opentelemetry.api.trace.tracer`.
implementation for global objects like :func:`opentelemetry.trace.tracer`.
.. _loader-factory:
Expand All @@ -27,9 +27,9 @@ def my_factory_for_t(api_type: typing.Type[T]) -> typing.Optional[T]:
That function is called with e.g., the type of the global object it should
create as an argument (e.g. the type object
:class:`opentelemetry.api.trace.Tracer`) and should return an instance of that
type (such that ``instanceof(my_factory_for_t(T), T)`` is true). Alternatively,
it may return ``None`` to indicate that the no-op default should be used.
:class:`opentelemetry.trace.Tracer`) and should return an instance of that type
(such that ``instanceof(my_factory_for_t(T), T)`` is true). Alternatively, it
may return ``None`` to indicate that the no-op default should be used.
When loading an implementation, the following algorithm is used to find a
factory function or other means to create the global object:
Expand All @@ -43,9 +43,9 @@ def my_factory_for_t(api_type: typing.Type[T]) -> typing.Optional[T]:
variable ``OPENTELEMETRY_PYTHON_IMPLEMENTATION_DEFAULT``.
3. Otherwise, if a :samp:`set_preferred_{<type>}_implementation` was
called (e.g.
:func:`opentelemetry.api.trace.set_preferred_tracer_implementation`),
the callback set there is used (that is, the environment variables
override the callback set in code).
:func:`opentelemetry.trace.set_preferred_tracer_implementation`), the
callback set there is used (that is, the environment variables override
the callback set in code).
4. Otherwise, if :func:`set_preferred_default_implementation` was called,
the callback set there is used.
5. Otherwise, an attempt is made to import and use the OpenTelemetry SDK.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
from contextlib import contextmanager
import typing

from opentelemetry.api import loader
from opentelemetry import loader


class Span:
Expand Down Expand Up @@ -328,7 +328,7 @@ def set_preferred_tracer_implementation(
) -> None:
"""Set the factory to be used to create the tracer.
See :mod:`opentelemetry.api.loader` for details.
See :mod:`opentelemetry.loader` for details.
This function may not be called after a tracer is already loaded.
Expand Down
4 changes: 2 additions & 2 deletions opentelemetry-api/tests/test_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import sys
import unittest

from opentelemetry.api import loader
from opentelemetry.api import trace
from opentelemetry import loader
from opentelemetry import trace

DUMMY_TRACER = None

Expand Down
5 changes: 2 additions & 3 deletions opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from opentelemetry import api
from opentelemetry import trace as trace_api


class Tracer(api.trace.Tracer):
class Tracer(trace_api.Tracer):
pass

4 changes: 2 additions & 2 deletions opentelemetry-sdk/tests/trace/test_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@

import unittest

from opentelemetry import api
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, api.trace.Tracer)
self.assertIsInstance(tracer, trace_api.Tracer)

0 comments on commit 2b527fb

Please sign in to comment.