diff --git a/.pylintrc b/.pylintrc index ecd788f66f5..ed06299952c 100644 --- a/.pylintrc +++ b/.pylintrc @@ -2,7 +2,7 @@ # A comma-separated list of package or module names from where C extensions may # be loaded. Extensions are loading into the active Python interpreter and may # run arbitrary code -extension-pkg-whitelist=numpy,scipy,autograd,toml,appdir,autograd.numpy,autograd.numpy.linalg,autograd.numpy.builtins,semantic_version,packaging,torch,tensorflow,tensorflow.contrib,tensorflow.contrib.eager,LazyLoader,networkx,networkx.dag +extension-pkg-whitelist=numpy,scipy,autograd,toml,appdir,autograd.numpy,autograd.numpy.linalg,autograd.numpy.builtins,packaging,torch,tensorflow,tensorflow.contrib,tensorflow.contrib.eager,LazyLoader,networkx,networkx.dag [TYPECHECK] @@ -10,12 +10,12 @@ extension-pkg-whitelist=numpy,scipy,autograd,toml,appdir,autograd.numpy,autograd # (useful for modules/projects where namespaces are manipulated during runtime # and thus existing member attributes cannot be deduced by static analysis. It # supports qualified module names, as well as Unix pattern matching. -ignored-modules=numpy,scipy,autograd,toml,appdir,autograd.numpy,autograd.numpy.linalg,autograd.numpy.builtins,semantic_version,packaging,torch,tensorflow,tensorflow.contrib,tensorflow.contrib.eager,LazyLoader,networkx,networkx.dag,math,pennylane.numpy +ignored-modules=numpy,scipy,autograd,toml,appdir,autograd.numpy,autograd.numpy.linalg,autograd.numpy.builtins,packaging,torch,tensorflow,tensorflow.contrib,tensorflow.contrib.eager,LazyLoader,networkx,networkx.dag,math,pennylane.numpy # List of classes names for which member attributes should not be checked # (useful for classes with attributes dynamically set). This supports can work # with qualified names. -ignored-classes=numpy,scipy,autograd,toml,appdir,autograd.numpy,autograd.numpy.linalg,autograd.numpy.builtins,semantic_version,packaging,torch,tensorflow,tensorflow.contrib,tensorflow.contrib.eager,LazyLoader,networkx,networkx.dag,math,pennylane.numpy,pennylane.numpy.random,pennylane.numpy.linalg,pennylane.numpy.builtins,pennylane.operation,rustworkx,kahypar +ignored-classes=numpy,scipy,autograd,toml,appdir,autograd.numpy,autograd.numpy.linalg,autograd.numpy.builtins,packaging,torch,tensorflow,tensorflow.contrib,tensorflow.contrib.eager,LazyLoader,networkx,networkx.dag,math,pennylane.numpy,pennylane.numpy.random,pennylane.numpy.linalg,pennylane.numpy.builtins,pennylane.operation,rustworkx,kahypar [MESSAGES CONTROL] diff --git a/doc/development/guide/installation.rst b/doc/development/guide/installation.rst index 24fd5c44d3e..981cd4d8d64 100644 --- a/doc/development/guide/installation.rst +++ b/doc/development/guide/installation.rst @@ -17,7 +17,6 @@ be installed alongside PennyLane: * `autograd `_ * `toml `_ * `appdirs `_ -* `semantic-version `_ >= 2.7 * `autoray `__ >= 0.6.11 * `packaging `_ diff --git a/pennylane/__init__.py b/pennylane/__init__.py index 80419832ae0..b10e0c315be 100644 --- a/pennylane/__init__.py +++ b/pennylane/__init__.py @@ -21,7 +21,8 @@ import numpy as _np -from semantic_version import SimpleSpec, Version +from packaging.specifiers import SpecifierSet +from packaging.version import Version from pennylane.boolean_fn import BooleanFn import pennylane.numpy @@ -387,7 +388,7 @@ def run_cnot(): if hasattr(plugin_device_class, "pennylane_requires") and Version( version() - ) not in SimpleSpec(plugin_device_class.pennylane_requires): + ) not in SpecifierSet(f"=={plugin_device_class.pennylane_requires}"): raise DeviceError( f"The {name} plugin requires PennyLane versions {plugin_device_class.pennylane_requires}, " f"however PennyLane version {__version__} is installed." diff --git a/pennylane/numpy/random.py b/pennylane/numpy/random.py index d3b161a547e..66b01dd1851 100644 --- a/pennylane/numpy/random.py +++ b/pennylane/numpy/random.py @@ -15,18 +15,18 @@ This package provides a wrapped version of autograd.numpy.random, such that it works with the PennyLane :class:`~.tensor` class. """ -import semantic_version from autograd.numpy import random as _random from numpy import __version__ as np_version from numpy.random import MT19937, PCG64, SFC64, Philox # pylint: disable=unused-import +from packaging.specifiers import SpecifierSet +from packaging.version import Version from .wrapper import tensor_wrapper, wrap_arrays wrap_arrays(_random.__dict__, globals()) -np_version_spec = semantic_version.SimpleSpec(">=0.17.0") -if np_version_spec.match(semantic_version.Version(np_version)): +if Version(np_version) in SpecifierSet(">=0.17.0"): # pylint: disable=too-few-public-methods # pylint: disable=missing-class-docstring class Generator(_random.Generator): diff --git a/requirements-ci.txt b/requirements-ci.txt index 102f6521586..ef83bbab267 100644 --- a/requirements-ci.txt +++ b/requirements-ci.txt @@ -7,7 +7,6 @@ rustworkx autograd toml appdirs -semantic_version packaging autoray>=0.6.1,<0.6.10 matplotlib diff --git a/requirements.txt b/requirements.txt index 35ffc8d4378..56163fd8667 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,6 @@ rustworkx~=0.12.1 autograd~=1.4 toml~=0.10 appdirs~=1.4 -semantic_version~=2.10 packaging autoray>=0.6.11 matplotlib~=3.5 diff --git a/setup.py b/setup.py index 6466a02abce..6bc6b6ae8b5 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,6 @@ "autograd", "toml", "appdirs", - "semantic-version>=2.7", "autoray>=0.6.11", "cachetools", "pennylane-lightning>=0.36", diff --git a/tests/.pylintrc b/tests/.pylintrc index a60dace1845..30479858048 100644 --- a/tests/.pylintrc +++ b/tests/.pylintrc @@ -2,7 +2,7 @@ # A comma-separated list of package or module names from where C extensions may # be loaded. Extensions are loading into the active Python interpreter and may # run arbitrary code -extension-pkg-whitelist=numpy,scipy,autograd,toml,appdir,autograd.numpy,autograd.numpy.linalg,autograd.numpy.builtins,semantic_version,packaging,torch,tensorflow,tensorflow.contrib,tensorflow.contrib.eager,LazyLoader,networkx,networkx.dag +extension-pkg-whitelist=numpy,scipy,autograd,toml,appdir,autograd.numpy,autograd.numpy.linalg,autograd.numpy.builtins,packaging,torch,tensorflow,tensorflow.contrib,tensorflow.contrib.eager,LazyLoader,networkx,networkx.dag [TYPECHECK] @@ -10,12 +10,12 @@ extension-pkg-whitelist=numpy,scipy,autograd,toml,appdir,autograd.numpy,autograd # (useful for modules/projects where namespaces are manipulated during runtime # and thus existing member attributes cannot be deduced by static analysis. It # supports qualified module names, as well as Unix pattern matching. -ignored-modules=numpy,scipy,autograd,toml,appdir,autograd.numpy,autograd.numpy.linalg,autograd.numpy.builtins,semantic_version,packaging,torch,tensorflow,tensorflow.contrib,tensorflow.contrib.eager,LazyLoader,networkx,networkx.dag,math,pennylane.numpy +ignored-modules=numpy,scipy,autograd,toml,appdir,autograd.numpy,autograd.numpy.linalg,autograd.numpy.builtins,packaging,torch,tensorflow,tensorflow.contrib,tensorflow.contrib.eager,LazyLoader,networkx,networkx.dag,math,pennylane.numpy # List of classes names for which member attributes should not be checked # (useful for classes with attributes dynamically set). This supports can work # with qualified names. -ignored-classes=numpy,scipy,autograd,toml,appdir,autograd.numpy,autograd.numpy.linalg,autograd.numpy.builtins,semantic_version,packaging,torch,tensorflow,tensorflow.contrib,tensorflow.contrib.eager,LazyLoader,networkx,networkx.dag,math,pennylane.numpy,pennylane.numpy.random,pennylane.numpy.linalg,pennylane.numpy.builtins,pennylane.operation,rustworkx,kahypar +ignored-classes=numpy,scipy,autograd,toml,appdir,autograd.numpy,autograd.numpy.linalg,autograd.numpy.builtins,packaging,torch,tensorflow,tensorflow.contrib,tensorflow.contrib.eager,LazyLoader,networkx,networkx.dag,math,pennylane.numpy,pennylane.numpy.random,pennylane.numpy.linalg,pennylane.numpy.builtins,pennylane.operation,rustworkx,kahypar [MESSAGES CONTROL]