We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/chrishayuk/chuk-mcp-ios-simulator'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
validate_package.pyβ’4.29 KiB
#!/usr/bin/env python3
"""
Package validation script for chuk-mcp-ios
Checks the built package structure and entry points.
"""
import os
import sys
import tarfile
import zipfile
from pathlib import Path
def validate_package():
"""Validate the built package."""
dist_dir = Path("dist")
if not dist_dir.exists():
print("β No dist directory found")
return False
# Find distribution files
tar_files = list(dist_dir.glob("*.tar.gz"))
whl_files = list(dist_dir.glob("*.whl"))
print("π¦ Built distributions:")
for f in tar_files + whl_files:
size = f.stat().st_size / 1024 # KB
print(f" π {f.name} ({size:.1f} KB)")
success = True
# Validate source distribution
if tar_files:
print("\nπ Validating source distribution...")
try:
with tarfile.open(tar_files[0]) as tf:
names = tf.getnames()
has_src = any('src/' in n for n in names)
has_pyproject = any('pyproject.toml' in n for n in names)
has_readme = any('README' in n for n in names)
has_py_files = any(n.endswith('.py') for n in names)
print(f" β Source layout: {'src/' if has_src else 'flat'}")
print(f" β pyproject.toml: {'found' if has_pyproject else 'missing'}")
print(f" β README: {'found' if has_readme else 'missing'}")
print(f" β Python files: {'found' if has_py_files else 'missing'}")
print(f" π Total files: {len(names)}")
if not has_pyproject:
print(" β οΈ Missing pyproject.toml")
success = False
except Exception as e:
print(f" β Error reading source distribution: {e}")
success = False
else:
print("β No source distribution (.tar.gz) found")
success = False
# Validate wheel
if whl_files:
print("\nπ― Validating wheel distribution...")
try:
with zipfile.ZipFile(whl_files[0]) as zf:
files = zf.namelist()
# Look for entry points
entry_points_files = [f for f in files if f.endswith('entry_points.txt')]
if entry_points_files:
ep_content = zf.read(entry_points_files[0]).decode()
print(" π Entry points found:")
current_section = None
for line in ep_content.split('\n'):
line = line.strip()
if not line:
continue
if line.startswith('[') and line.endswith(']'):
current_section = line
print(f" {line}")
elif '=' in line and current_section == '[console_scripts]':
print(f" {line}")
else:
print(" β οΈ No entry points found")
# Check for Python package files
py_files = [f for f in files if f.endswith('.py')]
print(f" π Python files in wheel: {len(py_files)}")
except Exception as e:
print(f" β Error reading wheel: {e}")
success = False
else:
print("β No wheel distribution (.whl) found")
success = False
return success
def main():
"""Main validation function."""
print("π Package Validation")
print("=" * 40)
success = validate_package()
print("\n" + "=" * 40)
if success:
print("β Package validation successful!")
print("\nπ€ Ready for publishing:")
print(" make publish-test # Test on test PyPI")
print(" make publish # Publish to PyPI")
print("\nπ After publishing, users can run:")
print(" uvx chuk-mcp-ios cli status")
print(" uvx chuk-mcp-ios mcp")
return 0
else:
print("β Package validation failed!")
print(" Fix the issues above before publishing")
return 1
if __name__ == "__main__":
sys.exit(main())