requirement.txt
import os # Path to the directory containing the downloaded packages package_dir = '/path/to/my_packages' # List to hold the package names and versions requirements = [] # Iterate over all files in the directory for filename in os.listdir(package_dir): # Process .whl files if filename.endswith('.whl'): # Split the filename by dashes and underscores to extract the package name and version parts = filename.split('-') package_name = parts[0] version = parts[1] requirements.append(f'{package_name}=={version}') # Process .tar.gz files elif filename.endswith('.tar.gz'): # Remove the .tar.gz and split the filename by dashes to extract the package name and version parts = filename.replace('.tar.gz', '').split('-') packa...