diff --git a/pkgs/development/python-modules/opentelemetry-api/default.nix b/pkgs/development/python-modules/opentelemetry-api/default.nix new file mode 100644 index 000000000000..c38fb19faf36 --- /dev/null +++ b/pkgs/development/python-modules/opentelemetry-api/default.nix @@ -0,0 +1,58 @@ +{ lib +, buildPythonPackage +, pythonOlder +, fetchFromGitHub +, deprecated +, hatchling +, importlib-metadata +, opentelemetry-test-utils +, setuptools +, pytestCheckHook +}: + +let + self = buildPythonPackage { + pname = "opentelemetry-api"; + version = "1.18.0"; + disabled = pythonOlder "3.7"; + + src = fetchFromGitHub { + owner = "open-telemetry"; + repo = "opentelemetry-python"; + rev = "refs/tags/v${self.version}"; + hash = "sha256-h6XDzM29wYiC51S7OpBXvWFCfZ7DmIyGMG2pFjJV7pI="; + sparseCheckout = [ "/${self.pname}" ]; + } + "/${self.pname}"; + + format = "pyproject"; + + nativeBuildInputs = [ + hatchling + ]; + + propagatedBuildInputs = [ + deprecated + importlib-metadata + setuptools + ]; + + nativeCheckInputs = [ + opentelemetry-test-utils + pytestCheckHook + ]; + + pythonImportsCheck = [ "opentelemetry" ]; + + doCheck = false; + + # Enable tests via passthru to avoid cyclic dependency with opentelemetry-test-utils. + passthru.tests.${self.pname} = self.overridePythonAttrs { doCheck = true; }; + + meta = with lib; { + homepage = "https://opentelemetry.io"; + description = "OpenTelemetry Python API"; + license = licenses.asl20; + maintainers = teams.deshaw.members; + }; + }; +in self diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 52ac8c363123..788b8e34c9c5 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7094,6 +7094,8 @@ self: super: with self; { opentimestamps = callPackage ../development/python-modules/opentimestamps { }; + opentelemetry-api = callPackage ../development/python-modules/opentelemetry-api { }; + opentelemetry-proto = callPackage ../development/python-modules/opentelemetry-proto { }; opentelemetry-semantic-conventions = callPackage ../development/python-modules/opentelemetry-semantic-conventions { };