diff --git a/.gitignore b/.gitignore index 0557e2b..770ace2 100644 --- a/.gitignore +++ b/.gitignore @@ -155,5 +155,16 @@ examples/*/__pycache__/ examples/*/node_modules/ examples/*/ingestkit/ +# ============================================================================= +# Python Packages +# ============================================================================= +__pycache__/ +*.py[cod] +*$py.class +*.egg-info/ +*.egg +dist/ +.eggs/ + # Test artifacts tests/benchmarks/benchmark diff --git a/packages/python/ingestkit/cli.py b/packages/python/ingestkit/cli.py index 2bc6a38..a150cac 100644 --- a/packages/python/ingestkit/cli.py +++ b/packages/python/ingestkit/cli.py @@ -4,6 +4,7 @@ This module provides a thin Python wrapper around the IngestKit Go binary. """ +import os import subprocess import sys import shutil @@ -12,10 +13,10 @@ def main(): """ Main entry point for the ingestkit CLI command. - This simply forwards all arguments to the Go binary. + This simply forwards all arguments to the Go binary (ingestkit-cli). """ - # Find the ingestkit binary - binary = shutil.which('ingestkit') + # Find the ingestkit-cli binary (named differently to avoid conflict with this Python entry point) + binary = shutil.which('ingestkit-cli') if not binary: print("āŒ IngestKit CLI binary not found!") @@ -28,14 +29,33 @@ def main(): sys.exit(1) # Forward all arguments to the binary - try: - result = subprocess.run([binary] + sys.argv[1:], check=False) - sys.exit(result.returncode) - except KeyboardInterrupt: - sys.exit(130) # Standard exit code for SIGINT - except Exception as e: - print(f"āŒ Error running ingestkit: {e}") - sys.exit(1) + args = [binary] + sys.argv[1:] + + # On Unix-like systems, use execvp to replace this process with the binary. + # This avoids file descriptor inheritance issues (like EAGAIN/Errno 35 on macOS) + # that can occur when stdin/stdout are in non-blocking mode. + if hasattr(os, 'execvp'): + try: + os.execvp(binary, args) + except OSError as e: + print(f"āŒ Error running ingestkit: {e}") + sys.exit(1) + else: + # Windows fallback: use subprocess with explicit fd handling + try: + result = subprocess.run( + args, + stdin=sys.stdin, + stdout=sys.stdout, + stderr=sys.stderr, + check=False + ) + sys.exit(result.returncode) + except KeyboardInterrupt: + sys.exit(130) # Standard exit code for SIGINT + except Exception as e: + print(f"āŒ Error running ingestkit: {e}") + sys.exit(1) if __name__ == '__main__': main() diff --git a/packages/python/setup.py b/packages/python/setup.py index 3d9b00c..65af364 100644 --- a/packages/python/setup.py +++ b/packages/python/setup.py @@ -14,7 +14,7 @@ import stat import sys -VERSION = "0.1.0" +VERSION = "0.1.7" BINARY_BASE_URL = "https://github.com/feat7/ingestkit/releases/download/v{version}" def get_platform_info(): @@ -64,7 +64,8 @@ def download_binary(): os.makedirs(install_dir, exist_ok=True) - binary_path = os.path.join(install_dir, 'ingestkit') + # Use a different name for the Go binary to avoid conflicts with Python entry point + binary_path = os.path.join(install_dir, 'ingestkit-cli') if system_name == 'windows': binary_path += '.exe' @@ -87,6 +88,7 @@ def download_binary(): print(f"\nšŸ’” Manual installation:") print(f" Visit: https://github.com/feat7/ingestkit/releases/latest") print(f" Download: {binary_name}") + print(f" Rename to: ingestkit-cli") print(f" Move to: {install_dir}") raise