Py3esourcezip [patched]
import zipfile import os def package_source(source_dir, output_zip): with zipfile.ZipFile(output_zip, 'w', zipfile.ZIP_DEFLATED) as zipf: for root, dirs, files in os.walk(source_dir): for file in files: # Exclude compiled bytecode and local environments if '__pycache__' in root or file.endswith('.pyc'): continue file_path = os.path.join(root, file) archive_name = os.path.relpath(file_path, start=source_dir) zipf.write(file_path, archive_name) print(f"Source successfully archived to output_zip") package_source('./src', 'py3_project_source.zip') Use code with caution. Extracting Source Code Packages
For GIS professionals, ZIP files are a daily tool, and ArcPy makes it simple to automate workflows involving them. Using Python's zipfile standard module in conjunction with ArcPy can save countless hours when moving, sharing, or processing data. py3esourcezip
Comprehensive management, modification, and unpacking of files. Bundled Execution import zipfile import os def package_source(source_dir