From d7da2faa45ffb9845c6a662d406460cdcbc617e0 Mon Sep 17 00:00:00 2001 From: Angela Li Date: Mon, 4 Dec 2017 17:45:07 -0800 Subject: [PATCH 1/4] Restructure the package --- trace/.coveragerc => .coveragerc | 0 README.rst | 20 ++-- docs/requirements.txt | 2 +- docs/trace/usage.rst | 20 ++-- nox.py | 94 ++++++++++++++- {trace/opencensus => opencensus}/__init__.py | 0 .../trace/__init__.py | 0 .../trace/attributes_helper.py | 0 .../trace/config_integration.py | 0 .../opencensus => opencensus}/trace/enums.py | 0 .../trace/execution_context.py | 0 .../trace/exporters/__init__.py | 0 .../trace/exporters/base.py | 0 .../trace/exporters/file_exporter.py | 0 .../trace/exporters/logging_exporter.py | 0 .../trace/exporters/print_exporter.py | 0 .../trace/exporters/stackdriver_exporter.py | 0 .../trace/exporters/transports/__init__.py | 0 .../exporters/transports/background_thread.py | 0 .../trace/exporters/transports/base.py | 0 .../trace/exporters/transports/sync.py | 0 .../trace/exporters/zipkin_exporter.py | 0 .../trace/ext/__init__.py | 0 .../trace/ext/dbapi/__init__.py | 0 .../trace/ext/dbapi/trace.py | 0 .../trace/ext/django/__init__.py | 0 .../trace/ext/django/config.py | 0 .../trace/ext/django/middleware.py | 0 .../trace/ext/flask/__init__.py | 0 .../trace/ext/flask/flask_middleware.py | 0 .../trace/ext/mysql/__init__.py | 0 .../trace/ext/mysql/trace.py | 0 .../trace/ext/postgresql/__init__.py | 0 .../trace/ext/postgresql/trace.py | 0 .../trace/ext/pymysql/__init__.py | 0 .../trace/ext/pymysql/trace.py | 0 .../trace/ext/requests/__init__.py | 0 .../trace/ext/requests/trace.py | 0 .../trace/ext/sqlalchemy/__init__.py | 0 .../trace/ext/sqlalchemy/trace.py | 0 .../trace/ext/utils.py | 0 .../trace/propagation/__init__.py | 0 .../trace/propagation/binary_format.py | 0 .../trace/propagation/google_cloud_format.py | 0 .../trace/propagation/text_format.py | 0 .../trace_context_http_header_format.py | 0 .../trace/request_tracer.py | 0 .../trace/samplers/__init__.py | 0 .../trace/samplers/always_off.py | 0 .../trace/samplers/always_on.py | 0 .../trace/samplers/base.py | 0 .../trace/samplers/probability.py | 0 .../opencensus => opencensus}/trace/span.py | 0 .../trace/span_context.py | 0 .../trace/trace_options.py | 0 .../trace/tracer/__init__.py | 0 .../trace/tracer/base.py | 0 .../trace/tracer/context_tracer.py | 0 .../trace/tracer/noop_tracer.py | 0 .../trace/tracer/webapp2_tracer.py | 0 ...irements-test.txt => requirements-test.txt | 0 setup.py | 16 +-- {trace/tests => tests}/__init__.py | 0 .../basic_trace/basic_trace_system_test.py | 0 .../system/trace}/credentials.json.enc | 0 .../system/trace}/django/app/__init__.py | 0 .../system/trace}/django/app/forms.py | 0 .../system/trace}/django/app/settings.py | 0 .../trace}/django/app/templates/home.html | 0 .../system/trace}/django/app/urls.py | 0 .../system/trace}/django/app/views.py | 0 .../trace}/django/django_system_test.py | 0 .../system/trace}/django/manage.py | 0 .../system/trace}/flask/.dockerignore | 0 .../system/trace}/flask/flask_system_test.py | 0 .../system/trace}/flask/main.py | 0 .../system/trace}/set_credential.sh | 0 .../trace}/exporters/test_base_exporter.py | 0 .../trace}/exporters/test_file_exporter.py | 0 .../trace}/exporters/test_logging_exporter.py | 0 .../trace}/exporters/test_print_exporter.py | 0 .../exporters/test_stackdriver_exporter.py | 0 .../trace}/exporters/test_zipkin_exporter.py | 0 .../transports/test_background_thread.py | 0 .../transports/test_base_transport.py | 0 .../unit/trace}/ext/dbapi/test_dbapi_trace.py | 0 .../unit/trace}/ext/django/test_config.py | 0 .../unit/trace}/ext/django/test_middleware.py | 0 .../trace}/ext/flask/test_flask_middleware.py | 0 .../unit/trace}/ext/mysql/test_mysql_trace.py | 0 .../ext/postgresql/test_postgresql_trace.py | 0 .../trace}/ext/pymysql/test_pymysql_trace.py | 0 .../ext/requests/test_requests_trace.py | 0 .../ext/sqlalchemy/test_sqlalchemy_trace.py | 0 .../unit/trace}/ext/test_utils.py | 0 .../trace}/propagation/test_binary_format.py | 0 .../propagation/test_google_cloud_format.py | 0 .../trace}/propagation/test_text_format.py | 0 .../test_trace_context_http_header_format.py | 0 .../unit/trace}/samplers/test_always_off.py | 0 .../unit/trace}/samplers/test_always_on.py | 0 .../unit/trace}/samplers/test_base_sampler.py | 0 .../unit/trace}/samplers/test_probability.py | 0 .../unit/trace}/test_config_integration.py | 0 .../unit/trace}/test_execution_context.py | 0 .../unit/trace}/test_request_tracer.py | 0 .../unit => tests/unit/trace}/test_span.py | 0 .../unit/trace}/test_span_context.py | 0 .../unit/trace}/test_trace_options.py | 0 .../unit/trace}/tracer/test_base_tracer.py | 0 .../unit/trace}/tracer/test_context_tracer.py | 0 .../unit/trace}/tracer/test_noop_tracer.py | 0 .../unit/trace}/tracer/test_webapp2_tracer.py | 0 trace/README.rst | 12 -- trace/nox.py | 108 ------------------ trace/setup.cfg | 2 - trace/setup.py | 49 -------- 117 files changed, 123 insertions(+), 200 deletions(-) rename trace/.coveragerc => .coveragerc (100%) rename {trace/opencensus => opencensus}/__init__.py (100%) rename {trace/opencensus => opencensus}/trace/__init__.py (100%) rename {trace/opencensus => opencensus}/trace/attributes_helper.py (100%) rename {trace/opencensus => opencensus}/trace/config_integration.py (100%) rename {trace/opencensus => opencensus}/trace/enums.py (100%) rename {trace/opencensus => opencensus}/trace/execution_context.py (100%) rename {trace/opencensus => opencensus}/trace/exporters/__init__.py (100%) rename {trace/opencensus => opencensus}/trace/exporters/base.py (100%) rename {trace/opencensus => opencensus}/trace/exporters/file_exporter.py (100%) rename {trace/opencensus => opencensus}/trace/exporters/logging_exporter.py (100%) rename {trace/opencensus => opencensus}/trace/exporters/print_exporter.py (100%) rename {trace/opencensus => opencensus}/trace/exporters/stackdriver_exporter.py (100%) rename {trace/opencensus => opencensus}/trace/exporters/transports/__init__.py (100%) rename {trace/opencensus => opencensus}/trace/exporters/transports/background_thread.py (100%) rename {trace/opencensus => opencensus}/trace/exporters/transports/base.py (100%) rename {trace/opencensus => opencensus}/trace/exporters/transports/sync.py (100%) rename {trace/opencensus => opencensus}/trace/exporters/zipkin_exporter.py (100%) rename {trace/opencensus => opencensus}/trace/ext/__init__.py (100%) rename {trace/opencensus => opencensus}/trace/ext/dbapi/__init__.py (100%) rename {trace/opencensus => opencensus}/trace/ext/dbapi/trace.py (100%) rename {trace/opencensus => opencensus}/trace/ext/django/__init__.py (100%) rename {trace/opencensus => opencensus}/trace/ext/django/config.py (100%) rename {trace/opencensus => opencensus}/trace/ext/django/middleware.py (100%) rename {trace/opencensus => opencensus}/trace/ext/flask/__init__.py (100%) rename {trace/opencensus => opencensus}/trace/ext/flask/flask_middleware.py (100%) rename {trace/opencensus => opencensus}/trace/ext/mysql/__init__.py (100%) rename {trace/opencensus => opencensus}/trace/ext/mysql/trace.py (100%) rename {trace/opencensus => opencensus}/trace/ext/postgresql/__init__.py (100%) rename {trace/opencensus => opencensus}/trace/ext/postgresql/trace.py (100%) rename {trace/opencensus => opencensus}/trace/ext/pymysql/__init__.py (100%) rename {trace/opencensus => opencensus}/trace/ext/pymysql/trace.py (100%) rename {trace/opencensus => opencensus}/trace/ext/requests/__init__.py (100%) rename {trace/opencensus => opencensus}/trace/ext/requests/trace.py (100%) rename {trace/opencensus => opencensus}/trace/ext/sqlalchemy/__init__.py (100%) rename {trace/opencensus => opencensus}/trace/ext/sqlalchemy/trace.py (100%) rename {trace/opencensus => opencensus}/trace/ext/utils.py (100%) rename {trace/opencensus => opencensus}/trace/propagation/__init__.py (100%) rename {trace/opencensus => opencensus}/trace/propagation/binary_format.py (100%) rename {trace/opencensus => opencensus}/trace/propagation/google_cloud_format.py (100%) rename {trace/opencensus => opencensus}/trace/propagation/text_format.py (100%) rename {trace/opencensus => opencensus}/trace/propagation/trace_context_http_header_format.py (100%) rename {trace/opencensus => opencensus}/trace/request_tracer.py (100%) rename {trace/opencensus => opencensus}/trace/samplers/__init__.py (100%) rename {trace/opencensus => opencensus}/trace/samplers/always_off.py (100%) rename {trace/opencensus => opencensus}/trace/samplers/always_on.py (100%) rename {trace/opencensus => opencensus}/trace/samplers/base.py (100%) rename {trace/opencensus => opencensus}/trace/samplers/probability.py (100%) rename {trace/opencensus => opencensus}/trace/span.py (100%) rename {trace/opencensus => opencensus}/trace/span_context.py (100%) rename {trace/opencensus => opencensus}/trace/trace_options.py (100%) rename {trace/opencensus => opencensus}/trace/tracer/__init__.py (100%) rename {trace/opencensus => opencensus}/trace/tracer/base.py (100%) rename {trace/opencensus => opencensus}/trace/tracer/context_tracer.py (100%) rename {trace/opencensus => opencensus}/trace/tracer/noop_tracer.py (100%) rename {trace/opencensus => opencensus}/trace/tracer/webapp2_tracer.py (100%) rename trace/requirements-test.txt => requirements-test.txt (100%) rename {trace/tests => tests}/__init__.py (100%) rename {trace/tests/system => tests/system/trace}/basic_trace/basic_trace_system_test.py (100%) rename {trace/tests/system => tests/system/trace}/credentials.json.enc (100%) rename {trace/tests/system => tests/system/trace}/django/app/__init__.py (100%) rename {trace/tests/system => tests/system/trace}/django/app/forms.py (100%) rename {trace/tests/system => tests/system/trace}/django/app/settings.py (100%) rename {trace/tests/system => tests/system/trace}/django/app/templates/home.html (100%) rename {trace/tests/system => tests/system/trace}/django/app/urls.py (100%) rename {trace/tests/system => tests/system/trace}/django/app/views.py (100%) rename {trace/tests/system => tests/system/trace}/django/django_system_test.py (100%) rename {trace/tests/system => tests/system/trace}/django/manage.py (100%) rename {trace/tests/system => tests/system/trace}/flask/.dockerignore (100%) rename {trace/tests/system => tests/system/trace}/flask/flask_system_test.py (100%) rename {trace/tests/system => tests/system/trace}/flask/main.py (100%) rename {trace/tests/system => tests/system/trace}/set_credential.sh (100%) rename {trace/tests/unit => tests/unit/trace}/exporters/test_base_exporter.py (100%) rename {trace/tests/unit => tests/unit/trace}/exporters/test_file_exporter.py (100%) rename {trace/tests/unit => tests/unit/trace}/exporters/test_logging_exporter.py (100%) rename {trace/tests/unit => tests/unit/trace}/exporters/test_print_exporter.py (100%) rename {trace/tests/unit => tests/unit/trace}/exporters/test_stackdriver_exporter.py (100%) rename {trace/tests/unit => tests/unit/trace}/exporters/test_zipkin_exporter.py (100%) rename {trace/tests/unit => tests/unit/trace}/exporters/transports/test_background_thread.py (100%) rename {trace/tests/unit => tests/unit/trace}/exporters/transports/test_base_transport.py (100%) rename {trace/tests/unit => tests/unit/trace}/ext/dbapi/test_dbapi_trace.py (100%) rename {trace/tests/unit => tests/unit/trace}/ext/django/test_config.py (100%) rename {trace/tests/unit => tests/unit/trace}/ext/django/test_middleware.py (100%) rename {trace/tests/unit => tests/unit/trace}/ext/flask/test_flask_middleware.py (100%) rename {trace/tests/unit => tests/unit/trace}/ext/mysql/test_mysql_trace.py (100%) rename {trace/tests/unit => tests/unit/trace}/ext/postgresql/test_postgresql_trace.py (100%) rename {trace/tests/unit => tests/unit/trace}/ext/pymysql/test_pymysql_trace.py (100%) rename {trace/tests/unit => tests/unit/trace}/ext/requests/test_requests_trace.py (100%) rename {trace/tests/unit => tests/unit/trace}/ext/sqlalchemy/test_sqlalchemy_trace.py (100%) rename {trace/tests/unit => tests/unit/trace}/ext/test_utils.py (100%) rename {trace/tests/unit => tests/unit/trace}/propagation/test_binary_format.py (100%) rename {trace/tests/unit => tests/unit/trace}/propagation/test_google_cloud_format.py (100%) rename {trace/tests/unit => tests/unit/trace}/propagation/test_text_format.py (100%) rename {trace/tests/unit => tests/unit/trace}/propagation/test_trace_context_http_header_format.py (100%) rename {trace/tests/unit => tests/unit/trace}/samplers/test_always_off.py (100%) rename {trace/tests/unit => tests/unit/trace}/samplers/test_always_on.py (100%) rename {trace/tests/unit => tests/unit/trace}/samplers/test_base_sampler.py (100%) rename {trace/tests/unit => tests/unit/trace}/samplers/test_probability.py (100%) rename {trace/tests/unit => tests/unit/trace}/test_config_integration.py (100%) rename {trace/tests/unit => tests/unit/trace}/test_execution_context.py (100%) rename {trace/tests/unit => tests/unit/trace}/test_request_tracer.py (100%) rename {trace/tests/unit => tests/unit/trace}/test_span.py (100%) rename {trace/tests/unit => tests/unit/trace}/test_span_context.py (100%) rename {trace/tests/unit => tests/unit/trace}/test_trace_options.py (100%) rename {trace/tests/unit => tests/unit/trace}/tracer/test_base_tracer.py (100%) rename {trace/tests/unit => tests/unit/trace}/tracer/test_context_tracer.py (100%) rename {trace/tests/unit => tests/unit/trace}/tracer/test_noop_tracer.py (100%) rename {trace/tests/unit => tests/unit/trace}/tracer/test_webapp2_tracer.py (100%) delete mode 100644 trace/README.rst delete mode 100644 trace/nox.py delete mode 100644 trace/setup.cfg delete mode 100644 trace/setup.py diff --git a/trace/.coveragerc b/.coveragerc similarity index 100% rename from trace/.coveragerc rename to .coveragerc diff --git a/README.rst b/README.rst index f1d56bcc7..7b4fc265f 100644 --- a/README.rst +++ b/README.rst @@ -21,21 +21,21 @@ Installation & basic usage 1. Install the opencensus-trace package using `pip`_ or `pipenv`_: -:: + :: - pip install opencensus-trace - pipenv install opencensus-trace + pip install opencensus-trace + pipenv install opencensus-trace 2. Initialize a tracer for application: -.. code:: python + .. code:: python - from opencensus.trace import request_tracer + from opencensus.trace import request_tracer - tracer = request_tracer.RequestTracer() + tracer = request_tracer.RequestTracer() -.. _pip: https://pip.pypa.io -.. _pipenv: https://docs.pipenv.org/ + .. _pip: https://pip.pypa.io + .. _pipenv: https://docs.pipenv.org/ Usage ----- @@ -306,10 +306,10 @@ to ``trace_integrations`` using ``'postgresql'``. SQLAlchemy ~~~~~~~~~~ -You can trace usage of `SQLAlchemy`_, regardless of the underlying database, by +You can trace usage of `sqlalchemy package`_, regardless of the underlying database, by specifying ``'sqlalchemy'`` to ``trace_integrations``. -.. _SQLAlchemy: https://pypi.org/project/SQLAlchemy +.. _SQLAlchemy package: https://pypi.org/project/SQLAlchemy .. note:: If you enable tracing of SQLAlchemy and the underlying database driver, you will get duplicate spans. Instead, just trace SQLAlchemy. diff --git a/docs/requirements.txt b/docs/requirements.txt index 59667ee9a..0fe2468d8 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,4 +1,4 @@ setuptools >= 36.4.0 sphinx >= 1.6.3 -trace/ +. \ No newline at end of file diff --git a/docs/trace/usage.rst b/docs/trace/usage.rst index f0d1c77dc..e8b4e91d0 100644 --- a/docs/trace/usage.rst +++ b/docs/trace/usage.rst @@ -21,21 +21,21 @@ Installation & basic usage 1. Install the opencensus-trace package using `pip`_ or `pipenv`_: -:: + :: - pip install opencensus-trace - pipenv install opencensus-trace + pip install opencensus-trace + pipenv install opencensus-trace 2. Initialize a tracer for application: -.. code:: python + .. code:: python - from opencensus.trace import request_tracer + from opencensus.trace import request_tracer - tracer = request_tracer.RequestTracer() + tracer = request_tracer.RequestTracer() -.. _pip: https://pip.pypa.io -.. _pipenv: https://docs.pipenv.org/ + .. _pip: https://pip.pypa.io + .. _pipenv: https://docs.pipenv.org/ Usage ----- @@ -306,10 +306,10 @@ to ``trace_integrations`` using ``'postgresql'``. SQLAlchemy ~~~~~~~~~~ -You can trace usage of `SQLAlchemy`_, regardless of the underlying database, by +You can trace usage of `sqlalchemy package`_, regardless of the underlying database, by specifying ``'sqlalchemy'`` to ``trace_integrations``. -.. _SQLAlchemy: https://pypi.org/project/SQLAlchemy +.. _SQLAlchemy package: https://pypi.org/project/SQLAlchemy .. note:: If you enable tracing of SQLAlchemy and the underlying database driver, you will get duplicate spans. Instead, just trace SQLAlchemy. diff --git a/nox.py b/nox.py index d5e4beaba..e99ed64fa 100644 --- a/nox.py +++ b/nox.py @@ -12,9 +12,100 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os +from __future__ import absolute_import import nox +import os + + +@nox.session +@nox.parametrize('python_version', ['2.7', '3.4', '3.5', '3.6']) +def unit_tests(session, python_version): + """Run the unit test suite.""" + + # Run unit tests against all supported versions of Python. + session.interpreter = 'python{}'.format(python_version) + + # Install all test dependencies, then install this package in-place. + session.install('-r', 'requirements-test.txt') + + session.install('-e', '.') + + # Run py.test against the unit tests. + session.run( + 'py.test', + '--quiet', + '--cov=opencensus.trace', + '--cov-append', + '--cov-config=.coveragerc', + '--cov-report=', + '--cov-fail-under=97', + 'tests/unit/', + *session.posargs + ) + + +@nox.session +@nox.parametrize('python_version', ['2.7', '3.6']) +def system_tests(session, python_version): + """Run the system test suite.""" + + # Sanity check: Only run system tests if the environment variable is set. + if not os.environ.get('GOOGLE_APPLICATION_CREDENTIALS', ''): + session.skip('Credentials must be set via environment variable.') + + # Run the system tests against latest Python 2 and Python 3 only. + session.interpreter = 'python{}'.format(python_version) + + # Set the virtualenv dirname. + session.virtualenv_dirname = 'sys-' + python_version + + # Install all test dependencies, then install this package into the + # virutalenv's dist-packages. + session.install('-r', 'requirements-test.txt') + session.install('.') + + # Run py.test against the system tests. + session.run( + 'py.test', + '-vvv', + '-s', + 'tests/system/', + *session.posargs + ) + + +@nox.session +def lint(session): + """Run flake8. + Returns a failure if flake8 finds linting errors or sufficiently + serious code quality issues. + """ + session.interpreter = 'python3.6' + session.install('flake8') + session.install('.') + session.run('flake8', 'opencensus/trace') + + +@nox.session +def lint_setup_py(session): + """Verify that setup.py is valid (including RST check).""" + session.interpreter = 'python3.6' + session.install('docutils', 'pygments') + session.run( + 'python', 'setup.py', 'check', '--restructuredtext', '--strict') + + +@nox.session +def cover(session): + """Run the final coverage report. + This outputs the coverage report aggregating coverage from the unit + test runs (not system test runs), and then erases coverage data. + """ + session.interpreter = 'python3.6' + session.install('coverage', 'pytest-cov') + session.run('coverage', 'report', '--show-missing', '--fail-under=100') + session.run('coverage', 'erase') @nox.session @@ -34,3 +125,4 @@ def docs(session): # Build the docs! session.run( 'bash', os.path.join('.', 'scripts', 'update_docs.sh')) + diff --git a/trace/opencensus/__init__.py b/opencensus/__init__.py similarity index 100% rename from trace/opencensus/__init__.py rename to opencensus/__init__.py diff --git a/trace/opencensus/trace/__init__.py b/opencensus/trace/__init__.py similarity index 100% rename from trace/opencensus/trace/__init__.py rename to opencensus/trace/__init__.py diff --git a/trace/opencensus/trace/attributes_helper.py b/opencensus/trace/attributes_helper.py similarity index 100% rename from trace/opencensus/trace/attributes_helper.py rename to opencensus/trace/attributes_helper.py diff --git a/trace/opencensus/trace/config_integration.py b/opencensus/trace/config_integration.py similarity index 100% rename from trace/opencensus/trace/config_integration.py rename to opencensus/trace/config_integration.py diff --git a/trace/opencensus/trace/enums.py b/opencensus/trace/enums.py similarity index 100% rename from trace/opencensus/trace/enums.py rename to opencensus/trace/enums.py diff --git a/trace/opencensus/trace/execution_context.py b/opencensus/trace/execution_context.py similarity index 100% rename from trace/opencensus/trace/execution_context.py rename to opencensus/trace/execution_context.py diff --git a/trace/opencensus/trace/exporters/__init__.py b/opencensus/trace/exporters/__init__.py similarity index 100% rename from trace/opencensus/trace/exporters/__init__.py rename to opencensus/trace/exporters/__init__.py diff --git a/trace/opencensus/trace/exporters/base.py b/opencensus/trace/exporters/base.py similarity index 100% rename from trace/opencensus/trace/exporters/base.py rename to opencensus/trace/exporters/base.py diff --git a/trace/opencensus/trace/exporters/file_exporter.py b/opencensus/trace/exporters/file_exporter.py similarity index 100% rename from trace/opencensus/trace/exporters/file_exporter.py rename to opencensus/trace/exporters/file_exporter.py diff --git a/trace/opencensus/trace/exporters/logging_exporter.py b/opencensus/trace/exporters/logging_exporter.py similarity index 100% rename from trace/opencensus/trace/exporters/logging_exporter.py rename to opencensus/trace/exporters/logging_exporter.py diff --git a/trace/opencensus/trace/exporters/print_exporter.py b/opencensus/trace/exporters/print_exporter.py similarity index 100% rename from trace/opencensus/trace/exporters/print_exporter.py rename to opencensus/trace/exporters/print_exporter.py diff --git a/trace/opencensus/trace/exporters/stackdriver_exporter.py b/opencensus/trace/exporters/stackdriver_exporter.py similarity index 100% rename from trace/opencensus/trace/exporters/stackdriver_exporter.py rename to opencensus/trace/exporters/stackdriver_exporter.py diff --git a/trace/opencensus/trace/exporters/transports/__init__.py b/opencensus/trace/exporters/transports/__init__.py similarity index 100% rename from trace/opencensus/trace/exporters/transports/__init__.py rename to opencensus/trace/exporters/transports/__init__.py diff --git a/trace/opencensus/trace/exporters/transports/background_thread.py b/opencensus/trace/exporters/transports/background_thread.py similarity index 100% rename from trace/opencensus/trace/exporters/transports/background_thread.py rename to opencensus/trace/exporters/transports/background_thread.py diff --git a/trace/opencensus/trace/exporters/transports/base.py b/opencensus/trace/exporters/transports/base.py similarity index 100% rename from trace/opencensus/trace/exporters/transports/base.py rename to opencensus/trace/exporters/transports/base.py diff --git a/trace/opencensus/trace/exporters/transports/sync.py b/opencensus/trace/exporters/transports/sync.py similarity index 100% rename from trace/opencensus/trace/exporters/transports/sync.py rename to opencensus/trace/exporters/transports/sync.py diff --git a/trace/opencensus/trace/exporters/zipkin_exporter.py b/opencensus/trace/exporters/zipkin_exporter.py similarity index 100% rename from trace/opencensus/trace/exporters/zipkin_exporter.py rename to opencensus/trace/exporters/zipkin_exporter.py diff --git a/trace/opencensus/trace/ext/__init__.py b/opencensus/trace/ext/__init__.py similarity index 100% rename from trace/opencensus/trace/ext/__init__.py rename to opencensus/trace/ext/__init__.py diff --git a/trace/opencensus/trace/ext/dbapi/__init__.py b/opencensus/trace/ext/dbapi/__init__.py similarity index 100% rename from trace/opencensus/trace/ext/dbapi/__init__.py rename to opencensus/trace/ext/dbapi/__init__.py diff --git a/trace/opencensus/trace/ext/dbapi/trace.py b/opencensus/trace/ext/dbapi/trace.py similarity index 100% rename from trace/opencensus/trace/ext/dbapi/trace.py rename to opencensus/trace/ext/dbapi/trace.py diff --git a/trace/opencensus/trace/ext/django/__init__.py b/opencensus/trace/ext/django/__init__.py similarity index 100% rename from trace/opencensus/trace/ext/django/__init__.py rename to opencensus/trace/ext/django/__init__.py diff --git a/trace/opencensus/trace/ext/django/config.py b/opencensus/trace/ext/django/config.py similarity index 100% rename from trace/opencensus/trace/ext/django/config.py rename to opencensus/trace/ext/django/config.py diff --git a/trace/opencensus/trace/ext/django/middleware.py b/opencensus/trace/ext/django/middleware.py similarity index 100% rename from trace/opencensus/trace/ext/django/middleware.py rename to opencensus/trace/ext/django/middleware.py diff --git a/trace/opencensus/trace/ext/flask/__init__.py b/opencensus/trace/ext/flask/__init__.py similarity index 100% rename from trace/opencensus/trace/ext/flask/__init__.py rename to opencensus/trace/ext/flask/__init__.py diff --git a/trace/opencensus/trace/ext/flask/flask_middleware.py b/opencensus/trace/ext/flask/flask_middleware.py similarity index 100% rename from trace/opencensus/trace/ext/flask/flask_middleware.py rename to opencensus/trace/ext/flask/flask_middleware.py diff --git a/trace/opencensus/trace/ext/mysql/__init__.py b/opencensus/trace/ext/mysql/__init__.py similarity index 100% rename from trace/opencensus/trace/ext/mysql/__init__.py rename to opencensus/trace/ext/mysql/__init__.py diff --git a/trace/opencensus/trace/ext/mysql/trace.py b/opencensus/trace/ext/mysql/trace.py similarity index 100% rename from trace/opencensus/trace/ext/mysql/trace.py rename to opencensus/trace/ext/mysql/trace.py diff --git a/trace/opencensus/trace/ext/postgresql/__init__.py b/opencensus/trace/ext/postgresql/__init__.py similarity index 100% rename from trace/opencensus/trace/ext/postgresql/__init__.py rename to opencensus/trace/ext/postgresql/__init__.py diff --git a/trace/opencensus/trace/ext/postgresql/trace.py b/opencensus/trace/ext/postgresql/trace.py similarity index 100% rename from trace/opencensus/trace/ext/postgresql/trace.py rename to opencensus/trace/ext/postgresql/trace.py diff --git a/trace/opencensus/trace/ext/pymysql/__init__.py b/opencensus/trace/ext/pymysql/__init__.py similarity index 100% rename from trace/opencensus/trace/ext/pymysql/__init__.py rename to opencensus/trace/ext/pymysql/__init__.py diff --git a/trace/opencensus/trace/ext/pymysql/trace.py b/opencensus/trace/ext/pymysql/trace.py similarity index 100% rename from trace/opencensus/trace/ext/pymysql/trace.py rename to opencensus/trace/ext/pymysql/trace.py diff --git a/trace/opencensus/trace/ext/requests/__init__.py b/opencensus/trace/ext/requests/__init__.py similarity index 100% rename from trace/opencensus/trace/ext/requests/__init__.py rename to opencensus/trace/ext/requests/__init__.py diff --git a/trace/opencensus/trace/ext/requests/trace.py b/opencensus/trace/ext/requests/trace.py similarity index 100% rename from trace/opencensus/trace/ext/requests/trace.py rename to opencensus/trace/ext/requests/trace.py diff --git a/trace/opencensus/trace/ext/sqlalchemy/__init__.py b/opencensus/trace/ext/sqlalchemy/__init__.py similarity index 100% rename from trace/opencensus/trace/ext/sqlalchemy/__init__.py rename to opencensus/trace/ext/sqlalchemy/__init__.py diff --git a/trace/opencensus/trace/ext/sqlalchemy/trace.py b/opencensus/trace/ext/sqlalchemy/trace.py similarity index 100% rename from trace/opencensus/trace/ext/sqlalchemy/trace.py rename to opencensus/trace/ext/sqlalchemy/trace.py diff --git a/trace/opencensus/trace/ext/utils.py b/opencensus/trace/ext/utils.py similarity index 100% rename from trace/opencensus/trace/ext/utils.py rename to opencensus/trace/ext/utils.py diff --git a/trace/opencensus/trace/propagation/__init__.py b/opencensus/trace/propagation/__init__.py similarity index 100% rename from trace/opencensus/trace/propagation/__init__.py rename to opencensus/trace/propagation/__init__.py diff --git a/trace/opencensus/trace/propagation/binary_format.py b/opencensus/trace/propagation/binary_format.py similarity index 100% rename from trace/opencensus/trace/propagation/binary_format.py rename to opencensus/trace/propagation/binary_format.py diff --git a/trace/opencensus/trace/propagation/google_cloud_format.py b/opencensus/trace/propagation/google_cloud_format.py similarity index 100% rename from trace/opencensus/trace/propagation/google_cloud_format.py rename to opencensus/trace/propagation/google_cloud_format.py diff --git a/trace/opencensus/trace/propagation/text_format.py b/opencensus/trace/propagation/text_format.py similarity index 100% rename from trace/opencensus/trace/propagation/text_format.py rename to opencensus/trace/propagation/text_format.py diff --git a/trace/opencensus/trace/propagation/trace_context_http_header_format.py b/opencensus/trace/propagation/trace_context_http_header_format.py similarity index 100% rename from trace/opencensus/trace/propagation/trace_context_http_header_format.py rename to opencensus/trace/propagation/trace_context_http_header_format.py diff --git a/trace/opencensus/trace/request_tracer.py b/opencensus/trace/request_tracer.py similarity index 100% rename from trace/opencensus/trace/request_tracer.py rename to opencensus/trace/request_tracer.py diff --git a/trace/opencensus/trace/samplers/__init__.py b/opencensus/trace/samplers/__init__.py similarity index 100% rename from trace/opencensus/trace/samplers/__init__.py rename to opencensus/trace/samplers/__init__.py diff --git a/trace/opencensus/trace/samplers/always_off.py b/opencensus/trace/samplers/always_off.py similarity index 100% rename from trace/opencensus/trace/samplers/always_off.py rename to opencensus/trace/samplers/always_off.py diff --git a/trace/opencensus/trace/samplers/always_on.py b/opencensus/trace/samplers/always_on.py similarity index 100% rename from trace/opencensus/trace/samplers/always_on.py rename to opencensus/trace/samplers/always_on.py diff --git a/trace/opencensus/trace/samplers/base.py b/opencensus/trace/samplers/base.py similarity index 100% rename from trace/opencensus/trace/samplers/base.py rename to opencensus/trace/samplers/base.py diff --git a/trace/opencensus/trace/samplers/probability.py b/opencensus/trace/samplers/probability.py similarity index 100% rename from trace/opencensus/trace/samplers/probability.py rename to opencensus/trace/samplers/probability.py diff --git a/trace/opencensus/trace/span.py b/opencensus/trace/span.py similarity index 100% rename from trace/opencensus/trace/span.py rename to opencensus/trace/span.py diff --git a/trace/opencensus/trace/span_context.py b/opencensus/trace/span_context.py similarity index 100% rename from trace/opencensus/trace/span_context.py rename to opencensus/trace/span_context.py diff --git a/trace/opencensus/trace/trace_options.py b/opencensus/trace/trace_options.py similarity index 100% rename from trace/opencensus/trace/trace_options.py rename to opencensus/trace/trace_options.py diff --git a/trace/opencensus/trace/tracer/__init__.py b/opencensus/trace/tracer/__init__.py similarity index 100% rename from trace/opencensus/trace/tracer/__init__.py rename to opencensus/trace/tracer/__init__.py diff --git a/trace/opencensus/trace/tracer/base.py b/opencensus/trace/tracer/base.py similarity index 100% rename from trace/opencensus/trace/tracer/base.py rename to opencensus/trace/tracer/base.py diff --git a/trace/opencensus/trace/tracer/context_tracer.py b/opencensus/trace/tracer/context_tracer.py similarity index 100% rename from trace/opencensus/trace/tracer/context_tracer.py rename to opencensus/trace/tracer/context_tracer.py diff --git a/trace/opencensus/trace/tracer/noop_tracer.py b/opencensus/trace/tracer/noop_tracer.py similarity index 100% rename from trace/opencensus/trace/tracer/noop_tracer.py rename to opencensus/trace/tracer/noop_tracer.py diff --git a/trace/opencensus/trace/tracer/webapp2_tracer.py b/opencensus/trace/tracer/webapp2_tracer.py similarity index 100% rename from trace/opencensus/trace/tracer/webapp2_tracer.py rename to opencensus/trace/tracer/webapp2_tracer.py diff --git a/trace/requirements-test.txt b/requirements-test.txt similarity index 100% rename from trace/requirements-test.txt rename to requirements-test.txt diff --git a/setup.py b/setup.py index fd1a82b8c..23d5209d8 100644 --- a/setup.py +++ b/setup.py @@ -14,18 +14,21 @@ """A setup module for Open Source Census Instrumentation Library""" +import io from setuptools import setup, find_packages -install_requires = [] +install_requires = [ + 'google-cloud-trace>=0.16.0, <0.17dev', +] setup( name='opencensus', - version='0.0.1', - author='OpenCensus Contributors', - author_email='opencensus-io@googlegroups.com', + version='0.1.0', + author='OpenCensus Authors', + author_email='census-developers@googlegroups.com', classifiers=[ 'Intended Audience :: Developers', - 'Development Status :: 2 - Pre-Alpha', + 'Development Status :: 3 - Alpha', 'Intended Audience :: Developers', 'License :: OSI Approved :: Apache Software License', 'Programming Language :: Python', @@ -33,8 +36,7 @@ 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: Implementation :: CPython', + 'Programming Language :: Python :: 3.6', ], description='A stats collection and distributed tracing framework', include_package_data=True, diff --git a/trace/tests/__init__.py b/tests/__init__.py similarity index 100% rename from trace/tests/__init__.py rename to tests/__init__.py diff --git a/trace/tests/system/basic_trace/basic_trace_system_test.py b/tests/system/trace/basic_trace/basic_trace_system_test.py similarity index 100% rename from trace/tests/system/basic_trace/basic_trace_system_test.py rename to tests/system/trace/basic_trace/basic_trace_system_test.py diff --git a/trace/tests/system/credentials.json.enc b/tests/system/trace/credentials.json.enc similarity index 100% rename from trace/tests/system/credentials.json.enc rename to tests/system/trace/credentials.json.enc diff --git a/trace/tests/system/django/app/__init__.py b/tests/system/trace/django/app/__init__.py similarity index 100% rename from trace/tests/system/django/app/__init__.py rename to tests/system/trace/django/app/__init__.py diff --git a/trace/tests/system/django/app/forms.py b/tests/system/trace/django/app/forms.py similarity index 100% rename from trace/tests/system/django/app/forms.py rename to tests/system/trace/django/app/forms.py diff --git a/trace/tests/system/django/app/settings.py b/tests/system/trace/django/app/settings.py similarity index 100% rename from trace/tests/system/django/app/settings.py rename to tests/system/trace/django/app/settings.py diff --git a/trace/tests/system/django/app/templates/home.html b/tests/system/trace/django/app/templates/home.html similarity index 100% rename from trace/tests/system/django/app/templates/home.html rename to tests/system/trace/django/app/templates/home.html diff --git a/trace/tests/system/django/app/urls.py b/tests/system/trace/django/app/urls.py similarity index 100% rename from trace/tests/system/django/app/urls.py rename to tests/system/trace/django/app/urls.py diff --git a/trace/tests/system/django/app/views.py b/tests/system/trace/django/app/views.py similarity index 100% rename from trace/tests/system/django/app/views.py rename to tests/system/trace/django/app/views.py diff --git a/trace/tests/system/django/django_system_test.py b/tests/system/trace/django/django_system_test.py similarity index 100% rename from trace/tests/system/django/django_system_test.py rename to tests/system/trace/django/django_system_test.py diff --git a/trace/tests/system/django/manage.py b/tests/system/trace/django/manage.py similarity index 100% rename from trace/tests/system/django/manage.py rename to tests/system/trace/django/manage.py diff --git a/trace/tests/system/flask/.dockerignore b/tests/system/trace/flask/.dockerignore similarity index 100% rename from trace/tests/system/flask/.dockerignore rename to tests/system/trace/flask/.dockerignore diff --git a/trace/tests/system/flask/flask_system_test.py b/tests/system/trace/flask/flask_system_test.py similarity index 100% rename from trace/tests/system/flask/flask_system_test.py rename to tests/system/trace/flask/flask_system_test.py diff --git a/trace/tests/system/flask/main.py b/tests/system/trace/flask/main.py similarity index 100% rename from trace/tests/system/flask/main.py rename to tests/system/trace/flask/main.py diff --git a/trace/tests/system/set_credential.sh b/tests/system/trace/set_credential.sh similarity index 100% rename from trace/tests/system/set_credential.sh rename to tests/system/trace/set_credential.sh diff --git a/trace/tests/unit/exporters/test_base_exporter.py b/tests/unit/trace/exporters/test_base_exporter.py similarity index 100% rename from trace/tests/unit/exporters/test_base_exporter.py rename to tests/unit/trace/exporters/test_base_exporter.py diff --git a/trace/tests/unit/exporters/test_file_exporter.py b/tests/unit/trace/exporters/test_file_exporter.py similarity index 100% rename from trace/tests/unit/exporters/test_file_exporter.py rename to tests/unit/trace/exporters/test_file_exporter.py diff --git a/trace/tests/unit/exporters/test_logging_exporter.py b/tests/unit/trace/exporters/test_logging_exporter.py similarity index 100% rename from trace/tests/unit/exporters/test_logging_exporter.py rename to tests/unit/trace/exporters/test_logging_exporter.py diff --git a/trace/tests/unit/exporters/test_print_exporter.py b/tests/unit/trace/exporters/test_print_exporter.py similarity index 100% rename from trace/tests/unit/exporters/test_print_exporter.py rename to tests/unit/trace/exporters/test_print_exporter.py diff --git a/trace/tests/unit/exporters/test_stackdriver_exporter.py b/tests/unit/trace/exporters/test_stackdriver_exporter.py similarity index 100% rename from trace/tests/unit/exporters/test_stackdriver_exporter.py rename to tests/unit/trace/exporters/test_stackdriver_exporter.py diff --git a/trace/tests/unit/exporters/test_zipkin_exporter.py b/tests/unit/trace/exporters/test_zipkin_exporter.py similarity index 100% rename from trace/tests/unit/exporters/test_zipkin_exporter.py rename to tests/unit/trace/exporters/test_zipkin_exporter.py diff --git a/trace/tests/unit/exporters/transports/test_background_thread.py b/tests/unit/trace/exporters/transports/test_background_thread.py similarity index 100% rename from trace/tests/unit/exporters/transports/test_background_thread.py rename to tests/unit/trace/exporters/transports/test_background_thread.py diff --git a/trace/tests/unit/exporters/transports/test_base_transport.py b/tests/unit/trace/exporters/transports/test_base_transport.py similarity index 100% rename from trace/tests/unit/exporters/transports/test_base_transport.py rename to tests/unit/trace/exporters/transports/test_base_transport.py diff --git a/trace/tests/unit/ext/dbapi/test_dbapi_trace.py b/tests/unit/trace/ext/dbapi/test_dbapi_trace.py similarity index 100% rename from trace/tests/unit/ext/dbapi/test_dbapi_trace.py rename to tests/unit/trace/ext/dbapi/test_dbapi_trace.py diff --git a/trace/tests/unit/ext/django/test_config.py b/tests/unit/trace/ext/django/test_config.py similarity index 100% rename from trace/tests/unit/ext/django/test_config.py rename to tests/unit/trace/ext/django/test_config.py diff --git a/trace/tests/unit/ext/django/test_middleware.py b/tests/unit/trace/ext/django/test_middleware.py similarity index 100% rename from trace/tests/unit/ext/django/test_middleware.py rename to tests/unit/trace/ext/django/test_middleware.py diff --git a/trace/tests/unit/ext/flask/test_flask_middleware.py b/tests/unit/trace/ext/flask/test_flask_middleware.py similarity index 100% rename from trace/tests/unit/ext/flask/test_flask_middleware.py rename to tests/unit/trace/ext/flask/test_flask_middleware.py diff --git a/trace/tests/unit/ext/mysql/test_mysql_trace.py b/tests/unit/trace/ext/mysql/test_mysql_trace.py similarity index 100% rename from trace/tests/unit/ext/mysql/test_mysql_trace.py rename to tests/unit/trace/ext/mysql/test_mysql_trace.py diff --git a/trace/tests/unit/ext/postgresql/test_postgresql_trace.py b/tests/unit/trace/ext/postgresql/test_postgresql_trace.py similarity index 100% rename from trace/tests/unit/ext/postgresql/test_postgresql_trace.py rename to tests/unit/trace/ext/postgresql/test_postgresql_trace.py diff --git a/trace/tests/unit/ext/pymysql/test_pymysql_trace.py b/tests/unit/trace/ext/pymysql/test_pymysql_trace.py similarity index 100% rename from trace/tests/unit/ext/pymysql/test_pymysql_trace.py rename to tests/unit/trace/ext/pymysql/test_pymysql_trace.py diff --git a/trace/tests/unit/ext/requests/test_requests_trace.py b/tests/unit/trace/ext/requests/test_requests_trace.py similarity index 100% rename from trace/tests/unit/ext/requests/test_requests_trace.py rename to tests/unit/trace/ext/requests/test_requests_trace.py diff --git a/trace/tests/unit/ext/sqlalchemy/test_sqlalchemy_trace.py b/tests/unit/trace/ext/sqlalchemy/test_sqlalchemy_trace.py similarity index 100% rename from trace/tests/unit/ext/sqlalchemy/test_sqlalchemy_trace.py rename to tests/unit/trace/ext/sqlalchemy/test_sqlalchemy_trace.py diff --git a/trace/tests/unit/ext/test_utils.py b/tests/unit/trace/ext/test_utils.py similarity index 100% rename from trace/tests/unit/ext/test_utils.py rename to tests/unit/trace/ext/test_utils.py diff --git a/trace/tests/unit/propagation/test_binary_format.py b/tests/unit/trace/propagation/test_binary_format.py similarity index 100% rename from trace/tests/unit/propagation/test_binary_format.py rename to tests/unit/trace/propagation/test_binary_format.py diff --git a/trace/tests/unit/propagation/test_google_cloud_format.py b/tests/unit/trace/propagation/test_google_cloud_format.py similarity index 100% rename from trace/tests/unit/propagation/test_google_cloud_format.py rename to tests/unit/trace/propagation/test_google_cloud_format.py diff --git a/trace/tests/unit/propagation/test_text_format.py b/tests/unit/trace/propagation/test_text_format.py similarity index 100% rename from trace/tests/unit/propagation/test_text_format.py rename to tests/unit/trace/propagation/test_text_format.py diff --git a/trace/tests/unit/propagation/test_trace_context_http_header_format.py b/tests/unit/trace/propagation/test_trace_context_http_header_format.py similarity index 100% rename from trace/tests/unit/propagation/test_trace_context_http_header_format.py rename to tests/unit/trace/propagation/test_trace_context_http_header_format.py diff --git a/trace/tests/unit/samplers/test_always_off.py b/tests/unit/trace/samplers/test_always_off.py similarity index 100% rename from trace/tests/unit/samplers/test_always_off.py rename to tests/unit/trace/samplers/test_always_off.py diff --git a/trace/tests/unit/samplers/test_always_on.py b/tests/unit/trace/samplers/test_always_on.py similarity index 100% rename from trace/tests/unit/samplers/test_always_on.py rename to tests/unit/trace/samplers/test_always_on.py diff --git a/trace/tests/unit/samplers/test_base_sampler.py b/tests/unit/trace/samplers/test_base_sampler.py similarity index 100% rename from trace/tests/unit/samplers/test_base_sampler.py rename to tests/unit/trace/samplers/test_base_sampler.py diff --git a/trace/tests/unit/samplers/test_probability.py b/tests/unit/trace/samplers/test_probability.py similarity index 100% rename from trace/tests/unit/samplers/test_probability.py rename to tests/unit/trace/samplers/test_probability.py diff --git a/trace/tests/unit/test_config_integration.py b/tests/unit/trace/test_config_integration.py similarity index 100% rename from trace/tests/unit/test_config_integration.py rename to tests/unit/trace/test_config_integration.py diff --git a/trace/tests/unit/test_execution_context.py b/tests/unit/trace/test_execution_context.py similarity index 100% rename from trace/tests/unit/test_execution_context.py rename to tests/unit/trace/test_execution_context.py diff --git a/trace/tests/unit/test_request_tracer.py b/tests/unit/trace/test_request_tracer.py similarity index 100% rename from trace/tests/unit/test_request_tracer.py rename to tests/unit/trace/test_request_tracer.py diff --git a/trace/tests/unit/test_span.py b/tests/unit/trace/test_span.py similarity index 100% rename from trace/tests/unit/test_span.py rename to tests/unit/trace/test_span.py diff --git a/trace/tests/unit/test_span_context.py b/tests/unit/trace/test_span_context.py similarity index 100% rename from trace/tests/unit/test_span_context.py rename to tests/unit/trace/test_span_context.py diff --git a/trace/tests/unit/test_trace_options.py b/tests/unit/trace/test_trace_options.py similarity index 100% rename from trace/tests/unit/test_trace_options.py rename to tests/unit/trace/test_trace_options.py diff --git a/trace/tests/unit/tracer/test_base_tracer.py b/tests/unit/trace/tracer/test_base_tracer.py similarity index 100% rename from trace/tests/unit/tracer/test_base_tracer.py rename to tests/unit/trace/tracer/test_base_tracer.py diff --git a/trace/tests/unit/tracer/test_context_tracer.py b/tests/unit/trace/tracer/test_context_tracer.py similarity index 100% rename from trace/tests/unit/tracer/test_context_tracer.py rename to tests/unit/trace/tracer/test_context_tracer.py diff --git a/trace/tests/unit/tracer/test_noop_tracer.py b/tests/unit/trace/tracer/test_noop_tracer.py similarity index 100% rename from trace/tests/unit/tracer/test_noop_tracer.py rename to tests/unit/trace/tracer/test_noop_tracer.py diff --git a/trace/tests/unit/tracer/test_webapp2_tracer.py b/tests/unit/trace/tracer/test_webapp2_tracer.py similarity index 100% rename from trace/tests/unit/tracer/test_webapp2_tracer.py rename to tests/unit/trace/tracer/test_webapp2_tracer.py diff --git a/trace/README.rst b/trace/README.rst deleted file mode 100644 index 6b3e02537..000000000 --- a/trace/README.rst +++ /dev/null @@ -1,12 +0,0 @@ -OpenCensus - A stats collection and distributed tracing framework -================================================================= - -OpenCensus provides a framework to define and collect stats against metrics and -to break those stats down across user-defined dimensions. The library is in -pre-alpha stage and the API is subject to change. - - -Disclaimer ----------- - -This is not an official Google product. diff --git a/trace/nox.py b/trace/nox.py deleted file mode 100644 index 36d066908..000000000 --- a/trace/nox.py +++ /dev/null @@ -1,108 +0,0 @@ -# Copyright 2016-17, OpenCensus 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 __future__ import absolute_import - -import nox -import os - - -@nox.session -@nox.parametrize('python_version', ['2.7', '3.4', '3.5', '3.6']) -def unit_tests(session, python_version): - """Run the unit test suite.""" - - # Run unit tests against all supported versions of Python. - session.interpreter = 'python{}'.format(python_version) - - # Install all test dependencies, then install this package in-place. - session.install('-r', 'requirements-test.txt') - - session.install('-e', '.') - - # Run py.test against the unit tests. - session.run( - 'py.test', - '--quiet', - '--cov=opencensus.trace', - '--cov-append', - '--cov-config=.coveragerc', - '--cov-report=', - '--cov-fail-under=97', - 'tests/unit/', - *session.posargs - ) - - -@nox.session -@nox.parametrize('python_version', ['2.7', '3.6']) -def system_tests(session, python_version): - """Run the system test suite.""" - - # Sanity check: Only run system tests if the environment variable is set. - if not os.environ.get('GOOGLE_APPLICATION_CREDENTIALS', ''): - session.skip('Credentials must be set via environment variable.') - - # Run the system tests against latest Python 2 and Python 3 only. - session.interpreter = 'python{}'.format(python_version) - - # Set the virtualenv dirname. - session.virtualenv_dirname = 'sys-' + python_version - - # Install all test dependencies, then install this package into the - # virutalenv's dist-packages. - session.install('-r', 'requirements-test.txt') - session.install('.') - - # Run py.test against the system tests. - session.run( - 'py.test', - '-vvv', - '-s', - 'tests/system/', - *session.posargs - ) - - -@nox.session -def lint(session): - """Run flake8. - Returns a failure if flake8 finds linting errors or sufficiently - serious code quality issues. - """ - session.interpreter = 'python3.6' - session.install('flake8') - session.install('.') - session.run('flake8', 'opencensus/trace') - - -@nox.session -def lint_setup_py(session): - """Verify that setup.py is valid (including RST check).""" - session.interpreter = 'python3.6' - session.install('docutils', 'pygments') - session.run( - 'python', 'setup.py', 'check', '--restructuredtext', '--strict') - - -@nox.session -def cover(session): - """Run the final coverage report. - This outputs the coverage report aggregating coverage from the unit - test runs (not system test runs), and then erases coverage data. - """ - session.interpreter = 'python3.6' - session.install('coverage', 'pytest-cov') - session.run('coverage', 'report', '--show-missing', '--fail-under=100') - session.run('coverage', 'erase') diff --git a/trace/setup.cfg b/trace/setup.cfg deleted file mode 100644 index 2a9acf13d..000000000 --- a/trace/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[bdist_wheel] -universal = 1 diff --git a/trace/setup.py b/trace/setup.py deleted file mode 100644 index e998f5192..000000000 --- a/trace/setup.py +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright 2017, OpenCensus 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. - -"""A setup module for Open Source Census Instrumentation Library""" - -import io -from setuptools import setup, find_packages - -install_requires = [ - 'google-cloud-trace>=0.16.0, <0.17dev', -] - -setup( - name='opencensus', - version='0.0.1', - author='OpenCensus Contributors', - author_email='opencensus-io@googlegroups.com', - classifiers=[ - 'Intended Audience :: Developers', - 'Development Status :: 2 - Pre-Alpha', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: Apache Software License', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: Implementation :: CPython', - ], - description='A stats collection and distributed tracing framework', - include_package_data=True, - long_description=open('README.rst').read(), - install_requires=install_requires, - license='Apache-2.0', - packages=find_packages(), - namespace_packages=[], - url='https://github.com/census-instrumentation/opencensus-python') From 8cf9535030a637645ef6d82c7651a4963a443f28 Mon Sep 17 00:00:00 2001 From: Angela Li Date: Mon, 4 Dec 2017 17:52:12 -0800 Subject: [PATCH 2/4] Update circleci config --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3c16d8d5b..89b486160 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -29,12 +29,12 @@ jobs: command: | if [ -n "$GOOGLE_APPLICATION_CREDENTIALS" ]; then openssl aes-256-cbc -d -a -k "$GOOGLE_CREDENTIALS_PASSPHRASE" \ - -in trace/tests/system/credentials.json.enc \ - -out trace/$GOOGLE_APPLICATION_CREDENTIALS + -in tests/system/trace/credentials.json.enc \ + -out $GOOGLE_APPLICATION_CREDENTIALS else echo "No credentials. System tests will not run." fi - run: - name: Run tests - opencensus.trace + name: Run tests - opencensus command: | - nox -f trace/nox.py + nox -f nox.py From dcb0dfd8f4bdecfc2f7ab3d36fe872452c4c2ae5 Mon Sep 17 00:00:00 2001 From: Angela Li Date: Mon, 4 Dec 2017 18:05:15 -0800 Subject: [PATCH 3/4] Update system tests paths --- tests/system/trace/django/django_system_test.py | 2 +- tests/system/trace/flask/flask_system_test.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/system/trace/django/django_system_test.py b/tests/system/trace/django/django_system_test.py index 16e3c1d48..a629540d3 100644 --- a/tests/system/trace/django/django_system_test.py +++ b/tests/system/trace/django/django_system_test.py @@ -52,7 +52,7 @@ def generate_header(): def run_application(): """Start running the django application.""" - cmd = 'python tests/system/django/manage.py runserver {}'.format(HOST_PORT) + cmd = 'python tests/system/trace/django/manage.py runserver {}'.format(HOST_PORT) process = subprocess.Popen( cmd, stdout=subprocess.PIPE, diff --git a/tests/system/trace/flask/flask_system_test.py b/tests/system/trace/flask/flask_system_test.py index 51b4bd05f..2d14217d2 100644 --- a/tests/system/trace/flask/flask_system_test.py +++ b/tests/system/trace/flask/flask_system_test.py @@ -52,7 +52,7 @@ def generate_header(): def run_application(): """Start running the flask application.""" - cmd = 'python tests/system/flask/main.py' + cmd = 'python tests/system/trace/flask/main.py' process = subprocess.Popen( cmd, stdout=subprocess.PIPE, From 3febb3beb90e8d4fca532ce75e02caebddcb0a65 Mon Sep 17 00:00:00 2001 From: Angela Li Date: Tue, 5 Dec 2017 00:44:54 -0800 Subject: [PATCH 4/4] Address comments --- nox.py | 15 +++++++-------- setup.py | 1 + 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/nox.py b/nox.py index e99ed64fa..38013ec0a 100644 --- a/nox.py +++ b/nox.py @@ -19,12 +19,12 @@ @nox.session -@nox.parametrize('python_version', ['2.7', '3.4', '3.5', '3.6']) -def unit_tests(session, python_version): +@nox.parametrize('py', ['2.7', '3.4', '3.5', '3.6']) +def unit(session, py): """Run the unit test suite.""" # Run unit tests against all supported versions of Python. - session.interpreter = 'python{}'.format(python_version) + session.interpreter = 'python{}'.format(py) # Install all test dependencies, then install this package in-place. session.install('-r', 'requirements-test.txt') @@ -46,8 +46,8 @@ def unit_tests(session, python_version): @nox.session -@nox.parametrize('python_version', ['2.7', '3.6']) -def system_tests(session, python_version): +@nox.parametrize('py', ['2.7', '3.6']) +def system(session, py): """Run the system test suite.""" # Sanity check: Only run system tests if the environment variable is set. @@ -55,10 +55,10 @@ def system_tests(session, python_version): session.skip('Credentials must be set via environment variable.') # Run the system tests against latest Python 2 and Python 3 only. - session.interpreter = 'python{}'.format(python_version) + session.interpreter = 'python{}'.format(py) # Set the virtualenv dirname. - session.virtualenv_dirname = 'sys-' + python_version + session.virtualenv_dirname = 'sys-' + py # Install all test dependencies, then install this package into the # virutalenv's dist-packages. @@ -68,7 +68,6 @@ def system_tests(session, python_version): # Run py.test against the system tests. session.run( 'py.test', - '-vvv', '-s', 'tests/system/', *session.posargs diff --git a/setup.py b/setup.py index 23d5209d8..f563425d7 100644 --- a/setup.py +++ b/setup.py @@ -36,6 +36,7 @@ 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', ], description='A stats collection and distributed tracing framework',