Skip to content

Commit

Permalink
chore: adds cryptography as conditional import
Browse files Browse the repository at this point in the history
  • Loading branch information
bhimrazy committed Jul 11, 2024
1 parent a2d80c9 commit c69acf7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/litdata/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
_BOTO3_AVAILABLE = RequirementCache("boto3")
_TORCH_AUDIO_AVAILABLE = RequirementCache("torchaudio")
_ZSTD_AVAILABLE = RequirementCache("zstd")
_CRYPTOGRAPHY_AVAILABLE = RequirementCache("cryptography")
_GOOGLE_STORAGE_AVAILABLE = RequirementCache("google.cloud.storage")
_TQDM_AVAILABLE = RequirementCache("tqdm")

Expand Down
11 changes: 7 additions & 4 deletions src/litdata/utilities/encryption.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
from abc import ABC, abstractmethod
from typing import Optional

from cryptography.fernet import Fernet
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import padding, rsa
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from litdata.constants import _CRYPTOGRAPHY_AVAILABLE

if _CRYPTOGRAPHY_AVAILABLE:
from cryptography.fernet import Fernet
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import padding, rsa
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC


class Encryption(ABC):
Expand Down

0 comments on commit c69acf7

Please sign in to comment.