-
Notifications
You must be signed in to change notification settings - Fork 647
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
Instrumentation runtime checks #475
Changes from all commits
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 |
---|---|---|
|
@@ -18,10 +18,24 @@ | |
|
||
|
||
import os | ||
from configparser import ConfigParser | ||
|
||
import setuptools | ||
|
||
config = ConfigParser() | ||
config.read("setup.cfg") | ||
|
||
# We provide extras_require parameter to setuptools.setup later which | ||
# overwrites the extra_require section from setup.cfg. To support extra_require | ||
# secion in setup.cfg, we load it here and merge it with the extra_require param. | ||
extras_require = {} | ||
if "options.extras_require" in config: | ||
for key, value in config["options.extras_require"].items(): | ||
extras_require[key] = [v for v in value.split("\n") if v.strip()] | ||
|
||
BASE_DIR = os.path.dirname(__file__) | ||
PACKAGE_INFO = {} | ||
|
||
VERSION_FILENAME = os.path.join( | ||
BASE_DIR, | ||
"src", | ||
|
@@ -30,8 +44,28 @@ | |
"aiohttp_client", | ||
"version.py", | ||
) | ||
PACKAGE_INFO = {} | ||
with open(VERSION_FILENAME) as f: | ||
exec(f.read(), PACKAGE_INFO) | ||
|
||
setuptools.setup(version=PACKAGE_INFO["__version__"]) | ||
PACKAGE_FILENAME = os.path.join( | ||
BASE_DIR, | ||
"src", | ||
"opentelemetry", | ||
"instrumentation", | ||
"aiohttp_client", | ||
"package.py", | ||
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. will renaming the 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. Thanks. Will fix. |
||
) | ||
with open(PACKAGE_FILENAME) as f: | ||
exec(f.read(), PACKAGE_INFO) | ||
|
||
# Mark any instruments/runtime dependencies as test dependencies as well. | ||
extras_require["instruments"] = PACKAGE_INFO["_instruments"] | ||
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. Might be a dumb question but why can't we put the 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 can but this data is used in two places. In setup.cfg/py for pip to use and by instrumentor to do runtime checks. It is very similar to how we refer to We can still store it only in setup.cfg and then use a module like |
||
test_deps = extras_require.get("test", []) | ||
for dep in extras_require["instruments"]: | ||
test_deps.append(dep) | ||
|
||
extras_require["test"] = test_deps | ||
|
||
setuptools.setup( | ||
version=PACKAGE_INFO["__version__"], extras_require=extras_require | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright 2020, 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. | ||
|
||
|
||
_instruments = ("aiohttp ~= 3.0",) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# 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. | ||
# 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. | ||
|
||
|
||
_instruments = ("aiopg >= 0.13.0",) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# 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. | ||
# 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. | ||
|
||
|
||
_instruments = ("asgiref ~= 3.0",) |
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.
What's the rename for?
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.
.tox dir was cached and resulted in failed builds. Had to change the key in order to invalidate it.