Repository: OpenMined/PySyft

Issue:
Remove ZSTD
**Is your feature request related to a problem? Please describe.**
ZSTD is used for compression in our serde process. However we don't need extra compression as we move to Protobuf.
ZSTD is usually a source of problems when installing PySyft with different hacks to solve it.

**Describe the solution you'd like**
Remove ZSTD dependency.
This will require removing the tests and its use in serde.

**Describe alternatives you've considered**
Protobuf covers compression.

**Additional context**



Discussion:
Hi @mccorby , I would like to work on this.
So, I guess I would need to remove the ZSTD functionalities in the `test` folder right? Is that it? Or do I need to remove ZSTD from the `compression.py` file in `PySyft/syft/serde/` too?
We'll probably [still want compression](https://eng.uber.com/trip-data-squeeze-json-encoding-compression/) with Protobuf, but we can probably use zlib instead of zstd (if that's any easier to install.)
Could we proceed with two steps? First remove ZSTD, then add another compression tool?

Sounds good to me!
@r0cketr1kky : Ideally, ZSTD should be removed from any place where it's used. This should include:
- Production code
- Tests
- Requirement files

And double check that it's not present either in any notebook (I think it's not).

Special care has to be taken when removing it from the production code (`serde`) as we want to leave the door open to have some other compression tool.
Hey, @mccorby I would like to work on this, is this issue taken up by someone? 
@r0cketr1kky are working on this?

Resolving patch:
diff --git a/syft/serde/compression.py b/syft/serde/compression.py
--- a/syft/serde/compression.py
+++ b/syft/serde/compression.py
@@ -7,18 +7,15 @@
 from lz4 import (  # noqa: F401
     frame,
 )  # needed as otherwise we will get: module 'lz4' has no attribute 'frame'
-import zstd
 
 from syft.exceptions import CompressionNotFoundException
 
 # COMPRESSION SCHEME INT CODES
 NO_COMPRESSION = 40
 LZ4 = 41
-ZSTD = 42
 scheme_to_bytes = {
     NO_COMPRESSION: NO_COMPRESSION.to_bytes(1, byteorder="big"),
     LZ4: LZ4.to_bytes(1, byteorder="big"),
-    ZSTD: ZSTD.to_bytes(1, byteorder="big"),
 }
 
 ## SECTION: chosen Compression Algorithm
@@ -48,20 +45,6 @@ def apply_lz4_compression(decompressed_input_bin) -> tuple:
     return lz4.frame.compress(decompressed_input_bin), LZ4
 
 
-def apply_zstd_compression(decompressed_input_bin) -> tuple:
-    """
-    Apply ZSTD compression to the input
-
-    Args:
-        decompressed_input_bin: the binary to be compressed
-
-    Returns:
-        a tuple (compressed_result, ZSTD)
-    """
-
-    return zstd.compress(decompressed_input_bin), ZSTD
-
-
 def apply_no_compression(decompressed_input_bin) -> tuple:
     """
     No compression is applied to the input
@@ -118,8 +101,6 @@ def _decompress(binary: bin) -> bin:
     # 1)  Decompress or return the original stream
     if compress_scheme == LZ4:
         return lz4.frame.decompress(binary)
-    elif compress_scheme == ZSTD:
-        return zstd.decompress(binary)
     elif compress_scheme == NO_COMPRESSION:
         return binary
     else:


Test patch:
diff --git a/test/serde/msgpack/test_msgpack_serde.py b/test/serde/msgpack/test_msgpack_serde.py
--- a/test/serde/msgpack/test_msgpack_serde.py
+++ b/test/serde/msgpack/test_msgpack_serde.py
@@ -416,14 +416,10 @@ def test_ndarray_serde(compress):
     assert numpy.array_equal(arr, arr_serialized_deserialized)
 
 
-@pytest.mark.parametrize(
-    "compress_scheme", [compression.LZ4, compression.ZSTD, compression.NO_COMPRESSION]
-)
+@pytest.mark.parametrize("compress_scheme", [compression.LZ4, compression.NO_COMPRESSION])
 def test_compress_decompress(compress_scheme):
     if compress_scheme == compression.LZ4:
         compression._apply_compress_scheme = compression.apply_lz4_compression
-    elif compress_scheme == compression.ZSTD:
-        compression._apply_compress_scheme = compression.apply_zstd_compression
     else:
         compression._apply_compress_scheme = compression.apply_no_compression
 
@@ -434,14 +430,10 @@ def test_compress_decompress(compress_scheme):
     assert original == decompressed
 
 
-@pytest.mark.parametrize(
-    "compress_scheme", [compression.LZ4, compression.ZSTD, compression.NO_COMPRESSION]
-)
+@pytest.mark.parametrize("compress_scheme", [compression.LZ4, compression.NO_COMPRESSION])
 def test_compressed_serde(compress_scheme):
     if compress_scheme == compression.LZ4:
         compression._apply_compress_scheme = compression.apply_lz4_compression
-    elif compress_scheme == compression.ZSTD:
-        compression._apply_compress_scheme = compression.apply_zstd_compression
     else:
         compression._apply_compress_scheme = compression.apply_no_compression
 
@@ -626,8 +618,6 @@ def test_float(compress):
     [
         (True, compression.LZ4),
         (False, compression.LZ4),
-        (True, compression.ZSTD),
-        (False, compression.ZSTD),
         (True, compression.NO_COMPRESSION),
         (False, compression.NO_COMPRESSION),
     ],
@@ -636,8 +626,6 @@ def test_hooked_tensor(compress, compress_scheme):
     if compress:
         if compress_scheme == compression.LZ4:
             compression._apply_compress_scheme = compression.apply_lz4_compression
-        elif compress_scheme == compression.ZSTD:
-            compression._apply_compress_scheme = compression.apply_zstd_compression
         else:
             compression._apply_compress_scheme = compression.apply_no_compression
     else: