pythonPackages.qiskit-terra: init at 0.12.0

Qiskit is a quantum information toolkit from IBM. This commit
follows the new Qiskit scheme of breaking from one large package into
smaller packages (terra, aer, etc), and then having a single
meta-package "qiskit" that comprises them.
This commit is contained in:
Drew Risinger 2020-01-20 18:56:43 -05:00 committed by Jon
parent ee3226bc65
commit 49ad19b257
2 changed files with 121 additions and 0 deletions

@ -0,0 +1,119 @@
{ lib
, pythonOlder
, buildPythonPackage
, fetchFromGitHub
, cython
, dill
, jsonschema
, numpy
, marshmallow
, marshmallow-polyfield
, matplotlib
, networkx
, ply
, psutil
, scipy
, sympy
# test requirements
, ddt
, hypothesis
, ipywidgets
, nbformat
, nbconvert
, pillow
, pydot
, python
, pygraphviz
, pylatexenc
, pytestCheckHook
}:
buildPythonPackage rec {
pname = "qiskit-terra";
version = "0.12.0";
disabled = pythonOlder "3.5";
src = fetchFromGitHub {
owner = "Qiskit";
repo = pname;
rev = version;
sha256 = "1yarfziy2w8n1d7zyyxykfs68608j8md4kwfyhbyc6wy483fk9sy";
};
nativeBuildInputs = [ cython ];
propagatedBuildInputs = [
dill
jsonschema
numpy
marshmallow
marshmallow-polyfield
matplotlib
networkx
ply
psutil
scipy
sympy
];
# *** Tests ***
checkInputs = [
ddt
hypothesis
ipywidgets
nbformat
nbconvert
pillow
pydot
pygraphviz
pylatexenc
pytestCheckHook
];
pythonImportsCheck = [
"qiskit"
"qiskit.transpiler.passes.routing.cython.stochastic_swap.swap_trial"
];
dontUseSetuptoolsCheck = true; # can't find setup.py, so fails. tested by pytest
disabledTests = [
"test_long_name" # generated circuit images differ for some reason
"test_jupyter_jobs_pbars" # needs IBMQ provider package (qiskit-ibmq-provider), circular dependency
];
pytestFlagsArray = [
"--ignore=test/randomized/test_transpiler_equivalence.py" # collection requires qiskit-aer, which would cause circular dependency
];
# Moves tests to $PACKAGEDIR/test. They can't be run from /build because of finding
# cythonized modules and expecting to find some resource files in the test directory.
preCheck = ''
export PACKAGEDIR=$out/${python.sitePackages}
echo "Moving Qiskit test files to package directory"
cp -r $TMP/source/test $PACKAGEDIR
cp -r $TMP/source/examples $PACKAGEDIR
cp -r $TMP/source/qiskit/schemas/examples $PACKAGEDIR/qiskit/schemas/
# run pytest from Nix's $out path
pushd $PACKAGEDIR
'';
postCheck = ''
rm -rf test
rm -rf examples
popd
'';
meta = with lib; {
description = "Provides the foundations for Qiskit.";
longDescription = ''
Allows the user to write quantum circuits easily, and takes care of the constraints of real hardware.
'';
homepage = "https://github.com/QISKit/qiskit-terra";
license = licenses.asl20;
maintainers = with maintainers; [ drewrisinger ];
};
}

@ -6969,6 +6969,8 @@ in {
qiskit = callPackage ../development/python-modules/qiskit { };
qiskit-terra = callPackage ../development/python-modules/qiskit-terra { };
qasm2image = callPackage ../development/python-modules/qasm2image { };
simpy = callPackage ../development/python-modules/simpy { };