Skip to content

Commit

Permalink
Refactor bootstrap generation
Browse files Browse the repository at this point in the history
This makes the bootstrap script get the package version directly from
pypi instead of from our lists of packages. This makes sure that the
packages are actually available for the end user to install.

Fixes open-telemetry#2053
  • Loading branch information
ocelotl committed Dec 22, 2023
1 parent 9563ee7 commit c99007c
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,178 +18,174 @@
libraries = [
{
"library": "aio_pika >= 7.2.0, < 10.0.0",
"instrumentation": "opentelemetry-instrumentation-aio-pika==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-aio-pika==0.43b0",
},
{
"library": "aiohttp ~= 3.0",
"instrumentation": "opentelemetry-instrumentation-aiohttp-client==0.44b0.dev",
},
{
"library": "aiohttp ~= 3.0",
"instrumentation": "opentelemetry-instrumentation-aiohttp-server==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-aiohttp-client==0.43b0",
},
{
"library": "aiopg >= 0.13.0, < 2.0.0",
"instrumentation": "opentelemetry-instrumentation-aiopg==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-aiopg==0.43b0",
},
{
"library": "asgiref ~= 3.0",
"instrumentation": "opentelemetry-instrumentation-asgi==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-asgi==0.43b0",
},
{
"library": "asyncpg >= 0.12.0",
"instrumentation": "opentelemetry-instrumentation-asyncpg==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-asyncpg==0.43b0",
},
{
"library": "boto~=2.0",
"instrumentation": "opentelemetry-instrumentation-boto==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-boto==0.43b0",
},
{
"library": "boto3 ~= 1.0",
"instrumentation": "opentelemetry-instrumentation-boto3sqs==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-boto3sqs==0.43b0",
},
{
"library": "botocore ~= 1.0",
"instrumentation": "opentelemetry-instrumentation-botocore==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-botocore==0.43b0",
},
{
"library": "cassandra-driver ~= 3.25",
"instrumentation": "opentelemetry-instrumentation-cassandra==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-cassandra==0.43b0",
},
{
"library": "scylla-driver ~= 3.25",
"instrumentation": "opentelemetry-instrumentation-cassandra==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-cassandra==0.43b0",
},
{
"library": "celery >= 4.0, < 6.0",
"instrumentation": "opentelemetry-instrumentation-celery==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-celery==0.43b0",
},
{
"library": "confluent-kafka >= 1.8.2, <= 2.2.0",
"instrumentation": "opentelemetry-instrumentation-confluent-kafka==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-confluent-kafka==0.43b0",
},
{
"library": "django >= 1.10",
"instrumentation": "opentelemetry-instrumentation-django==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-django==0.43b0",
},
{
"library": "elasticsearch >= 2.0",
"instrumentation": "opentelemetry-instrumentation-elasticsearch==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-elasticsearch==0.43b0",
},
{
"library": "falcon >= 1.4.1, < 3.1.2",
"instrumentation": "opentelemetry-instrumentation-falcon==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-falcon==0.43b0",
},
{
"library": "fastapi ~= 0.58",
"instrumentation": "opentelemetry-instrumentation-fastapi==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-fastapi==0.43b0",
},
{
"library": "flask >= 1.0, < 3.0",
"instrumentation": "opentelemetry-instrumentation-flask==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-flask==0.43b0",
},
{
"library": "werkzeug < 3.0.0",
"instrumentation": "opentelemetry-instrumentation-flask==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-flask==0.43b0",
},
{
"library": "grpcio ~= 1.27",
"instrumentation": "opentelemetry-instrumentation-grpc==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-grpc==0.43b0",
},
{
"library": "httpx >= 0.18.0",
"instrumentation": "opentelemetry-instrumentation-httpx==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-httpx==0.43b0",
},
{
"library": "jinja2 >= 2.7, < 4.0",
"instrumentation": "opentelemetry-instrumentation-jinja2==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-jinja2==0.43b0",
},
{
"library": "kafka-python >= 2.0",
"instrumentation": "opentelemetry-instrumentation-kafka-python==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-kafka-python==0.43b0",
},
{
"library": "mysql-connector-python ~= 8.0",
"instrumentation": "opentelemetry-instrumentation-mysql==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-mysql==0.43b0",
},
{
"library": "mysqlclient < 3",
"instrumentation": "opentelemetry-instrumentation-mysqlclient==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-mysqlclient==0.43b0",
},
{
"library": "pika >= 0.12.0",
"instrumentation": "opentelemetry-instrumentation-pika==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-pika==0.43b0",
},
{
"library": "psycopg2 >= 2.7.3.1",
"instrumentation": "opentelemetry-instrumentation-psycopg2==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-psycopg2==0.43b0",
},
{
"library": "pymemcache >= 1.3.5, < 5",
"instrumentation": "opentelemetry-instrumentation-pymemcache==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-pymemcache==0.43b0",
},
{
"library": "pymongo >= 3.1, < 5.0",
"instrumentation": "opentelemetry-instrumentation-pymongo==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-pymongo==0.43b0",
},
{
"library": "PyMySQL < 2",
"instrumentation": "opentelemetry-instrumentation-pymysql==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-pymysql==0.43b0",
},
{
"library": "pyramid >= 1.7",
"instrumentation": "opentelemetry-instrumentation-pyramid==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-pyramid==0.43b0",
},
{
"library": "redis >= 2.6",
"instrumentation": "opentelemetry-instrumentation-redis==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-redis==0.43b0",
},
{
"library": "remoulade >= 0.50",
"instrumentation": "opentelemetry-instrumentation-remoulade==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-remoulade==0.43b0",
},
{
"library": "requests ~= 2.0",
"instrumentation": "opentelemetry-instrumentation-requests==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-requests==0.43b0",
},
{
"library": "scikit-learn ~= 0.24.0",
"instrumentation": "opentelemetry-instrumentation-sklearn==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-sklearn==0.43b0",
},
{
"library": "sqlalchemy",
"instrumentation": "opentelemetry-instrumentation-sqlalchemy==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-sqlalchemy==0.43b0",
},
{
"library": "starlette ~= 0.13.0",
"instrumentation": "opentelemetry-instrumentation-starlette==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-starlette==0.43b0",
},
{
"library": "psutil >= 5",
"instrumentation": "opentelemetry-instrumentation-system-metrics==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-system-metrics==0.43b0",
},
{
"library": "tornado >= 5.1.1",
"instrumentation": "opentelemetry-instrumentation-tornado==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-tornado==0.43b0",
},
{
"library": "tortoise-orm >= 0.17.0",
"instrumentation": "opentelemetry-instrumentation-tortoiseorm==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-tortoiseorm==0.43b0",
},
{
"library": "pydantic >= 1.10.2",
"instrumentation": "opentelemetry-instrumentation-tortoiseorm==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-tortoiseorm==0.43b0",
},
{
"library": "urllib3 >= 1.0.0, < 3.0.0",
"instrumentation": "opentelemetry-instrumentation-urllib3==0.44b0.dev",
"instrumentation": "opentelemetry-instrumentation-urllib3==0.43b0",
},
]
default_instrumentations = [
"opentelemetry-instrumentation-aws-lambda==0.44b0.dev",
"opentelemetry-instrumentation-dbapi==0.44b0.dev",
"opentelemetry-instrumentation-logging==0.44b0.dev",
"opentelemetry-instrumentation-sqlite3==0.44b0.dev",
"opentelemetry-instrumentation-urllib==0.44b0.dev",
"opentelemetry-instrumentation-wsgi==0.44b0.dev",
"opentelemetry-instrumentation-aws-lambda==0.43b0",
"opentelemetry-instrumentation-dbapi==0.43b0",
"opentelemetry-instrumentation-logging==0.43b0",
"opentelemetry-instrumentation-sqlite3==0.43b0",
"opentelemetry-instrumentation-urllib==0.43b0",
"opentelemetry-instrumentation-wsgi==0.43b0",
]
25 changes: 15 additions & 10 deletions scripts/otel_packaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
# limitations under the License.

import os
import subprocess
from subprocess import CalledProcessError

import tomli
from requests import get


scripts_path = os.path.dirname(os.path.abspath(__file__))
root_path = os.path.dirname(scripts_path)
Expand All @@ -29,17 +30,21 @@ def get_instrumentation_packages():
if not os.path.isdir(pkg_path):
continue

error = f"Could not get version for package {pkg}"
try:
version = subprocess.check_output(
"hatch version",
shell=True,
cwd=pkg_path,
universal_newlines=True,
response = get(
f"https://pypi.org/pypi/{pkg}/json"
)
except CalledProcessError as exc:
print(f"Could not get hatch version from path {pkg_path}")
print(exc.output)
raise exc

except Exception as exc:
print(error)
continue

if response.status_code != 200:
print(error)
continue

version = response.json()["info"]["version"]

pyproject_toml_path = os.path.join(pkg_path, "pyproject.toml")

Expand Down

0 comments on commit c99007c

Please sign in to comment.