Publish to pypi (#466)

* Lowercase project name for server

* Update metadata for project

* Add GitHub Actions workflow for PyPI package publishing
main
Marcus Sanatan 2025-12-19 16:43:44 -04:00 committed by GitHub
parent df3a49334e
commit 12e1b62b2e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 128 additions and 3 deletions

76
.github/workflows/publish-pypi.yml vendored Normal file
View File

@ -0,0 +1,76 @@
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
on: push
jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./Server
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "latest"
enable-cache: true
cache-dependency-glob: "Server/uv.lock"
- name: Build a binary wheel and a source tarball
run: uv build
- name: Store the distribution packages
uses: actions/upload-artifact@v6
with:
name: python-package-distributions
path: Server/dist/
publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/mcpforunityserver
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v7
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
publish-to-testpypi:
name: Publish Python 🐍 distribution 📦 to TestPyPI
needs:
- build
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/mcpforunityserver
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v7
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

21
Server/LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 CoplayDev
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,8 +1,32 @@
[project] [project]
name = "MCPForUnityServer" name = "mcpforunityserver"
version = "8.2.3" version = "8.2.3"
description = "MCP for Unity Server: A Unity package for Unity Editor integration via the Model Context Protocol (MCP)." description = "MCP for Unity Server: A Unity package for Unity Editor integration via the Model Context Protocol (MCP)."
readme = "README.md" readme = "README.md"
license = "MIT"
authors = [
{name = "Marcus Sanatan", email = "msanatan@gmail.com"},
{name = "David Sarno", email = "david.sarno@gmail.com"},
{name = "Wu Shutong", email = "martinwfire@gmail.com"}
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Games/Entertainment",
"Topic :: Software Development :: Code Generators",
]
keywords = ["mcp", "unity", "ai", "model context protocol", "gamedev", "unity3d", "automation", "llm", "agent"]
requires-python = ">=3.10" requires-python = ">=3.10"
dependencies = [ dependencies = [
"httpx>=0.27.2", "httpx>=0.27.2",
@ -20,6 +44,10 @@ dev = [
"pytest-asyncio>=0.23", "pytest-asyncio>=0.23",
] ]
[project.urls]
Repository = "https://github.com/CoplayDev/unity-mcp.git"
Issues = "https://github.com/CoplayDev/unity-mcp/issues"
[project.scripts] [project.scripts]
mcp-for-unity = "main:main" mcp-for-unity = "main:main"

View File

@ -34,7 +34,7 @@ except ImportError:
HAS_HTTPX = False HAS_HTTPX = False
logger = logging.getLogger("unity-mcp-telemetry") logger = logging.getLogger("unity-mcp-telemetry")
PACKAGE_NAME = "MCPForUnityServer" PACKAGE_NAME = "mcpforunityserver"
def _version_from_local_pyproject() -> str: def _version_from_local_pyproject() -> str:
@ -60,7 +60,7 @@ def _version_from_local_pyproject() -> str:
version = project_table.get("version") or poetry_table.get("version") version = project_table.get("version") or poetry_table.get("version")
if version: if version:
return version return version
raise FileNotFoundError("pyproject.toml not found for MCPForUnityServer") raise FileNotFoundError("pyproject.toml not found for mcpforunityserver")
def get_package_version() -> str: def get_package_version() -> str: