Skip to content

Commit beeb84c

Browse files
committed
[main] updating README.md for pypi. Improving bumping version script. Bumping version.
1 parent 7d07f4a commit beeb84c

File tree

7 files changed

+95
-20
lines changed

7 files changed

+95
-20
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
A simple yet powerful Python client for interacting with Model Context Protocol (MCP) servers using Ollama, allowing local LLMs to use tools.
1111

12-
![ollmpc usage demo gif](misc/ollmcp-demo.gif)
12+
![ollmpc usage demo gif](https://github.com/jonigl/mcp-client-for-ollama/blob/main/misc/ollmcp-demo.gif)
1313

1414
## Overview
1515

@@ -100,7 +100,7 @@ ollmcp --servers-json /path/to/servers.json --model llama3.2:1b
100100

101101
During chat, use these commands:
102102

103-
![ollmcp main interface](misc/ollmcp-welcome.jpg)
103+
![ollmcp main interface](https://github.com/jonigl/mcp-client-for-ollama/blob/main/misc/ollmcp-welcome.jpg)
104104

105105
| Command | Shortcut | Description |
106106
|---------|----------|-------------|
@@ -120,7 +120,7 @@ During chat, use these commands:
120120

121121
The tool and server selection interface allows you to enable or disable specific tools:
122122

123-
![ollmcp model selection interface](misc/ollmpc-model-selection.jpg)
123+
![ollmcp model selection interface](https://github.com/jonigl/mcp-client-for-ollama/raw/main/misc/ollmpc-model-selection.jpg)
124124

125125
- Enter **numbers** separated by commas (e.g. `1,3,5`) to toggle specific tools
126126
- Enter **ranges** of numbers (e.g. `5-8`) to toggle multiple consecutive tools
@@ -135,7 +135,7 @@ The tool and server selection interface allows you to enable or disable specific
135135

136136
The model selection interface shows all available models in your Ollama installation:
137137

138-
![ollmcp tool and server selection interface](misc/ollmpc-tool-and-server-selection.jpg)
138+
![ollmcp tool and server selection interface](https://github.com/jonigl/mcp-client-for-ollama/blob/main/misc/ollmpc-tool-and-server-selection.jpg)
139139

140140
- Enter the **number** of the model you want to use
141141
- `s` or `save` - Save the model selection and return to chat

cli-package/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A command-line interface for connecting to MCP servers using Ollama.
44

5-
![alt text](../misc/ollmcp-welcome.jpg)
5+
![alt text](https://github.com/jonigl/mcp-client-for-ollama/blob/main/misc/ollmcp-demo.gif)
66

77
## Installation
88

cli-package/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "ollmcp"
3-
version = "0.2.1"
3+
version = "0.2.2"
44
description = "CLI for MCP Client for Ollama - An easy-to-use command for interacting with Ollama through MCP"
55
readme = "README.md"
66
requires-python = ">=3.10"
@@ -9,7 +9,7 @@ authors = [
99
{name = "Jonathan Löwenstern"}
1010
]
1111
dependencies = [
12-
"mcp-client-for-ollama==0.2.1"
12+
"mcp-client-for-ollama==0.2.2"
1313
]
1414

1515
[project.scripts]

mcp_client_for_ollama/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""MCP Client for Ollama package."""
22

3-
__version__ = "0.2.1"
3+
__version__ = "0.2.2"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "mcp-client-for-ollama"
3-
version = "0.2.1"
3+
version = "0.2.2"
44
description = "MCP Client for Ollama - A client for connecting to Model Context Protocol servers using Ollama"
55
readme = "README.md"
66
requires-python = ">=3.10"

scripts/bump_version.py

Lines changed: 85 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,49 @@
1212
from pathlib import Path
1313

1414

15+
def regenerate_uvlock(directory):
16+
"""Regenerate the uv.lock file in the specified directory."""
17+
import subprocess
18+
try:
19+
subprocess.run(["uv", "lock"], cwd=directory, check=True)
20+
return True
21+
except (subprocess.SubprocessError, FileNotFoundError):
22+
print(f"Warning: Failed to regenerate uv.lock in {directory}")
23+
return False
24+
25+
def check_version_consistency(files):
26+
"""Check if versions are consistent across all files."""
27+
versions = {}
28+
29+
30+
# Check pyproject.toml files
31+
for name, file_path in files.items():
32+
if "pyproject" in name and file_path.exists():
33+
try:
34+
versions[str(file_path)] = read_version(file_path)
35+
except ValueError:
36+
versions[str(file_path)] = "VERSION NOT FOUND"
37+
38+
# Check __init__.py files
39+
for name, file_path in files.items():
40+
if "init" in name and file_path.exists():
41+
try:
42+
with open(file_path, 'r') as f:
43+
content = f.read()
44+
match = re.search(r'__version__\s*=\s*"([^"]+)"', content)
45+
if match:
46+
versions[str(file_path)] = match.group(1)
47+
else:
48+
versions[str(file_path)] = "VERSION NOT FOUND"
49+
except Exception:
50+
versions[str(file_path)] = "ERROR READING FILE"
51+
52+
# Check if all versions match
53+
unique_versions = set(v for v in versions.values()
54+
if v not in ["VERSION NOT FOUND", "ERROR READING FILE"])
55+
56+
return unique_versions, versions
57+
1558
def read_version(file_path):
1659
"""Read the current version from a pyproject.toml file."""
1760
with open(file_path, 'r') as f:
@@ -89,16 +132,44 @@ def main():
89132
"--version",
90133
help="Custom version to set when using the 'custom' bump type"
91134
)
135+
parser.add_argument(
136+
"--force",
137+
action="store_true",
138+
help="Force version bump even if inconsistencies are detected"
139+
)
92140
args = parser.parse_args()
93141

94142
# Get repo root directory
95-
repo_root = Path(__file__).parent.parent.absolute()
143+
repo_root = Path(__file__).parent.parent.absolute()
96144

97145
# Define paths
146+
files = {
147+
"main_pyproject": repo_root / "pyproject.toml",
148+
"cli_pyproject": repo_root / "cli-package" / "pyproject.toml",
149+
"main_init": repo_root / "mcp_client_for_ollama" / "__init__.py",
150+
"cli_init": repo_root / "cli-package" / "ollmcp" / "__init__.py"
151+
}
152+
153+
# Calculate and check versions for consistency
154+
print("Checking version consistency across files...")
155+
unique_versions, all_versions = check_version_consistency(files)
156+
157+
if len(unique_versions) > 1:
158+
print("\nWARNING: Version inconsistency detected!")
159+
print("The following files have different versions:")
160+
for file_path, version in all_versions.items():
161+
print(f" - {file_path}: {version}")
162+
163+
if not args.force:
164+
print("\nOperation aborted. Use --force to proceed with version bump despite inconsistencies.")
165+
return
166+
print("\nProceeding with version bump despite inconsistencies (--force flag used).")
167+
else:
168+
print("\nAll files have consistent versions.")
169+
170+
# Read current version from main package
98171
main_pyproject = repo_root / "pyproject.toml"
99-
cli_pyproject = repo_root / "cli-package" / "pyproject.toml"
100-
main_init = repo_root / "mcp_client_for_ollama" / "__init__.py"
101-
cli_init = repo_root / "cli-package" / "ollmcp" / "__init__.py"
172+
102173

103174
# Read current version
104175
current_version = read_version(main_pyproject)
@@ -125,20 +196,24 @@ def main():
125196
print(f"Updating main package version in {main_pyproject}")
126197
update_version_in_file(main_pyproject, new_version)
127198

128-
print(f"Updating CLI package version in {cli_pyproject}")
129-
update_version_in_file(cli_pyproject, new_version)
199+
print(f"Updating CLI package version in {files['cli_pyproject']}")
200+
update_version_in_file(files['cli_pyproject'], new_version)
130201

131202
# Update __version__ in __init__.py files if they exist
132203
print(f"Checking for __init__.py files...")
133-
update_version_in_init(main_init, new_version)
134-
update_version_in_init(cli_init, new_version)
204+
update_version_in_init(files['main_init'], new_version)
205+
update_version_in_init(files['cli_init'], new_version)
206+
207+
# Regenerate uv.lock files
208+
print("Regenerating uv.lock files...")
209+
regenerate_uvlock(repo_root)
135210

136211
print(f"Version bump complete! {current_version} -> {new_version}")
137212
print("\nNext steps:")
138213
print(f"1. Commit the changes: git commit -am \"Bump version to {new_version}\"")
139-
print("2. Create a tag: git tag -a v{new_version} -m \"Version {new_version}\"")
214+
print(f"2. Create a tag: git tag -a v{new_version} -m \"Version {new_version}\"")
140215
print("3. Push changes: git push && git push --tags")
141-
print("4. Build and publish the packages")
216+
print("4. Build and publish the packages will be done automatically by CI/CD pipeline.")
142217

143218

144219
if __name__ == "__main__":

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)