Skip to content

Commit

Permalink
Generate instrumentation packages setup.py files
Browse files Browse the repository at this point in the history
All instrumentations packages have almost exactly same setup.py files.
This commit adds a python script that generates it from a source
template. This dramatically reduces the time and effort required to
update all instrumentation setup.py files, and also reduces chances of
making manual mistakes.
  • Loading branch information
owais committed Apr 27, 2021
1 parent f2311dd commit 0629f27
Show file tree
Hide file tree
Showing 34 changed files with 281 additions and 218 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020, OpenTelemetry Authors
# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -11,21 +11,19 @@
# 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.


# DO NOT EDIT. THIS FILE WAS AUTOGENERATED FROM temaples/aiohttp-client.


import os

import setuptools

BASE_DIR = os.path.dirname(__file__)
VERSION_FILENAME = os.path.join(
BASE_DIR,
"src",
"opentelemetry",
"instrumentation",
"aiohttp_client",
"version.py",
BASE_DIR, "src", "opentelemetry", "instrumentation", "aiohttp-client", "version.py",
)
PACKAGE_INFO = {}
with open(VERSION_FILENAME) as f:
exec(f.read(), PACKAGE_INFO)

setuptools.setup(version=PACKAGE_INFO["__version__"])
9 changes: 6 additions & 3 deletions instrumentation/opentelemetry-instrumentation-aiopg/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@
# 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.


# DO NOT EDIT. THIS FILE WAS AUTOGENERATED FROM temaples/aiopg.


import os

import setuptools

BASE_DIR = os.path.dirname(__file__)
VERSION_FILENAME = os.path.join(
BASE_DIR, "src", "opentelemetry", "instrumentation", "aiopg", "version.py"
BASE_DIR, "src", "opentelemetry", "instrumentation", "aiopg", "version.py",
)
PACKAGE_INFO = {}
with open(VERSION_FILENAME) as f:
exec(f.read(), PACKAGE_INFO)

setuptools.setup(version=PACKAGE_INFO["__version__"])
9 changes: 6 additions & 3 deletions instrumentation/opentelemetry-instrumentation-asgi/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@
# 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.


# DO NOT EDIT. THIS FILE WAS AUTOGENERATED FROM temaples/asgi.


import os

import setuptools

BASE_DIR = os.path.dirname(__file__)
VERSION_FILENAME = os.path.join(
BASE_DIR, "src", "opentelemetry", "instrumentation", "asgi", "version.py"
BASE_DIR, "src", "opentelemetry", "instrumentation", "asgi", "version.py",
)
PACKAGE_INFO = {}
with open(VERSION_FILENAME) as f:
exec(f.read(), PACKAGE_INFO)

setuptools.setup(version=PACKAGE_INFO["__version__"])
14 changes: 6 additions & 8 deletions instrumentation/opentelemetry-instrumentation-asyncpg/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,19 @@
# 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.


# DO NOT EDIT. THIS FILE WAS AUTOGENERATED FROM temaples/asyncpg.


import os

import setuptools

BASE_DIR = os.path.dirname(__file__)
VERSION_FILENAME = os.path.join(
BASE_DIR,
"src",
"opentelemetry",
"instrumentation",
"asyncpg",
"version.py",
BASE_DIR, "src", "opentelemetry", "instrumentation", "asyncpg", "version.py",
)
PACKAGE_INFO = {}
with open(VERSION_FILENAME) as f:
exec(f.read(), PACKAGE_INFO)

setuptools.setup(version=PACKAGE_INFO["__version__"])
9 changes: 6 additions & 3 deletions instrumentation/opentelemetry-instrumentation-boto/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@
# 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.


# DO NOT EDIT. THIS FILE WAS AUTOGENERATED FROM temaples/boto.


import os

import setuptools

BASE_DIR = os.path.dirname(__file__)
VERSION_FILENAME = os.path.join(
BASE_DIR, "src", "opentelemetry", "instrumentation", "boto", "version.py"
BASE_DIR, "src", "opentelemetry", "instrumentation", "boto", "version.py",
)
PACKAGE_INFO = {}
with open(VERSION_FILENAME) as f:
exec(f.read(), PACKAGE_INFO)

setuptools.setup(version=PACKAGE_INFO["__version__"])
14 changes: 6 additions & 8 deletions instrumentation/opentelemetry-instrumentation-botocore/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,19 @@
# 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.


# DO NOT EDIT. THIS FILE WAS AUTOGENERATED FROM temaples/botocore.


import os

import setuptools

BASE_DIR = os.path.dirname(__file__)
VERSION_FILENAME = os.path.join(
BASE_DIR,
"src",
"opentelemetry",
"instrumentation",
"botocore",
"version.py",
BASE_DIR, "src", "opentelemetry", "instrumentation", "botocore", "version.py",
)
PACKAGE_INFO = {}
with open(VERSION_FILENAME) as f:
exec(f.read(), PACKAGE_INFO)

setuptools.setup(version=PACKAGE_INFO["__version__"])
9 changes: 6 additions & 3 deletions instrumentation/opentelemetry-instrumentation-celery/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@
# 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.


# DO NOT EDIT. THIS FILE WAS AUTOGENERATED FROM temaples/celery.


import os

import setuptools

BASE_DIR = os.path.dirname(__file__)
VERSION_FILENAME = os.path.join(
BASE_DIR, "src", "opentelemetry", "instrumentation", "celery", "version.py"
BASE_DIR, "src", "opentelemetry", "instrumentation", "celery", "version.py",
)
PACKAGE_INFO = {}
with open(VERSION_FILENAME) as f:
exec(f.read(), PACKAGE_INFO)

setuptools.setup(version=PACKAGE_INFO["__version__"])
9 changes: 6 additions & 3 deletions instrumentation/opentelemetry-instrumentation-dbapi/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@
# 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.


# DO NOT EDIT. THIS FILE WAS AUTOGENERATED FROM temaples/dbapi.


import os

import setuptools

BASE_DIR = os.path.dirname(__file__)
VERSION_FILENAME = os.path.join(
BASE_DIR, "src", "opentelemetry", "instrumentation", "dbapi", "version.py"
BASE_DIR, "src", "opentelemetry", "instrumentation", "dbapi", "version.py",
)
PACKAGE_INFO = {}
with open(VERSION_FILENAME) as f:
exec(f.read(), PACKAGE_INFO)

setuptools.setup(version=PACKAGE_INFO["__version__"])
25 changes: 11 additions & 14 deletions instrumentation/opentelemetry-instrumentation-django/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from os.path import dirname, join

from setuptools import setup
# DO NOT EDIT. THIS FILE WAS AUTOGENERATED FROM temaples/django.


import os

import setuptools

BASE_DIR = os.path.dirname(__file__)
VERSION_FILENAME = os.path.join(
BASE_DIR, "src", "opentelemetry", "instrumentation", "django", "version.py",
)
PACKAGE_INFO = {}
with open(
join(
dirname(__file__),
"src",
"opentelemetry",
"instrumentation",
"django",
"version.py",
)
) as f:
with open(VERSION_FILENAME) as f:
exec(f.read(), PACKAGE_INFO)

setup(version=PACKAGE_INFO["__version__"])
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,19 @@
# 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.


# DO NOT EDIT. THIS FILE WAS AUTOGENERATED FROM temaples/elasticsearch.


import os

import setuptools

BASE_DIR = os.path.dirname(__file__)
VERSION_FILENAME = os.path.join(
BASE_DIR,
"src",
"opentelemetry",
"instrumentation",
"elasticsearch",
"version.py",
BASE_DIR, "src", "opentelemetry", "instrumentation", "elasticsearch", "version.py",
)
PACKAGE_INFO = {}
with open(VERSION_FILENAME) as f:
exec(f.read(), PACKAGE_INFO)

setuptools.setup(version=PACKAGE_INFO["__version__"])
9 changes: 6 additions & 3 deletions instrumentation/opentelemetry-instrumentation-falcon/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@
# 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.


# DO NOT EDIT. THIS FILE WAS AUTOGENERATED FROM temaples/falcon.


import os

import setuptools

BASE_DIR = os.path.dirname(__file__)
VERSION_FILENAME = os.path.join(
BASE_DIR, "src", "opentelemetry", "instrumentation", "falcon", "version.py"
BASE_DIR, "src", "opentelemetry", "instrumentation", "falcon", "version.py",
)
PACKAGE_INFO = {}
with open(VERSION_FILENAME) as f:
exec(f.read(), PACKAGE_INFO)

setuptools.setup(version=PACKAGE_INFO["__version__"])
14 changes: 6 additions & 8 deletions instrumentation/opentelemetry-instrumentation-fastapi/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,19 @@
# 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.


# DO NOT EDIT. THIS FILE WAS AUTOGENERATED FROM temaples/fastapi.


import os

import setuptools

BASE_DIR = os.path.dirname(__file__)
VERSION_FILENAME = os.path.join(
BASE_DIR,
"src",
"opentelemetry",
"instrumentation",
"fastapi",
"version.py",
BASE_DIR, "src", "opentelemetry", "instrumentation", "fastapi", "version.py",
)
PACKAGE_INFO = {}
with open(VERSION_FILENAME) as f:
exec(f.read(), PACKAGE_INFO)

setuptools.setup(version=PACKAGE_INFO["__version__"])
16 changes: 6 additions & 10 deletions instrumentation/opentelemetry-instrumentation-flask/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,19 @@
# 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.


# DO NOT EDIT. THIS FILE WAS AUTOGENERATED FROM temaples/flask.


import os

import setuptools

BASE_DIR = os.path.dirname(__file__)
VERSION_FILENAME = os.path.join(
BASE_DIR, "src", "opentelemetry", "instrumentation", "flask", "version.py"
BASE_DIR, "src", "opentelemetry", "instrumentation", "flask", "version.py",
)
PACKAGE_INFO = {}
with open(VERSION_FILENAME) as f:
exec(f.read(), PACKAGE_INFO)

setuptools.setup(
version=PACKAGE_INFO["__version__"],
entry_points={
"opentelemetry_instrumentor": [
"flask = opentelemetry.instrumentation.flask:FlaskInstrumentor"
]
},
)
8 changes: 5 additions & 3 deletions instrumentation/opentelemetry-instrumentation-grpc/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.


# DO NOT EDIT. THIS FILE WAS AUTOGENERATED FROM temaples/grpc.


import os

import setuptools

BASE_DIR = os.path.dirname(__file__)
VERSION_FILENAME = os.path.join(
BASE_DIR, "src", "opentelemetry", "instrumentation", "grpc", "version.py"
BASE_DIR, "src", "opentelemetry", "instrumentation", "grpc", "version.py",
)
PACKAGE_INFO = {}
with open(VERSION_FILENAME) as f:
exec(f.read(), PACKAGE_INFO)

setuptools.setup(version=PACKAGE_INFO["__version__"])
9 changes: 6 additions & 3 deletions instrumentation/opentelemetry-instrumentation-jinja2/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@
# 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.


# DO NOT EDIT. THIS FILE WAS AUTOGENERATED FROM temaples/jinja2.


import os

import setuptools

BASE_DIR = os.path.dirname(__file__)
VERSION_FILENAME = os.path.join(
BASE_DIR, "src", "opentelemetry", "instrumentation", "jinja2", "version.py"
BASE_DIR, "src", "opentelemetry", "instrumentation", "jinja2", "version.py",
)
PACKAGE_INFO = {}
with open(VERSION_FILENAME) as f:
exec(f.read(), PACKAGE_INFO)

setuptools.setup(version=PACKAGE_INFO["__version__"])
Loading

0 comments on commit 0629f27

Please sign in to comment.