qrand
qrand copied to clipboard
Remove dependencies
Is your feature request related to a problem? Please describe.
As of May 2021, QRAND depends on NumPy
and randomgen
, but it only needs certain parts of these packages. Particularly, it only needs a number of data types (float64, uint32, uint64
) from the former, and the UserBitGenerator
class from the latter.
Describe the solution you'd like
Removing this dependencies would make QRAND faster, lighter, and less fragile. We would need:
- Data-type stubs for
NumPy
. These should not change very often and so they will be easy to maintain. - An interface equivalent to
UserBitGenerator
that can be implemented byQuantumBitGenerator
.
Describe alternatives you've considered
Apparently, randomgen
is slowly merging into NumPy
, so maybe in some time from now we will be able to naturally reduce the dependencies to only the latter with no additional effort. Nonetheless, NumPy
is a rather large library and we would only make use of a very limited portion of it.
Additional context
The randomgen
package depends on NumPy
itself, so it would be necessary to assess wether this dependency could be entirely removed.
Even if impractical, removing the explicit NumPy
dependency would help mitigating conflicts. Luckily, this should be easy to do. A possible solution would be building data-type stubs through Python's own ctypes
.
Regardless of the above, since QRAND is meant to be able to interface with NumPy
we would still need to keep it as an extra dependency.