Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
42 changes: 31 additions & 11 deletions packages/python/ingestkit/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
This module provides a thin Python wrapper around the IngestKit Go binary.
"""

import os
import subprocess
import sys
import shutil
Expand All @@ -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!")
Expand All @@ -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()
6 changes: 4 additions & 2 deletions packages/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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'

Expand All @@ -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

Expand Down
Loading