Skip to content

Commit 959dd66

Browse files
authored
Merge pull request #35 from NREL-Distribution-Suites/mcp_server_implementation
MCP server improvement
2 parents 39398fb + 26bbfa7 commit 959dd66

101 files changed

Lines changed: 6460 additions & 3057 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/main_test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Install dependencies
2525
run: |
2626
python -m pip install --upgrade pip
27-
python -m pip install ".[dev]"
27+
python -m pip install ".[dev,mcp]"
2828
- name: Run pytest
2929
run: |
3030
python -m pytest -v --disable-warnings tests
@@ -35,5 +35,5 @@ jobs:
3535
- uses: davidslusser/actions_python_ruff@v1.0.1
3636
with:
3737
src: "check src"
38-
pip_install_command: "pip install -e .[dev]"
38+
pip_install_command: "pip install -e .[dev,mcp]"
3939
python_version: "3.11"

.github/workflows/publish.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
environment:
9+
description: 'Environment to publish to'
10+
required: true
11+
type: choice
12+
options:
13+
- testpypi
14+
- pypi
15+
16+
jobs:
17+
build:
18+
name: Build distribution
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: "3.11"
28+
29+
- name: Install build dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install build twine
33+
34+
- name: Build package
35+
run: python -m build
36+
37+
- name: Check distribution
38+
run: twine check dist/*
39+
40+
- name: Store the distribution packages
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: python-package-distributions
44+
path: dist/
45+
46+
publish-to-testpypi:
47+
name: Publish to TestPyPI
48+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'testpypi'
49+
needs:
50+
- build
51+
runs-on: ubuntu-latest
52+
53+
environment:
54+
name: testpypi
55+
url: https://test.pypi.org/p/nrel-shift
56+
57+
permissions:
58+
id-token: write
59+
60+
steps:
61+
- name: Download all the dists
62+
uses: actions/download-artifact@v4
63+
with:
64+
name: python-package-distributions
65+
path: dist/
66+
67+
- name: Publish distribution to TestPyPI
68+
uses: pypa/gh-action-pypi-publish@release/v1
69+
with:
70+
repository-url: https://test.pypi.org/legacy/
71+
72+
publish-to-pypi:
73+
name: Publish to PyPI
74+
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'pypi')
75+
needs:
76+
- build
77+
runs-on: ubuntu-latest
78+
79+
environment:
80+
name: pypi
81+
url: https://pypi.org/p/nrel-shift
82+
83+
permissions:
84+
id-token: write
85+
86+
steps:
87+
- name: Download all the dists
88+
uses: actions/download-artifact@v4
89+
with:
90+
name: python-package-distributions
91+
path: dist/
92+
93+
- name: Publish distribution to PyPI
94+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/pull_request_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ jobs:
2929
- uses: davidslusser/actions_python_ruff@v1.0.1
3030
with:
3131
src: "check src"
32-
pip_install_command: "pip install -e .[dev]"
32+
pip_install_command: "pip install -e .[dev,mcp]"
3333
python_version: "3.11"

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
33
# Ruff version.
4-
rev: v0.2.1
4+
rev: v0.14.14
55
hooks:
66
# Run the linter.
77
- id: ruff

.vscode/mcp.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"servers": {
3+
"shift": {
4+
"type": "stdio",
5+
"command": "/opt/homebrew/Caskroom/miniconda/base/bin/shift-mcp-server",
6+
"env": {}
7+
}
8+
}
9+
}
10+

CHANGELOG.md

Lines changed: 0 additions & 63 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -132,53 +132,51 @@ We follow PEP 8 with some modifications enforced by Ruff:
132132

133133
### Docstring Format
134134

135-
Use Google-style docstrings:
135+
Use NumPy-style docstrings:
136136

137137
```python
138138
def function_name(param1: str, param2: int) -> bool:
139-
"""Brief description of function.
140-
139+
"""Brief one-line description of the function.
140+
141141
Longer description if needed, explaining the purpose
142142
and behavior of the function.
143-
143+
144144
Parameters
145145
----------
146146
param1 : str
147147
Description of param1.
148148
param2 : int
149149
Description of param2.
150-
150+
151151
Returns
152152
-------
153153
bool
154154
Description of return value.
155-
155+
156156
Raises
157157
------
158158
ValueError
159159
When invalid input is provided.
160-
160+
161161
Examples
162162
--------
163163
>>> function_name("test", 5)
164164
True
165165
"""
166-
pass
167166
```
168167

169168
### Type Hints
170169

171170
Use type hints throughout:
172171

173172
```python
174-
from typing import List, Dict, Optional
173+
from typing import Optional
175174

176175
def process_data(
177-
data: List[float],
178-
config: Optional[Dict[str, str]] = None
179-
) -> Dict[str, float]:
176+
data: list[float],
177+
config: Optional[dict[str, str]] = None,
178+
) -> dict[str, float]:
180179
"""Process data with optional configuration."""
181-
pass
182180
```
183181

184182
## Testing Guidelines
@@ -192,7 +190,7 @@ def process_data(
192190

193191
### Test Coverage
194192

195-
- Aim for >80% code coverage
193+
- Aim for > 80% code coverage on new code
196194
- Test both success and failure cases
197195
- Test edge cases and boundary conditions
198196
- Use parametrized tests for multiple scenarios
@@ -201,12 +199,14 @@ Example:
201199

202200
```python
203201
import pytest
202+
from shift import DistributionGraph, NodeModel
203+
from infrasys import Location
204204

205205
@pytest.fixture
206206
def sample_graph():
207-
"""Fixture providing a sample graph for testing."""
207+
"""Fixture providing a graph with one node."""
208208
graph = DistributionGraph()
209-
# Setup graph
209+
graph.add_node(NodeModel(name="n1", location=Location(x=-97.3, y=32.7)))
210210
return graph
211211

212212
@pytest.mark.parametrize("input,expected", [
@@ -278,8 +278,8 @@ Include:
278278

279279
## Questions and Support
280280

281-
- **Issues**: Use GitHub Issues for bugs and features
282-
- **Discussions**: Use GitHub Discussions for questions
281+
- **Issues**: Use [GitHub Issues](https://github.com/NREL-Distribution-Suites/shift/issues) for bugs and feature requests
282+
- **Discussions**: Use [GitHub Discussions](https://github.com/NREL-Distribution-Suites/shift/discussions) for questions
283283
- **Email**: Contact maintainers for sensitive issues
284284

285285
## License

0 commit comments

Comments
 (0)