diff --git a/.github/workflows/build_deploy.yml b/.github/workflows/build_deploy.yml index 03fb56277fb..5202ebd4c41 100644 --- a/.github/workflows/build_deploy.yml +++ b/.github/workflows/build_deploy.yml @@ -50,8 +50,12 @@ jobs: "$GITHUB_REF_NAME" =~ ^[0-9]+\.x$ ]]; then LIBRARY_VERSION=$(setuptools-scm --strip-dev) else - # All else, maintain the dev version - LIBRARY_VERSION=$(setuptools-scm) + # use version string explicitly set in the project metadata, if exists + LIBRARY_VERSION=$(grep '^version = ' pyproject.toml | tr -d '"' | cut -d' ' -f3) + if [[ -z $LIBRARY_VERSION ]]; then + # All else, maintain the dev version + LIBRARY_VERSION=$(setuptools-scm) + fi fi echo "${LIBRARY_VERSION}" | tee version.txt diff --git a/pyproject.toml b/pyproject.toml index bf2080b78d8..89ed9914f25 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,10 @@ build-backend = "setuptools.build_meta" [project] name = "ddtrace" +# DEV: to directly override the version specifier, comment this... dynamic = ["version"] +# ...and uncomment this +# version = "4.0.0.dev0" description = "Datadog APM client library" readme = "README.md" license = { text = "LICENSE.BSD3" } diff --git a/tests/lib_injection/conftest.py b/tests/lib_injection/conftest.py index 4a19953e736..0042f84aaf8 100644 --- a/tests/lib_injection/conftest.py +++ b/tests/lib_injection/conftest.py @@ -13,9 +13,10 @@ import pytest -from ddtrace._version import __version__ as host_ddtrace_version +from ddtrace.version import get_version +HOST_DDTRACE_VERSION = get_version() LIBS_INJECTION_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../lib-injection")) LIBS_INJECTION_SRC_DIR = os.path.join(LIBS_INJECTION_DIR, "sources") PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")) @@ -100,7 +101,7 @@ def ddtrace_injection_artifact(): # 5. Write the ddtrace version file version_file_path = os.path.join(sources_dir_in_session_tmp, "version") with open(version_file_path, "w") as f: - f.write(host_ddtrace_version) + f.write(HOST_DDTRACE_VERSION) yield sources_dir_in_session_tmp