greenpick 0.1.5__tar.gz → 0.1.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {greenpick-0.1.5/src/greenpick.egg-info → greenpick-0.1.6}/PKG-INFO +30 -6
- {greenpick-0.1.5 → greenpick-0.1.6}/README.md +29 -5
- {greenpick-0.1.5 → greenpick-0.1.6}/pyproject.toml +1 -1
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/__init__.py +1 -1
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/server.py +23 -1
- {greenpick-0.1.5 → greenpick-0.1.6/src/greenpick.egg-info}/PKG-INFO +30 -6
- {greenpick-0.1.5 → greenpick-0.1.6}/tests/test_services.py +17 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/LICENSE +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/setup.cfg +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/__main__.py +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/config.py +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/data/__init__.py +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/data/_net.py +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/data/auto_repository.py +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/data/eia_repository.py +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/data/electricitymaps_repository.py +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/data/emission_factors.json +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/data/entsoe_repository.py +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/data/gpu_power.json +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/data/inference_energy.json +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/data/instance_families.json +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/data/mock_repository.py +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/data/network.json +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/data/power.json +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/data/pricing.json +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/data/regions.json +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/data/repository.py +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/data/static_data.py +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/models.py +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/services/__init__.py +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/services/carbon_service.py +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/services/cost_service.py +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/services/forecast_service.py +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/services/inference_service.py +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/services/instance_service.py +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/services/latency_service.py +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/services/locality_service.py +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/services/metric_scaffold_service.py +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/services/recommender.py +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/services/residency_service.py +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/services/rightsizing_service.py +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/services/scheduling_service.py +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/services/serving_service.py +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick/services/training_service.py +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick.egg-info/SOURCES.txt +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick.egg-info/dependency_links.txt +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick.egg-info/entry_points.txt +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick.egg-info/requires.txt +0 -0
- {greenpick-0.1.5 → greenpick-0.1.6}/src/greenpick.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: greenpick
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.6
|
|
4
4
|
Summary: Design-time sustainability co-pilot (MCP server): greener, cheaper cloud infrastructure decisions with carbon + cost + latency tradeoffs.
|
|
5
5
|
Author-email: "Data Science Advisers, LLC" <info@datascienceadvisers.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -254,15 +254,39 @@ of the options below.)
|
|
|
254
254
|
}
|
|
255
255
|
```
|
|
256
256
|
|
|
257
|
-
**In a Jupyter notebook or Python script**,
|
|
257
|
+
**In a Jupyter notebook or Python script**, connect with the MCP client library and pass the keys
|
|
258
|
+
in `env`. The library starts GreenPick as a separate process and doesn't forward the notebook's own
|
|
259
|
+
environment variables to it:
|
|
258
260
|
|
|
259
261
|
```python
|
|
260
|
-
import
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
262
|
+
import sys
|
|
263
|
+
from mcp import ClientSession, StdioServerParameters
|
|
264
|
+
from mcp.client.stdio import stdio_client
|
|
265
|
+
|
|
266
|
+
params = StdioServerParameters(
|
|
267
|
+
command=sys.executable,
|
|
268
|
+
args=["-m", "greenpick"],
|
|
269
|
+
env={
|
|
270
|
+
"GREENPICK_CARBON_SOURCE": "auto",
|
|
271
|
+
"EIA_API_KEY": "your-eia-key",
|
|
272
|
+
"ENTSOE_TOKEN": "your-entsoe-token",
|
|
273
|
+
},
|
|
274
|
+
)
|
|
275
|
+
|
|
276
|
+
# In Jupyter, errlog must be a real file (the notebook's stderr has no fileno()).
|
|
277
|
+
with open("greenpick-server.log", "w") as errlog:
|
|
278
|
+
async with stdio_client(params, errlog=errlog) as (read, write):
|
|
279
|
+
async with ClientSession(read, write) as session:
|
|
280
|
+
await session.initialize()
|
|
281
|
+
result = await session.call_tool(
|
|
282
|
+
"region_carbon_now", {"provider": "aws", "region": "us-west-2"}
|
|
283
|
+
)
|
|
284
|
+
print(result.content[0].text)
|
|
264
285
|
```
|
|
265
286
|
|
|
287
|
+
Top-level `await` works in Jupyter. In a plain script, put the `with` block inside an `async def`
|
|
288
|
+
and run it with `asyncio.run(...)`.
|
|
289
|
+
|
|
266
290
|
Every carbon figure includes a `quality` field: `live` means real grid data, `mock` means a
|
|
267
291
|
fallback value. Check it to confirm live data is on.
|
|
268
292
|
|
|
@@ -224,15 +224,39 @@ of the options below.)
|
|
|
224
224
|
}
|
|
225
225
|
```
|
|
226
226
|
|
|
227
|
-
**In a Jupyter notebook or Python script**,
|
|
227
|
+
**In a Jupyter notebook or Python script**, connect with the MCP client library and pass the keys
|
|
228
|
+
in `env`. The library starts GreenPick as a separate process and doesn't forward the notebook's own
|
|
229
|
+
environment variables to it:
|
|
228
230
|
|
|
229
231
|
```python
|
|
230
|
-
import
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
232
|
+
import sys
|
|
233
|
+
from mcp import ClientSession, StdioServerParameters
|
|
234
|
+
from mcp.client.stdio import stdio_client
|
|
235
|
+
|
|
236
|
+
params = StdioServerParameters(
|
|
237
|
+
command=sys.executable,
|
|
238
|
+
args=["-m", "greenpick"],
|
|
239
|
+
env={
|
|
240
|
+
"GREENPICK_CARBON_SOURCE": "auto",
|
|
241
|
+
"EIA_API_KEY": "your-eia-key",
|
|
242
|
+
"ENTSOE_TOKEN": "your-entsoe-token",
|
|
243
|
+
},
|
|
244
|
+
)
|
|
245
|
+
|
|
246
|
+
# In Jupyter, errlog must be a real file (the notebook's stderr has no fileno()).
|
|
247
|
+
with open("greenpick-server.log", "w") as errlog:
|
|
248
|
+
async with stdio_client(params, errlog=errlog) as (read, write):
|
|
249
|
+
async with ClientSession(read, write) as session:
|
|
250
|
+
await session.initialize()
|
|
251
|
+
result = await session.call_tool(
|
|
252
|
+
"region_carbon_now", {"provider": "aws", "region": "us-west-2"}
|
|
253
|
+
)
|
|
254
|
+
print(result.content[0].text)
|
|
234
255
|
```
|
|
235
256
|
|
|
257
|
+
Top-level `await` works in Jupyter. In a plain script, put the `with` block inside an `async def`
|
|
258
|
+
and run it with `asyncio.run(...)`.
|
|
259
|
+
|
|
236
260
|
Every carbon figure includes a `quality` field: `live` means real grid data, `mock` means a
|
|
237
261
|
fallback value. Check it to confirm live data is on.
|
|
238
262
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "greenpick"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.6"
|
|
4
4
|
description = "Design-time sustainability co-pilot (MCP server): greener, cheaper cloud infrastructure decisions with carbon + cost + latency tradeoffs."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.11"
|
|
@@ -4,7 +4,7 @@ Greener cloud-region choices with honest carbon + cost + latency tradeoffs,
|
|
|
4
4
|
delivered inside the vibe-coding loop. Directional guidance, not audited accounting.
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
|
-
__version__ = "0.1.
|
|
7
|
+
__version__ = "0.1.6"
|
|
8
8
|
|
|
9
9
|
# httpx logs every request URL at INFO, and our live sources pass their API key / token as a URL
|
|
10
10
|
# query parameter — so at the default log level the secret would land in the MCP client's logs.
|
|
@@ -18,7 +18,29 @@ from .services import (
|
|
|
18
18
|
)
|
|
19
19
|
from .models import ServingHub
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
# Sent to every MCP client at connect. Agents learn a server from its tool list, not its README, and
|
|
22
|
+
# the tool list starts with region-picking — so without this they lead with the rarest decision and
|
|
23
|
+
# skip the most valuable one. This names the strongest uses first and the reporting rules that matter.
|
|
24
|
+
INSTRUCTIONS = """\
|
|
25
|
+
GreenPick advises on cloud infrastructure decisions BEFORE you deploy, weighing carbon, cost and \
|
|
26
|
+
latency together. Strongest uses, in order:
|
|
27
|
+
1. Right-sizing (rightsizing_check): an over-provisioned instance cut to a standard, buyable size \
|
|
28
|
+
saves money and carbon in the same move. Lead with the monthly dollar saving.
|
|
29
|
+
2. Scheduling deferrable jobs: cleanest_hours_to_run (one-off), cleanest_time_of_day (recurring), \
|
|
30
|
+
carbon_forecast (EU day-ahead).
|
|
31
|
+
3. GPU training and LLM inference footprints: estimate_training_carbon (gpu_hours is the TOTAL across \
|
|
32
|
+
all GPUs; report wall_clock_hours as the run length), estimate_inference_carbon.
|
|
33
|
+
4. Efficiency and placement: greener_instance_family, compare_regions_tri_axis, greener_alternative_to, \
|
|
34
|
+
serving_pattern_advice; carbon_metric_scaffold for an app to track its own estimated carbon.
|
|
35
|
+
Before recommending a region move, run data_locality_egress_check: egress can erase the win. Mention \
|
|
36
|
+
any residency_note.
|
|
37
|
+
Every carbon figure carries source and quality fields. Report 'mock', 'cached' or 'historical' values \
|
|
38
|
+
as such, never as live readings. If a call fails or output is missing, say so rather than describing \
|
|
39
|
+
what the tool would return. GreenPick estimates; it does not measure running systems or report model \
|
|
40
|
+
accuracy. Use explain_methodology_and_limits when asked how a number was produced.\
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
mcp = FastMCP("greenpick", instructions=INSTRUCTIONS)
|
|
22
44
|
_repo = get_repository()
|
|
23
45
|
|
|
24
46
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: greenpick
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.6
|
|
4
4
|
Summary: Design-time sustainability co-pilot (MCP server): greener, cheaper cloud infrastructure decisions with carbon + cost + latency tradeoffs.
|
|
5
5
|
Author-email: "Data Science Advisers, LLC" <info@datascienceadvisers.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -254,15 +254,39 @@ of the options below.)
|
|
|
254
254
|
}
|
|
255
255
|
```
|
|
256
256
|
|
|
257
|
-
**In a Jupyter notebook or Python script**,
|
|
257
|
+
**In a Jupyter notebook or Python script**, connect with the MCP client library and pass the keys
|
|
258
|
+
in `env`. The library starts GreenPick as a separate process and doesn't forward the notebook's own
|
|
259
|
+
environment variables to it:
|
|
258
260
|
|
|
259
261
|
```python
|
|
260
|
-
import
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
262
|
+
import sys
|
|
263
|
+
from mcp import ClientSession, StdioServerParameters
|
|
264
|
+
from mcp.client.stdio import stdio_client
|
|
265
|
+
|
|
266
|
+
params = StdioServerParameters(
|
|
267
|
+
command=sys.executable,
|
|
268
|
+
args=["-m", "greenpick"],
|
|
269
|
+
env={
|
|
270
|
+
"GREENPICK_CARBON_SOURCE": "auto",
|
|
271
|
+
"EIA_API_KEY": "your-eia-key",
|
|
272
|
+
"ENTSOE_TOKEN": "your-entsoe-token",
|
|
273
|
+
},
|
|
274
|
+
)
|
|
275
|
+
|
|
276
|
+
# In Jupyter, errlog must be a real file (the notebook's stderr has no fileno()).
|
|
277
|
+
with open("greenpick-server.log", "w") as errlog:
|
|
278
|
+
async with stdio_client(params, errlog=errlog) as (read, write):
|
|
279
|
+
async with ClientSession(read, write) as session:
|
|
280
|
+
await session.initialize()
|
|
281
|
+
result = await session.call_tool(
|
|
282
|
+
"region_carbon_now", {"provider": "aws", "region": "us-west-2"}
|
|
283
|
+
)
|
|
284
|
+
print(result.content[0].text)
|
|
264
285
|
```
|
|
265
286
|
|
|
287
|
+
Top-level `await` works in Jupyter. In a plain script, put the `with` block inside an `async def`
|
|
288
|
+
and run it with `asyncio.run(...)`.
|
|
289
|
+
|
|
266
290
|
Every carbon figure includes a `quality` field: `live` means real grid data, `mock` means a
|
|
267
291
|
fallback value. Check it to confirm live data is on.
|
|
268
292
|
|
|
@@ -1234,3 +1234,20 @@ async def test_entsoe_remembers_an_outage(monkeypatch):
|
|
|
1234
1234
|
await repo.carbon_history("aws", "eu-north-1")
|
|
1235
1235
|
assert again.quality == "mock"
|
|
1236
1236
|
assert calls["n"] == after_first
|
|
1237
|
+
|
|
1238
|
+
|
|
1239
|
+
# --- 0.1.6: server-level instructions steer agents (they read the tool list, not the README) ---
|
|
1240
|
+
|
|
1241
|
+
def test_server_sends_instructions_that_lead_with_rightsizing():
|
|
1242
|
+
from greenpick import server
|
|
1243
|
+
text = server.mcp.instructions or ""
|
|
1244
|
+
assert "rightsizing_check" in text
|
|
1245
|
+
# Right-sizing is named before region-picking (the tool list itself starts with region tools).
|
|
1246
|
+
assert text.index("rightsizing_check") < text.index("compare_regions_tri_axis")
|
|
1247
|
+
# The reporting rules that outside agents got wrong in testing.
|
|
1248
|
+
assert "mock" in text and "TOTAL" in text and "data_locality_egress_check" in text
|
|
1249
|
+
# Every tool named in the instructions actually exists.
|
|
1250
|
+
import re, asyncio
|
|
1251
|
+
named = set(re.findall(r"\b[a-z]+(?:_[a-z]+)+\b", text)) - {"wall_clock_hours", "gpu_hours", "residency_note"}
|
|
1252
|
+
registered = {t.name for t in asyncio.run(server.mcp.list_tools())}
|
|
1253
|
+
assert named <= registered, named - registered
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|