The PyPA recommended tool for installing Python packages.
91
A command-line utility that verifies downloaded Python packages against expected hash values to ensure integrity and security.
@generates
def compute_hash(file_path: str, algorithm: str = "sha256") -> str:
"""
Compute the hash of a package file using the specified algorithm.
Args:
file_path: Path to the package file
algorithm: Hash algorithm to use (sha256, sha384, or sha512)
Returns:
Hexadecimal hash string
Raises:
FileNotFoundError: If file does not exist
ValueError: If algorithm is not supported
"""
pass
def verify_hash(file_path: str, expected_hash: str, algorithm: str = "sha256") -> bool:
"""
Verify that a package file matches the expected hash.
Args:
file_path: Path to the package file
expected_hash: Expected hash value in hexadecimal
algorithm: Hash algorithm to use (sha256, sha384, or sha512)
Returns:
True if hash matches, False otherwise
Raises:
FileNotFoundError: If file does not exist
ValueError: If algorithm is not supported
"""
pass
def generate_requirements_with_hashes(package_files: list[str], algorithms: list[str] = None) -> str:
"""
Generate requirements.txt format output with hash values for package files.
Args:
package_files: List of paths to package files (wheel or sdist)
algorithms: List of hash algorithms to use (defaults to ["sha256"])
Returns:
String in requirements.txt format with --hash options
Raises:
FileNotFoundError: If any file does not exist
ValueError: If any algorithm is not supported
"""
passProvides hash computation functionality for Python packages. Use pip's hash computation capabilities to generate secure hashes for package verification.
Install with Tessl CLI
npx tessl i tessl/pypi-pipevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10