Skip to content

Commit be56aaf

Browse files
authored
Merge pull request IBM#3 from IBM/linting
Update Makefile and pyproject.toml with packaging steps
2 parents 1e0a90d + 71d85c3 commit be56aaf

File tree

6 files changed

+185
-40
lines changed

6 files changed

+185
-40
lines changed

CHANGELOG.md

Whitespace-only changes.

MANIFEST.in

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# ──────────────────────────────────────────────────────────────
2+
# MANIFEST.in – source-distribution contents for mcpgateway
3+
# ──────────────────────────────────────────────────────────────
4+
5+
# 1️⃣ Core project files that SDists/Wheels should always carry
6+
include LICENSE
7+
include README.md
8+
include pyproject.toml
9+
include gunicorn.config.py
10+
include Containerfile
11+
include Containerfile.lite
12+
13+
# 2️⃣ Top-level config, examples and helper scripts
14+
include *.py
15+
include *.md
16+
include *.example
17+
include *.lock
18+
include *.properties
19+
include *.toml
20+
include *.yaml
21+
include *.yml
22+
include *.json
23+
include *.sh
24+
include *.txt
25+
26+
# 3️⃣ Tooling/lint configuration dot-files (explicit so they're not lost)
27+
include .darglint
28+
include .dockerignore
29+
include .flake8
30+
include .htmlhintrc
31+
include .pycodestyle
32+
include .pylintrc
33+
include .whitesource
34+
include .coveragerc
35+
#include .gitignore # purely optional but many projects ship it
36+
37+
# 4️⃣ Runtime data that lives *inside* the package at import time
38+
recursive-include mcpgateway/templates *.html
39+
recursive-include mcpgateway/static *.css *.js *.gif *.png *.svg
40+
recursive-include mcpgateway *.pyi py.typed
41+
42+
# 5️⃣ (Optional) include MKDocs-based docs in the sdist
43+
graft docs
44+
45+
# 6️⃣ Never publish caches, compiled or build outputs
46+
global-exclude __pycache__ *.py[cod] *.so *.dylib
47+
prune build
48+
prune dist
49+
prune .eggs
50+
prune *.egg-info

Makefile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,41 @@ containerfile-update:
688688
@sed -i.bak -E 's|^(FROM\s+\S+):[^\s]+|\1:latest|' Containerfile && rm -f Containerfile.bak
689689
@echo "✅ Base image updated to latest."
690690

691+
692+
# =============================================================================
693+
# 📦 PACKAGING & PUBLISHING
694+
# =============================================================================
695+
# help: 📦 PACKAGING & PUBLISHING
696+
# help: dist - Clean-build wheel *and* sdist into ./dist
697+
# help: wheel - Build wheel only
698+
# help: sdist - Build source distribution only
699+
# help: verify - Build + twine + check-manifest + pyroma (no upload)
700+
# help: publish - Verify, then upload to PyPI (needs TWINE_* creds)
701+
# =============================================================================
702+
.PHONY: dist wheel sdist verify publish
703+
704+
dist: clean ## Build wheel + sdist
705+
python -m build
706+
@echo "🛠 Wheel & sdist written to ./dist"
707+
708+
wheel: ## Build wheel only
709+
python -m build -w
710+
@echo "🛠 Wheel written to ./dist"
711+
712+
sdist: ## Build source distribution only
713+
python -m build -s
714+
@echo "🛠 Source distribution written to ./dist"
715+
716+
verify: dist ## Build, run metadata & manifest checks
717+
twine check dist/* # metadata sanity
718+
check-manifest # sdist completeness
719+
pyroma -d . # metadata quality score
720+
@echo "✅ Package verified – ready to publish."
721+
722+
publish: verify ## Verify, then upload to PyPI
723+
twine upload dist/* # creds via env vars or ~/.pypirc
724+
@echo "🚀 Upload finished – check https://pypi.org/project/$(PROJECT_NAME)/"
725+
691726
# =============================================================================
692727
# 🦭 PODMAN CONTAINER BUILD & RUN
693728
# =============================================================================

SECURITY.md

Whitespace-only changes.

mcpgateway/py.typed

Whitespace-only changes.

pyproject.toml

Lines changed: 100 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,44 @@
1+
# ----------------------------------------------------------------
2+
# 💡 Build system (PEP 517)
3+
# • setuptools ≥ 77 gives SPDX licence support (PEP 639)
4+
# • wheel is needed by most build front-ends
5+
# ----------------------------------------------------------------
16
[build-system]
2-
requires = [ "setuptools>=42", "wheel",]
7+
requires = ["setuptools>=77", "wheel"]
38
build-backend = "setuptools.build_meta"
49

10+
# ----------------------------------------------------------------
11+
# 📦 Core project metadata (PEP 621)
12+
# ----------------------------------------------------------------
513
[project]
614
name = "mcpgateway"
7-
version = "1.0.0"
8-
description = "A production-ready MCP Gateway built with FastAPI and the official MCP Python SDK"
15+
version = "0.1.0"
16+
description = "A production-ready MCP Gateway built with FastAPI and support for virtual servers"
917
keywords = ["MCP", "Gateway", "API", "Agents", "Tools"]
1018
classifiers = [
11-
"Development Status :: 3 - Alpha",
19+
"Development Status :: 4 - Beta",
1220
"Intended Audience :: Developers",
13-
"License :: OSI Approved :: Apache Software License",
1421
"Programming Language :: Python :: 3",
1522
"Programming Language :: Python :: 3.10",
1623
"Programming Language :: Python :: 3.11",
1724
"Programming Language :: Python :: 3.12",
1825
"Framework :: FastAPI",
1926
]
2027
readme = "README.md"
21-
requires-python = ">=3.10"
28+
requires-python = ">=3.10,<3.13"
29+
30+
# SPDX licence expression + explicit licence file (PEP 639)
31+
license = "Apache-2.0"
32+
license-files = ["LICENSE"]
33+
34+
# Maintainers
35+
maintainers = [
36+
{name = "Mihai Criveti", email = "[email protected]"}
37+
]
38+
39+
# ----------------------------------------------------------------
40+
# Runtime dependencies
41+
# ----------------------------------------------------------------
2242
dependencies = [
2343
"cryptography>=45.0.3",
2444
"fastapi>=0.115.12",
@@ -39,14 +59,18 @@ dependencies = [
3959
"uvicorn>=0.34.2",
4060
"zeroconf>=0.147.0",
4161
]
42-
[[project.authors]]
43-
name = "Mihai Criveti"
44-
45-
46-
[project.license]
47-
text = "Apache License 2.0"
4862

63+
# ----------------------------------------------------------------
64+
# Optional dependency groups (extras)
65+
# ----------------------------------------------------------------
4966
[project.optional-dependencies]
67+
68+
# Optional dependency groups (runtime)
69+
redis = [
70+
"redis>=6.1.0",
71+
]
72+
73+
# Optional dependency groups (development)
5074
dev = [
5175
"argparse-manpage>=4.6",
5276
"autoflake>=2.3.1",
@@ -84,26 +108,75 @@ dev = [
84108
"pytest-rerunfailures>=15.1",
85109
"pytest-xdist>=3.6.1",
86110
"pytype>=2024.10.11",
87-
"pytype>=2024.10.11",
88111
"radon>=6.0.1",
89112
"ruff>=0.11.11",
90113
"settings-doc>=4.3.2",
91114
"snakeviz>=2.2.2",
92115
"ty>=0.0.1a6",
116+
"twine>=6.1.0",
93117
"types-tabulate>=0.9.0.20241207",
94118
]
95-
redis = [
96-
"redis>=6.1.0",
97-
]
119+
120+
# Convenience meta-extras
121+
all = ["mcpgateway[redis]"]
122+
dev-all = ["mcpgateway[redis,dev]"]
123+
124+
# --------------------------------------------------------------------
125+
# Authors and URLs
126+
# --------------------------------------------------------------------
127+
[[project.authors]]
128+
name = "Mihai Criveti"
129+
98130

99131
[project.urls]
100-
Homepage = "https://github.com/IBM/mcp-context-forge"
101-
Documentation = "https://github.com/IBM/mcp-context-forge/docs"
102-
Source = "https://github.com/IBM/mcp-context-forge"
132+
Homepage = "https://ibm.github.io/mcp-context-forge/"
133+
Documentation = "https://ibm.github.io/mcp-context-forge/"
134+
Repository = "https://github.com/IBM/mcp-context-forge"
135+
"Bug Tracker" = "https://github.com/IBM/mcp-context-forge/issues"
136+
Changelog = "https://github.com/IBM/mcp-context-forge/blob/main/CHANGELOG.md"
137+
138+
# --------------------------------------------------------------------
139+
# 🔧 setuptools-specific configuration
140+
# --------------------------------------------------------------------
141+
[tool.setuptools]
142+
include-package-data = true # ensure wheels include the data files
143+
144+
# Automatic discovery: keep every package that starts with "mcpgateway"
145+
[tool.setuptools.packages.find]
146+
include = ["mcpgateway*"]
147+
exclude = ["tests*"]
148+
149+
## Runtime data files ------------------------------------------------
150+
# - py.typed -> advertises inline type hints (PEP 561)
151+
# - static/* -> CSS/JS for the admin UI
152+
# - templates -> Jinja2 templates shipped at runtime
153+
[tool.setuptools.package-data]
154+
mcpgateway = [
155+
"py.typed",
156+
"static/*.css",
157+
"static/*.js",
158+
"templates/*.html"
159+
]
160+
161+
# --------------------------------------------------------------------
162+
# 🛠 Tool configurations (black, mypy, etc.)
163+
# --------------------------------------------------------------------
164+
[tool.pytype]
165+
# Directory-specific options:
166+
inputs = ["mcpgateway"]
167+
python_version = "3.11" # match default runtime
168+
169+
[tool.check-manifest]
170+
ignore = [
171+
"docs/**",
172+
"tests/**",
173+
".github/**",
174+
"Makefile",
175+
]
103176

104177
[tool.black]
105178
line-length = 200
106-
target-version = [ "py310",]
179+
target-version = ["py310", "py311", "py312"]
107180
include = "\\.pyi?$"
108181

109182
[tool.isort]
@@ -115,36 +188,22 @@ python_version = "3.10"
115188
warn_return_any = true
116189
warn_unused_configs = true
117190
disallow_untyped_defs = true
191+
strict = true
192+
show_error_codes = true
193+
warn_unreachable = true
118194

119195
[tool.pytest.ini_options]
120196
minversion = "6.0"
121197
addopts = "-ra -q --cov=mcpgateway"
122198
testpaths = [ "tests",]
123199
asyncio_mode = "auto"
124200

125-
[tool.setuptools.packages.find]
126-
where = [ ".",]
127-
include = [ "mcpgateway*",]
128-
129-
[tool.pytype]
130-
# Directory-specific options:
131-
inputs = ["mcpgateway"]
132-
python_version = "3.11" # match your default runtime
133-
134-
[tool.check-manifest]
135-
# Usually you only need 'ignore', but other flags are available.
136-
ignore = [
137-
"docs/**",
138-
"tests/**",
139-
".github/**",
140-
"Makefile",
141-
]
142-
201+
# ── fawltydeps ─────────────────────────────────────────────────────
143202
[tool.fawltydeps]
144-
# only parse your main pyproject.toml
203+
# only parse main pyproject.toml
145204
deps = ["pyproject.toml"]
146205

147-
# ignore all of your 'dev' extras so they won't show up
206+
# ignore 'dev' extras so they won't show up in fawltydeps
148207
ignore_unused = [
149208
"autoflake",
150209
"argparse-manpage",
@@ -189,5 +248,6 @@ ignore_unused = [
189248
"settings-doc",
190249
"snakeviz",
191250
"types-tabulate",
251+
"twine",
192252
"uvicorn"
193253
]

0 commit comments

Comments
 (0)