diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml new file mode 100644 index 00000000..f5d70928 --- /dev/null +++ b/.github/workflows/publish-pypi.yml @@ -0,0 +1,76 @@ +name: Publish mcpshelf to PyPI + +on: + push: + branches: [main] + paths: + - "sdks/python/**" + - ".github/workflows/publish-pypi.yml" + tags: + - "python-v*" + - "v*" + pull_request: + branches: [main] + paths: + - "sdks/python/**" + - ".github/workflows/publish-pypi.yml" + workflow_dispatch: + +permissions: read-all + +jobs: + build-and-test: + name: Build & Test mcpshelf Python SDK + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + + - name: Set up Python + uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 + with: + python-version: "3.11" + + - name: Install build, twine & test deps + run: | + python -m pip install --upgrade pip build twine + python -m pip install -e sdks/python + + - name: Run Python SDK smoke tests + run: | + python -m unittest discover -s sdks/python/tests -v + + - name: Build sdist/wheel and check with twine + run: | + cd sdks/python + python -m build + python -m twine check dist/* + + - name: Upload built distributions + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: mcpshelf-pypi-dist + path: sdks/python/dist/* + + publish-pypi: + name: Publish mcpshelf to PyPI + needs: [build-and-test] + if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/python-v') || startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + permissions: + id-token: write + contents: read + steps: + - name: Download built distributions + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.0 + with: + name: mcpshelf-pypi-dist + path: dist/ + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # release/v1 + with: + packages-dir: dist/ + password: ${{ secrets.PYPI_API_TOKEN }} + skip-existing: true diff --git a/sdks/python/pyproject.toml b/sdks/python/pyproject.toml index 25292e49..b9d632f9 100644 --- a/sdks/python/pyproject.toml +++ b/sdks/python/pyproject.toml @@ -10,7 +10,7 @@ readme = "README.md" authors = [ { name = "RitualDev Lab", email = "developer@ritualdev.in" } ] -license = { text = "Apache-2.0" } +license = "Apache-2.0" keywords = [ "mcp", "model-context-protocol", @@ -24,7 +24,6 @@ keywords = [ classifiers = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", - "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", diff --git a/sdks/python/src/mcpshelf/cli.py b/sdks/python/src/mcpshelf/cli.py index 3ae1759e..1fa069e0 100644 --- a/sdks/python/src/mcpshelf/cli.py +++ b/sdks/python/src/mcpshelf/cli.py @@ -54,21 +54,7 @@ def main(): run_server() return - if cmd == "list":CPShelf Python CLI - Open Registry for MCP Servers & Dev Tools (https://mcp.ritualdev.in) - -Usage: - mcpshelf explore Interactive terminal browser & installer - mcpshelf search Search 419+ verified MCP servers - mcpshelf tools Search 577+ free open-source dev tools (DevShelf) - mcpshelf get Inspect metadata & install configs - mcpshelf audit Run trust score & security check - mcpshelf-mcp Run stdio MCP server for AI agents -""") - return - - cmd = args[0] - - if cmd == "explore": + if cmd in ("list", "explore"): catalog = get_servers() print(f"\n⚡ MCPShelf Terminal Explorer ({len(catalog)} Verified Servers)") print("=" * 70) diff --git a/sdks/python/tests/test_mcpshelf_sdk.py b/sdks/python/tests/test_mcpshelf_sdk.py new file mode 100644 index 00000000..3688036b --- /dev/null +++ b/sdks/python/tests/test_mcpshelf_sdk.py @@ -0,0 +1,15 @@ +import unittest + + +class TestMcpShelfSdk(unittest.TestCase): + def test_imports_and_entrypoints(self): + import mcpshelf + from mcpshelf import cli, server + + self.assertTrue(hasattr(cli, "main")) + self.assertTrue(hasattr(server, "main")) + self.assertIsNotNone(mcpshelf) + + +if __name__ == "__main__": + unittest.main()