Skip to content

Add repo to pip package #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 18, 2025
Merged

Add repo to pip package #12

merged 6 commits into from
Jul 18, 2025

Conversation

lamaalrajih
Copy link
Owner

@lamaalrajih lamaalrajih commented Jul 8, 2025

Also see #17 for changes!

This PR turns the repository into a clean, PEP 517-compliant package that can be installed with pip and uploaded to PyPI.

Key points

  • PEP 621 metadata – Introduces pyproject.toml with build-system requirements, full project metadata, dependencies, CLI entry-point (kicad-mcp), and package-data patterns.
  • Source & wheel build verifiedpython -m build succeeds; twine check passes; package installs from TestPyPI when combined with the main index.
  • Public API surfacedkicad_mcp/init.py now exposes metadata constants and high-level helpers via __all__, making from kicad_mcp import create_server possible.
  • Distribution assets added
    • MANIFEST.in to include license, readme, prompts, resources, docs
    • .python-version (3.10) and extended .gitignore for build artifacts

Checklist

  • Build passes locally (python -m build)
  • twine check dist/* passes
  • Uploaded to TestPyPI and installation verified

@mannie-exe
Copy link
Contributor

mannie-exe commented Jul 13, 2025

Hi @lamaalrajih! I noticed this PR addresses packaging but doesn't seem to be complete yet. I encountered some critical issues that need to be solved for the packaging to work properly.

The main blockers I found:

  1. Pydantic schema generation error - The server fails to start due to MCP.Image type lacking Pydantic v2 compatibility
  2. Dependency resolution issues - Unpinned dependencies cause different behavior between pip and uv

My solution:

  • Migrated to uv for better dependency management with lock file
  • Fixed the Pydantic error by removing problematic return type annotations

Fork

Would you like me to create a separate PR or discuss here? Either way, I'm happy to help get the packaging finalized! The project is really valuable and deserves proper PyPI distribution.

EDIT

Some background on the MCP issue:


Example MCP Configs

Local/Development

"kicad": {
  "command": "uv",
  "args": [
    "--directory",
    "/absolute/path/to/kicad-mcp-folder/", // NOT `main.py`
    "run",
    "main.py" // `main.py` here
  ],
  "env": {
    "KICAD_SEARCH_PATHS": "/absolute/path/to/eda-files"
  }
}

PyPi

"kicad": {
  "command": "uvx",
  "args": [
    "kicad-mcp"
  ],
  "env": {
    "KICAD_SEARCH_PATHS": "/absolute/path/to/eda-files"
  }
}

Git

"kicad": {
  "command": "uvx",
  "args": [
    "--from",
    "git+https://github.com/lamaalrajih/kicad-mcp@latest", // + tag/commit/branch
    "kicad-mcp" // PyPi tool name
  ],
  "env": {
    "KICAD_SEARCH_PATHS": "/absolute/path/to/eda-files"
  }
}

- add uv.lock for reproducible dependencies
- add .python-version file for python version consistency
- pin dependency versions in pyproject.toml (mcp>=1.11.0, pandas>=2.3.1, pytest>=8.4.1)
- remove type annotations from Image-returning functions to avoid pydantic v2 schema generation errors
  - resolves MCP server startup failure
@lamaalrajih
Copy link
Owner Author

Hey @mannie-exe ! Thanks so much for doing all this work :)

Honestly, if you could open it in a separate PR, it would be great! It would also help close #16. I'll just close this PR once you have yours up.

Really appreciate all the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants