Skip to content

Commit 772ac6e

Browse files
authored
Componentize the remaining integration extensions (census-instrumentation#535)
* componentize django and pyramid ext * migrate docs * componentize pymysql extension * polish nox.py * fix Django system test * fix typo * revert nox.py * avoid using the latest version of Django to unblock system test * componentize dbapi, mysql, pymysql * componentize postgresql and sqlalchemy extensions * fix typo * fix config integration * suppress lint warning * fix space
1 parent d37b6d2 commit 772ac6e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+799
-87
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
## Unreleased
4+
5+
- Initial version.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
OpenCensus Database API Integration
2+
============================================================================
3+
4+
Installation
5+
------------
6+
7+
::
8+
9+
pip install opencensus-ext-dbapi
10+
11+
Usage
12+
-----
13+
14+
.. code:: python
15+
16+
# TBD
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__path__ = __import__('pkgutil').extend_path(__path__, __name__)

opencensus/trace/ext/dbapi/__init__.py renamed to contrib/opencensus-ext-dbapi/opencensus/ext/dbapi/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from opencensus.trace.ext.dbapi import trace
15+
from opencensus.ext.dbapi import trace
1616

1717
__all__ = ['trace']
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[bdist_wheel]
2+
universal = 1
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Copyright 2019, OpenCensus Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from setuptools import find_packages
16+
from setuptools import setup
17+
from version import __version__
18+
19+
setup(
20+
name='opencensus-ext-dbapi',
21+
version=__version__, # noqa
22+
author='OpenCensus Authors',
23+
author_email='census-developers@googlegroups.com',
24+
classifiers=[
25+
'Intended Audience :: Developers',
26+
'Development Status :: 3 - Alpha',
27+
'Intended Audience :: Developers',
28+
'License :: OSI Approved :: Apache Software License',
29+
'Programming Language :: Python',
30+
'Programming Language :: Python :: 2',
31+
'Programming Language :: Python :: 2.7',
32+
'Programming Language :: Python :: 3',
33+
'Programming Language :: Python :: 3.4',
34+
'Programming Language :: Python :: 3.5',
35+
'Programming Language :: Python :: 3.6',
36+
'Programming Language :: Python :: 3.7',
37+
],
38+
description='OpenCensus Database API Integration',
39+
include_package_data=True,
40+
long_description=open('README.rst').read(),
41+
install_requires=[
42+
'opencensus >= 0.2.dev0, < 1.0.0',
43+
],
44+
extras_require={},
45+
license='Apache-2.0',
46+
packages=find_packages(exclude=('tests',)),
47+
namespace_packages=[],
48+
url='https://github.com/census-instrumentation/opencensus-python/tree/master/contrib/opencensus-ext-dbapi',
49+
zip_safe=False,
50+
)

tests/unit/trace/ext/dbapi/test_dbapi_trace.py renamed to contrib/opencensus-ext-dbapi/tests/test_dbapi_trace.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import mock
1818

19-
from opencensus.trace.ext.dbapi import trace
19+
from opencensus.ext.dbapi import trace
2020

2121

2222
class TestDBAPITrace(unittest.TestCase):
@@ -36,7 +36,7 @@ def mock_wrap(func):
3636
wrapped = trace.wrap_conn(mock_func)
3737

3838
patch_wrap = mock.patch(
39-
'opencensus.trace.ext.dbapi.trace.wrap_cursor',
39+
'opencensus.ext.dbapi.trace.wrap_cursor',
4040
side_effect=mock_wrap)
4141

4242
with patch_wrap:
@@ -65,7 +65,7 @@ def mock_trace_cursor_query(func):
6565
wrapped = trace.wrap_cursor(mock_func)
6666

6767
patch_wrap = mock.patch(
68-
'opencensus.trace.ext.dbapi.trace.trace_cursor_query',
68+
'opencensus.ext.dbapi.trace.trace_cursor_query',
6969
side_effect=mock_trace_cursor_query)
7070

7171
with patch_wrap:
@@ -85,7 +85,7 @@ def test_trace_cursor_query(self):
8585
mock_cursor = mock.Mock()
8686

8787
patch = mock.patch(
88-
'opencensus.trace.ext.dbapi.trace.execution_context.'
88+
'opencensus.ext.dbapi.trace.execution_context.'
8989
'get_opencensus_tracer',
9090
return_value=mock_tracer)
9191

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2019, OpenCensus Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
__version__ = '0.1.dev0'

0 commit comments

Comments
 (0)