Skip to content

Commit 4d7822a

Browse files
authored
Merge pull request #101 from IBM/release-planning-cleanup-v4
Release planning cleanup v4 - and --version flag for cli
2 parents 409b23c + 0e65e84 commit 4d7822a

File tree

8 files changed

+64
-35
lines changed

8 files changed

+64
-35
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@
2525
},
2626
"remoteEnv": {
2727
"MCPGATEWAY_DEV_MODE": "true",
28-
"VENV_DIR": "/Users/mg/.venv/mcpgateway"
28+
"VENV_DIR": "$HOME/.venv/mcpgateway"
2929
}
3030
}

.devcontainer/postCreateCommand.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fi
1111
make install-dev
1212

1313
# Run tests to verify setup
14-
make test
14+
# make test
1515

1616
echo "Devcontainer setup complete."
1717

.github/workflows/python-package.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,15 @@ jobs:
2929
with:
3030
python-version: ${{ matrix.python-version }}
3131

32-
# 3️⃣ Install build front-end; Keep pip current
32+
# 3️⃣ Install build front-end; Keep pip current; bootstrap venv
3333
- name: Install build tool
3434
run: |
3535
python3 -m pip install --upgrade pip
3636
python3 -m pip install build # PyPA-endorsed PEP 517 builder
3737
38+
- name: Bootstrap project venv
39+
run: make venv
40+
3841
# 4️⃣ Invoke the Makefile 'dist' target (creates ./dist/*.whl & *.tar.gz)
3942
- name: Build distributions
4043
run: make dist # Uses the Makefile's `dist` rule

Containerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM registry.access.redhat.com/ubi9-minimal:9.6-1747218906
1+
FROM registry.access.redhat.com/ubi9-minimal:9.6-1749489516
22
LABEL maintainer="Mihai Criveti" \
33
name="mcp/mcpgateway" \
44
version="0.1.0" \

Containerfile.lite

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ ARG PYTHON_VERSION=3.11 # Python major.minor series to track
2424
###########################
2525
# Base image for copying into scratch
2626
###########################
27-
FROM registry.access.redhat.com/ubi9/ubi-micro:9.6-1747318857 AS base
27+
FROM registry.access.redhat.com/ubi9/ubi-micro:9.6-1749632992 AS base
2828

2929
###########################
3030
# Builder stage
3131
###########################
32-
FROM registry.access.redhat.com/ubi9/ubi:9.6-1747219013 AS builder
32+
FROM registry.access.redhat.com/ubi9/ubi:9.6-1749542372 AS builder
3333
SHELL ["/bin/bash", "-c"]
3434

3535
ARG PYTHON_VERSION

Makefile

Lines changed: 47 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ check-env:
125125
# help: serve-ssl - Run Gunicorn behind HTTPS on :4444 (uses ./certs)
126126
# help: dev - Run fast-reload dev server (uvicorn)
127127
# help: run - Execute helper script ./run.sh
128+
# help: smoketest - Run smoketest.py --verbose (build container, add MCP server, test endpoints)
128129
# help: test - Run unit tests with pytest
129130
# help: test-curl - Smoke-test API endpoints with curl script
130131
# help: pytest-examples - Run README / examples through pytest-examples
@@ -159,6 +160,11 @@ certs: ## Generate ./certs/cert.pem & ./certs/key.pem
159160
chmod 640 certs/key.pem
160161

161162
## --- Testing -----------------------------------------------------------------
163+
smoketest:
164+
@echo "🚀 Running smoketest…"
165+
@./smoketest.py --verbose || { echo "❌ Smoketest failed!"; exit 1; }
166+
@echo "✅ Smoketest passed!"
167+
162168
test:
163169
@echo "🧪 Running tests..."
164170
@test -d "$(VENV_DIR)" || make venv
@@ -774,33 +780,46 @@ containerfile-update:
774780
# help: verify - Build + twine + check-manifest + pyroma (no upload)
775781
# help: publish - Verify, then upload to PyPI (needs TWINE_* creds)
776782
# =============================================================================
777-
.PHONY: dist wheel sdist verify publish
778-
779-
dist: clean ## Build wheel + sdist
780-
python3 -m build
781-
@echo "🛠 Wheel & sdist written to ./dist"
782-
783-
wheel: ## Build wheel only
784-
python3 -m build -w
785-
@echo "🛠 Wheel written to ./dist"
786-
787-
sdist: ## Build source distribution only
788-
python3 -m build -s
789-
@echo "🛠 Source distribution written to ./dist"
783+
.PHONY: dist wheel sdist verify publish publish-testpypi
784+
785+
dist: clean ## Build wheel + sdist into ./dist
786+
@test -d "$(VENV_DIR)" || $(MAKE) --no-print-directory venv
787+
@/bin/bash -eu -c "\
788+
source $(VENV_DIR)/bin/activate && \
789+
python3 -m pip install --quiet --upgrade pip build && \
790+
python3 -m build"
791+
@echo '🛠 Wheel & sdist written to ./dist'
792+
793+
wheel: ## Build wheel only
794+
@test -d "$(VENV_DIR)" || $(MAKE) --no-print-directory venv
795+
@/bin/bash -eu -c "\
796+
source $(VENV_DIR)/bin/activate && \
797+
python3 -m pip install --quiet --upgrade pip build && \
798+
python3 -m build -w"
799+
@echo '🛠 Wheel written to ./dist'
800+
801+
sdist: ## Build source distribution only
802+
@test -d "$(VENV_DIR)" || $(MAKE) --no-print-directory venv
803+
@/bin/bash -eu -c "\
804+
source $(VENV_DIR)/bin/activate && \
805+
python3 -m pip install --quiet --upgrade pip build && \
806+
python3 -m build -s"
807+
@echo '🛠 Source distribution written to ./dist'
790808

791809
verify: dist ## Build, run metadata & manifest checks
792-
twine check dist/* # metadata sanity
793-
check-manifest # sdist completeness
794-
pyroma -d . # metadata quality score
810+
@/bin/bash -c "source $(VENV_DIR)/bin/activate && \
811+
twine check dist/* && \
812+
check-manifest && \
813+
pyroma -d ."
795814
@echo "✅ Package verified – ready to publish."
796815

797816
publish: verify ## Verify, then upload to PyPI
798-
twine upload dist/* # creds via env vars or ~/.pypirc
817+
@/bin/bash -c "source $(VENV_DIR)/bin/activate && twine upload dist/*"
799818
@echo "🚀 Upload finished – check https://pypi.org/project/$(PROJECT_NAME)/"
800819

801-
publish-testpypi: verify ## Verify, then upload to TestPyPI
802-
twine upload --repository testpypi dist/* # creds via env vars or ~/.pypirc
803-
@echo "🚀 Upload finished – check https://pypi.org/project/$(PROJECT_NAME)/"
820+
publish-testpypi: verify ## Verify, then upload to TestPyPI
821+
@/bin/bash -c "source $(VENV_DIR)/bin/activate && twine upload --repository testpypi dist/*"
822+
@echo "🚀 Upload finished – check https://test.pypi.org/project/$(PROJECT_NAME)/"
804823

805824
# =============================================================================
806825
# 🦭 PODMAN CONTAINER BUILD & RUN
@@ -1620,7 +1639,7 @@ local-pypi-debug:
16201639
# help: devpi-clean - Full cycle: build → upload → install locally
16211640
# help: devpi-status - Show devpi server status
16221641
# help: devpi-web - Open devpi web interface
1623-
# help: devpi-delete - Delete mcpgateway==<ver> from devpi index
1642+
# help: devpi-delete - Delete mcp-contextforge-gateway==<ver> from devpi index
16241643

16251644

16261645
.PHONY: devpi-install devpi-init devpi-start devpi-stop devpi-setup-user devpi-upload \
@@ -1738,21 +1757,21 @@ devpi-upload: dist devpi-setup-user ## Build wheel/sdist, then upload
17381757
@echo "🌐 Browse packages: $(DEVPI_URL)/$(DEVPI_INDEX)"
17391758

17401759
devpi-test:
1741-
@echo "📥 Installing package from devpi..."
1760+
@echo "📥 Installing package mcp-contextforge-gateway from devpi..."
17421761
@if ! curl -s $(DEVPI_URL) >/dev/null 2>&1; then \
17431762
echo "❌ DevPi server not running. Run 'make devpi-start' first."; \
17441763
exit 1; \
17451764
fi
17461765
@/bin/bash -c "source $(VENV_DIR)/bin/activate && \
17471766
pip install --index-url $(DEVPI_URL)/$(DEVPI_INDEX)/+simple/ \
17481767
--extra-index-url https://pypi.org/simple/ \
1749-
--force-reinstall $(PROJECT_NAME)"
1750-
@echo "✅ Installed $(PROJECT_NAME) from devpi"
1768+
--force-reinstall mcp-contextforge-gateway"
1769+
@echo "✅ Installed mcp-contextforge-gateway from devpi"
17511770

17521771
devpi-clean: clean dist devpi-upload devpi-test
17531772
@echo "🎉 Full devpi cycle complete!"
17541773
@echo "📊 Package info:"
1755-
@/bin/bash -c "source $(VENV_DIR)/bin/activate && pip show $(PROJECT_NAME)"
1774+
@/bin/bash -c "source $(VENV_DIR)/bin/activate && pip show mcp-contextforge-gateway"
17561775

17571776
devpi-status:
17581777
@echo "🔍 DevPi server status:"
@@ -1848,11 +1867,11 @@ VER ?= $(shell python -c "import tomllib, pathlib; \
18481867
print(tomllib.loads(pathlib.Path('pyproject.toml').read_text())['project']['version'])" \
18491868
2>/dev/null || echo 0.0.0)
18501869

1851-
devpi-delete: devpi-setup-user ## Delete mcpgateway==$(VER) from index
1852-
@echo "🗑️ Removing mcpgateway==$(VER) from $(DEVPI_INDEX)"
1870+
devpi-delete: devpi-setup-user ## Delete mcp-contextforge-gateway==$(VER) from index
1871+
@echo "🗑️ Removing mcp-contextforge-gateway==$(VER) from $(DEVPI_INDEX)"
18531872
@/bin/bash -c "source $(VENV_DIR)/bin/activate && \
18541873
devpi use $(DEVPI_INDEX) && \
1855-
devpi remove -y mcpgateway==$(VER) || true"
1874+
devpi remove -y mcp-contextforge-gateway==$(VER) || true"
18561875
@echo "✅ Delete complete (if it existed)"
18571876

18581877

mcpgateway/cli.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141

4242
import uvicorn
4343

44+
from mcpgateway import __version__
45+
4446
# ---------------------------------------------------------------------------
4547
# Configuration defaults (overridable via environment variables)
4648
# ---------------------------------------------------------------------------
@@ -105,6 +107,11 @@ def _insert_defaults(raw_args: List[str]) -> List[str]:
105107
def main() -> None: # noqa: D401 – imperative mood is fine here
106108
"""Entry point for the *mcpgateway* console script (delegates to Uvicorn)."""
107109

110+
# Check for version flag
111+
if "--version" in sys.argv or "-V" in sys.argv:
112+
print(f"mcpgateway {__version__}")
113+
return
114+
108115
# Discard the program name and inspect the rest.
109116
user_args = sys.argv[1:]
110117
uvicorn_argv = _insert_defaults(user_args)

mcpgateway/wrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def _extract_base_url(url: str) -> str:
9494
raise ValueError(f"Invalid URL provided: {url}")
9595

9696
if "/servers/" in url:
97-
before_servers = parsed.path.split('/servers')[0]
97+
before_servers = parsed.path.split("/servers")[0]
9898
return f"{parsed.scheme}://{parsed.netloc}{before_servers}"
9999

100100
return f"{url}"

0 commit comments

Comments
 (0)