python3.pkgs.opencensus-context: init at 0.1.3

Split package into top-level Python library.

We need to propagate it just like any other package, otherwise
dependents cannot detect it during installation.

The __init__.py collide since it uses old-style namespaces so we get rid
of those. In the future we may need to extend the namespaces.
This was enough for my dependency opencensus-ext-azure.

Having it as a top-level Python is just common practice; there is no
good reason not to.

(cherry picked from commit b615ba8a5f)
This commit is contained in:
Frederik Rietdijk
2023-01-15 14:30:54 +01:00
committed by Frederik Rietdijk
parent b920b9da28
commit ca45b69b5d
3 changed files with 39 additions and 25 deletions

View File

@@ -0,0 +1,28 @@
{ buildPythonPackage
, fetchPypi
, lib
, unittestCheckHook
}:
buildPythonPackage rec {
pname = "opencensus-context";
version = "0.1.3";
src = fetchPypi {
inherit pname version;
sha256 = "sha256-oDEIw8ENjIC7Xd9cih8DMWH6YZcqmRf5ubOhhRfwCIw=";
};
pythonNamespaces = [
"opencensus.common"
];
doCheck = false; # No tests in archive
meta = with lib; {
description = "OpenCensus Runtime Context";
homepage = "https://github.com/census-instrumentation/opencensus-python/tree/master/context/opencensus-context";
license = licenses.asl20;
maintainers = with maintainers; [ billhuang ];
};
}

View File

@@ -1,24 +1,11 @@
{ buildPythonPackage
, fetchPypi
, lib
, python
, unittestCheckHook
, google-api-core
, opencensus-context
}:
let
opencensus-context = buildPythonPackage rec {
pname = "opencensus-context";
version = "0.1.3";
checkInputs = [ unittestCheckHook ];
src = fetchPypi {
inherit pname version;
sha256 = "sha256-oDEIw8ENjIC7Xd9cih8DMWH6YZcqmRf5ubOhhRfwCIw=";
};
};
in
buildPythonPackage rec {
pname = "opencensus";
version = "0.11.0";
@@ -28,23 +15,20 @@ buildPythonPackage rec {
sha256 = "sha256-AmIWq6uJ2U2FBJLz3GWVAFXsT4QRX6bHvq/7pEo0bkI=";
};
buildInputs = [
# opencensus-context is embedded in opencensus
propagatedBuildInputs = [
google-api-core
opencensus-context
];
propagatedBuildInputs = [
google-api-core
pythonNamespaces = [
"opencensus.common"
];
postInstall = ''
ln -sf ${opencensus-context}/${python.sitePackages}/opencensus/common/runtime_context \
$out/${python.sitePackages}/opencensus/common/
'';
doCheck = false; # No tests in sdist
checkInputs = [ unittestCheckHook ];
pythonImportsCheck = [ "opencensus" ];
pythonImportsCheck = [
"opencensus.common"
];
meta = with lib; {
description = "A stats collection and distributed tracing framework";

View File

@@ -6457,6 +6457,8 @@ self: super: with self; {
opencensus = callPackage ../development/python-modules/opencensus { };
opencensus-context = callPackage ../development/python-modules/opencensus-context { };
opencv3 = toPythonModule (pkgs.opencv3.override {
enablePython = true;
pythonPackages = self;