cronometer-api-mcp 0.2.4__tar.gz → 0.2.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.
- {cronometer_api_mcp-0.2.4 → cronometer_api_mcp-0.2.6}/PKG-INFO +3 -3
- {cronometer_api_mcp-0.2.4 → cronometer_api_mcp-0.2.6}/README.md +2 -2
- {cronometer_api_mcp-0.2.4 → cronometer_api_mcp-0.2.6}/pyproject.toml +1 -1
- {cronometer_api_mcp-0.2.4 → cronometer_api_mcp-0.2.6}/server.json +2 -2
- cronometer_api_mcp-0.2.6/src/cronometer_api_mcp/barcode.py +60 -0
- {cronometer_api_mcp-0.2.4 → cronometer_api_mcp-0.2.6}/src/cronometer_api_mcp/client.py +97 -12
- {cronometer_api_mcp-0.2.4 → cronometer_api_mcp-0.2.6}/src/cronometer_api_mcp/server.py +42 -6
- cronometer_api_mcp-0.2.6/tests/test_barcode.py +68 -0
- {cronometer_api_mcp-0.2.4 → cronometer_api_mcp-0.2.6}/tests/test_client.py +119 -8
- {cronometer_api_mcp-0.2.4 → cronometer_api_mcp-0.2.6}/tests/test_custom_food_edit.py +238 -1
- {cronometer_api_mcp-0.2.4 → cronometer_api_mcp-0.2.6}/uv.lock +33 -33
- {cronometer_api_mcp-0.2.4 → cronometer_api_mcp-0.2.6}/.dockerignore +0 -0
- {cronometer_api_mcp-0.2.4 → cronometer_api_mcp-0.2.6}/.env.example +0 -0
- {cronometer_api_mcp-0.2.4 → cronometer_api_mcp-0.2.6}/.github/dependabot.yml +0 -0
- {cronometer_api_mcp-0.2.4 → cronometer_api_mcp-0.2.6}/.github/workflows/ci.yml +0 -0
- {cronometer_api_mcp-0.2.4 → cronometer_api_mcp-0.2.6}/.github/workflows/docker.yml +0 -0
- {cronometer_api_mcp-0.2.4 → cronometer_api_mcp-0.2.6}/.github/workflows/publish.yml +0 -0
- {cronometer_api_mcp-0.2.4 → cronometer_api_mcp-0.2.6}/.gitignore +0 -0
- {cronometer_api_mcp-0.2.4 → cronometer_api_mcp-0.2.6}/.python-version +0 -0
- {cronometer_api_mcp-0.2.4 → cronometer_api_mcp-0.2.6}/Dockerfile +0 -0
- {cronometer_api_mcp-0.2.4 → cronometer_api_mcp-0.2.6}/LICENSE +0 -0
- {cronometer_api_mcp-0.2.4 → cronometer_api_mcp-0.2.6}/src/cronometer_api_mcp/__init__.py +0 -0
- {cronometer_api_mcp-0.2.4 → cronometer_api_mcp-0.2.6}/tests/test_relative_dates.py +0 -0
- {cronometer_api_mcp-0.2.4 → cronometer_api_mcp-0.2.6}/tests/test_server_import.py +0 -0
- {cronometer_api_mcp-0.2.4 → cronometer_api_mcp-0.2.6}/tests/test_timezone.py +0 -0
- {cronometer_api_mcp-0.2.4 → cronometer_api_mcp-0.2.6}/tests/test_totp.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: cronometer-api-mcp
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.6
|
|
4
4
|
Summary: MCP server for Cronometer nutrition data using the mobile REST API
|
|
5
5
|
Author: Randy
|
|
6
6
|
License-Expression: MIT
|
|
@@ -154,8 +154,8 @@ cached session, so it also overrides a stale cached timezone.
|
|
|
154
154
|
|------|-------------|
|
|
155
155
|
| `add_food_entry` | Log a food serving to the diary |
|
|
156
156
|
| `remove_food_entry` | Remove one or more diary entries |
|
|
157
|
-
| `add_custom_food` | Create a custom food with specified nutrition |
|
|
158
|
-
| `update_custom_food` | Edit a custom food in place: name, nutrition,
|
|
157
|
+
| `add_custom_food` | Create a custom food with specified nutrition and optional barcodes |
|
|
158
|
+
| `update_custom_food` | Edit a custom food in place: name, nutrition, serving size, or barcodes |
|
|
159
159
|
| `delete_custom_food` | Retire a custom food so it leaves search and the Custom Foods list (existing diary entries are kept) |
|
|
160
160
|
| `add_recipe` | Create a recipe from existing foods referenced by ID and gram weight |
|
|
161
161
|
| `import_recipe` | Create a recipe from a free-text ingredient list; Cronometer matches each line to a database food and converts the amount to grams |
|
|
@@ -134,8 +134,8 @@ cached session, so it also overrides a stale cached timezone.
|
|
|
134
134
|
|------|-------------|
|
|
135
135
|
| `add_food_entry` | Log a food serving to the diary |
|
|
136
136
|
| `remove_food_entry` | Remove one or more diary entries |
|
|
137
|
-
| `add_custom_food` | Create a custom food with specified nutrition |
|
|
138
|
-
| `update_custom_food` | Edit a custom food in place: name, nutrition,
|
|
137
|
+
| `add_custom_food` | Create a custom food with specified nutrition and optional barcodes |
|
|
138
|
+
| `update_custom_food` | Edit a custom food in place: name, nutrition, serving size, or barcodes |
|
|
139
139
|
| `delete_custom_food` | Retire a custom food so it leaves search and the Custom Foods list (existing diary entries are kept) |
|
|
140
140
|
| `add_recipe` | Create a recipe from existing foods referenced by ID and gram weight |
|
|
141
141
|
| `import_recipe` | Create a recipe from a free-text ingredient list; Cronometer matches each line to a database food and converts the amount to grams |
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"url": "https://github.com/rwestergren/cronometer-api-mcp",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "0.2.
|
|
9
|
+
"version": "0.2.6",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "pypi",
|
|
13
13
|
"identifier": "cronometer-api-mcp",
|
|
14
|
-
"version": "0.2.
|
|
14
|
+
"version": "0.2.6",
|
|
15
15
|
"transport": {
|
|
16
16
|
"type": "stdio"
|
|
17
17
|
},
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""Product barcode (EAN, UPC and GTIN) validation for custom foods."""
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def normalize_barcodes(barcodes: list[str]) -> list[str]:
|
|
7
|
+
"""Validate product barcodes and return them as bare digit strings.
|
|
8
|
+
|
|
9
|
+
Accepts the GTIN family the app's scanner reads -- EAN-13, UPC-A (12),
|
|
10
|
+
EAN-8 or UPC-E (8) and GTIN-14 -- including the spaces or dashes the
|
|
11
|
+
digits are printed with under the bars ("0 12345 67890 5"). The check
|
|
12
|
+
digit is verified, so a digit misread off a label is rejected instead of
|
|
13
|
+
saved as a code that never scans. Duplicates are dropped. Bare digit
|
|
14
|
+
strings are what get_food reports for branded foods (["602652270284"]).
|
|
15
|
+
"""
|
|
16
|
+
normalized: list[str] = []
|
|
17
|
+
for raw in barcodes:
|
|
18
|
+
code = re.sub(r"[\s-]", "", str(raw))
|
|
19
|
+
if not (code.isascii() and code.isdigit()) or len(code) not in (8, 12, 13, 14):
|
|
20
|
+
raise ValueError(
|
|
21
|
+
f"barcode {raw!r} must be 8, 12, 13 or 14 digits (EAN, UPC or GTIN)"
|
|
22
|
+
)
|
|
23
|
+
if not _has_valid_check_digit(code):
|
|
24
|
+
raise ValueError(
|
|
25
|
+
f"barcode {raw!r} has the wrong check digit (last digit); "
|
|
26
|
+
f"re-check the digits"
|
|
27
|
+
)
|
|
28
|
+
if code not in normalized:
|
|
29
|
+
normalized.append(code)
|
|
30
|
+
return normalized
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _gtin_check_digit(body: str) -> int:
|
|
34
|
+
"""GS1 check digit for `body`: weights 3, 1, 3, ... from the right."""
|
|
35
|
+
total = sum(int(d) * (1 if i % 2 else 3) for i, d in enumerate(reversed(body)))
|
|
36
|
+
return -total % 10
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _has_valid_check_digit(code: str) -> bool:
|
|
40
|
+
if _gtin_check_digit(code[:-1]) == int(code[-1]):
|
|
41
|
+
return True
|
|
42
|
+
# An 8-digit code that isn't a valid EAN-8 can still be UPC-E, whose check
|
|
43
|
+
# digit is the one of the 12-digit UPC-A it abbreviates.
|
|
44
|
+
return (
|
|
45
|
+
len(code) == 8
|
|
46
|
+
and code[0] in "01"
|
|
47
|
+
and _gtin_check_digit(_expand_upc_e(code)) == int(code[-1])
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _expand_upc_e(code: str) -> str:
|
|
52
|
+
"""The UPC-A digits (check digit excluded) a UPC-E code abbreviates."""
|
|
53
|
+
system, d = code[0], code[1:7]
|
|
54
|
+
if d[5] in "012":
|
|
55
|
+
return system + d[0:2] + d[5] + "0000" + d[2:5]
|
|
56
|
+
if d[5] == "3":
|
|
57
|
+
return system + d[0:3] + "00000" + d[3:5]
|
|
58
|
+
if d[5] == "4":
|
|
59
|
+
return system + d[0:4] + "00000" + d[4]
|
|
60
|
+
return system + d[0:5] + "0000" + d[5]
|
|
@@ -15,7 +15,9 @@ import hashlib
|
|
|
15
15
|
import hmac
|
|
16
16
|
import json
|
|
17
17
|
import logging
|
|
18
|
+
import math
|
|
18
19
|
import os
|
|
20
|
+
import re
|
|
19
21
|
import struct
|
|
20
22
|
import threading
|
|
21
23
|
import time
|
|
@@ -25,6 +27,8 @@ from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
|
|
|
25
27
|
|
|
26
28
|
import httpx
|
|
27
29
|
|
|
30
|
+
from .barcode import normalize_barcodes
|
|
31
|
+
|
|
28
32
|
logger = logging.getLogger(__name__)
|
|
29
33
|
|
|
30
34
|
BASE_URL = "https://mobile.cronometer.com"
|
|
@@ -82,6 +86,9 @@ _OZ_GRAMS = 28.3495231
|
|
|
82
86
|
# Nutrient IDs create_custom_food() already writes via its named macro args
|
|
83
87
|
# (including the derived/negative-ID duplicates it sends alongside them).
|
|
84
88
|
# extra_nutrients must not reuse one of these -- see create_custom_food().
|
|
89
|
+
# A serving name that leads with a plain number, e.g. "2 cookies".
|
|
90
|
+
_QUANTITY_LED_NAME = re.compile(r"^\s*(\d+(?:\.\d+)?)\s+(\S.*)$")
|
|
91
|
+
|
|
85
92
|
_RESERVED_CUSTOM_FOOD_NUTRIENT_IDS = frozenset(
|
|
86
93
|
{
|
|
87
94
|
NUTRIENT_IDS["energy"],
|
|
@@ -654,6 +661,7 @@ class CronometerClient:
|
|
|
654
661
|
extra_nutrients: dict[int, float] | None = None,
|
|
655
662
|
serving_name: str = "1 serving",
|
|
656
663
|
serving_grams: float = 100.0,
|
|
664
|
+
barcodes: list[str] | None = None,
|
|
657
665
|
) -> dict:
|
|
658
666
|
"""Create a custom food in Cronometer.
|
|
659
667
|
|
|
@@ -671,9 +679,14 @@ class CronometerClient:
|
|
|
671
679
|
Must not reuse an ID already written by the named macro args
|
|
672
680
|
above; doing so raises ValueError rather than silently
|
|
673
681
|
duplicating or shadowing an entry.
|
|
682
|
+
barcodes: Product barcodes (EAN/UPC/GTIN) to attach; scanning one
|
|
683
|
+
in the app finds this food. Spaces and dashes are stripped and
|
|
684
|
+
the check digit verified; a bad code raises ValueError.
|
|
674
685
|
|
|
675
686
|
Returns {"food_id": int, "measure_id": int | None}.
|
|
676
687
|
"""
|
|
688
|
+
barcodes = normalize_barcodes(barcodes or [])
|
|
689
|
+
|
|
677
690
|
# Cronometer stores nutrients per 100g -- normalize from per-serving.
|
|
678
691
|
scale = 100.0 / serving_grams if serving_grams > 0 else 1.0
|
|
679
692
|
|
|
@@ -723,19 +736,35 @@ class CronometerClient:
|
|
|
723
736
|
"defaultMeasureId": 0,
|
|
724
737
|
"comments": None,
|
|
725
738
|
"alternateId": None,
|
|
739
|
+
# The first measure becomes the server-assigned default.
|
|
726
740
|
"measures": [
|
|
727
741
|
{
|
|
728
742
|
"id": 0,
|
|
729
743
|
"name": serving_name,
|
|
730
744
|
"value": serving_grams,
|
|
731
745
|
"amount": 1.0,
|
|
732
|
-
"type": "
|
|
733
|
-
}
|
|
746
|
+
"type": "Weight",
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
"id": 0,
|
|
750
|
+
"name": "g",
|
|
751
|
+
"value": 1.0,
|
|
752
|
+
"amount": 1.0,
|
|
753
|
+
"type": "Weight",
|
|
754
|
+
},
|
|
755
|
+
{
|
|
756
|
+
"id": 0,
|
|
757
|
+
"name": "oz",
|
|
758
|
+
"value": _OZ_GRAMS,
|
|
759
|
+
"amount": 1.0,
|
|
760
|
+
"type": "Weight",
|
|
761
|
+
},
|
|
734
762
|
],
|
|
735
763
|
"labelType": "AMERICAN_2016",
|
|
736
764
|
"nutrients": nutrients,
|
|
737
765
|
"properties": {},
|
|
738
766
|
"foodTags": [],
|
|
767
|
+
"barcodes": barcodes,
|
|
739
768
|
},
|
|
740
769
|
"config": {"call_version": 1},
|
|
741
770
|
}
|
|
@@ -825,6 +854,8 @@ class CronometerClient:
|
|
|
825
854
|
extra_nutrients: dict[int, float] | None = None,
|
|
826
855
|
serving_name: str | None = None,
|
|
827
856
|
serving_grams: float | None = None,
|
|
857
|
+
serving_quantity: float | None = None,
|
|
858
|
+
barcodes: list[str] | None = None,
|
|
828
859
|
) -> dict:
|
|
829
860
|
"""Edit a user-created custom food in place.
|
|
830
861
|
|
|
@@ -835,6 +866,19 @@ class CronometerClient:
|
|
|
835
866
|
alone leaves the stored per-100g values as they are, so the food's
|
|
836
867
|
per-serving numbers shift with the new weight.
|
|
837
868
|
|
|
869
|
+
A measure is `amount` units of `name` weighing `value` grams in total,
|
|
870
|
+
and the app renders the serving as "<amount> <name>". Setting the
|
|
871
|
+
weight therefore also resets the quantity (to serving_quantity, or 1)
|
|
872
|
+
and makes the measure a named ("Atomic") serving. Otherwise a food
|
|
873
|
+
first saved as "400 g" keeps amount=400 and type "Weight" and shows up
|
|
874
|
+
as "400 <serving_name>" with no weight of its own. A quantity leading
|
|
875
|
+
serving_name ("2 cookies") is moved into the quantity for the same
|
|
876
|
+
reason. A quantity set without serving_grams keeps the total weight,
|
|
877
|
+
so the per-unit weight changes.
|
|
878
|
+
|
|
879
|
+
barcodes replaces the food's whole barcode list ([] clears it) and is
|
|
880
|
+
validated like create_custom_food's.
|
|
881
|
+
|
|
838
882
|
Returns {"food_id": int, "name": str}.
|
|
839
883
|
"""
|
|
840
884
|
if extra_nutrients:
|
|
@@ -846,9 +890,35 @@ class CronometerClient:
|
|
|
846
890
|
f"those instead."
|
|
847
891
|
)
|
|
848
892
|
|
|
893
|
+
# The server splits a leading quantity off a new measure's name
|
|
894
|
+
# ("10 pieces" is stored as amount=10, name="pieces") but not when
|
|
895
|
+
# an existing measure is re-sent, so do the same here. Done before
|
|
896
|
+
# validation so an inferred quantity is checked too.
|
|
897
|
+
quantity_label = "serving_quantity"
|
|
898
|
+
if serving_name is not None:
|
|
899
|
+
led = _QUANTITY_LED_NAME.match(serving_name)
|
|
900
|
+
if led and float(led.group(1)) > 0:
|
|
901
|
+
serving_name = led.group(2)
|
|
902
|
+
if serving_quantity is None:
|
|
903
|
+
serving_quantity = float(led.group(1))
|
|
904
|
+
quantity_label = "serving_name quantity"
|
|
905
|
+
|
|
906
|
+
for label, v in (
|
|
907
|
+
("serving_grams", serving_grams),
|
|
908
|
+
(quantity_label, serving_quantity),
|
|
909
|
+
):
|
|
910
|
+
if v is not None and not (math.isfinite(v) and v > 0):
|
|
911
|
+
raise ValueError(f"{label} must be a positive number, got {v!r}")
|
|
912
|
+
|
|
913
|
+
if barcodes is not None:
|
|
914
|
+
barcodes = normalize_barcodes(barcodes)
|
|
915
|
+
|
|
849
916
|
with self._food_lock(food_id):
|
|
850
917
|
food = self._get_custom_food(food_id)
|
|
851
918
|
|
|
919
|
+
if barcodes is not None:
|
|
920
|
+
food["barcodes"] = barcodes
|
|
921
|
+
|
|
852
922
|
if name is not None:
|
|
853
923
|
old_name = food.get("name")
|
|
854
924
|
food["name"] = name
|
|
@@ -862,6 +932,11 @@ class CronometerClient:
|
|
|
862
932
|
measure["name"] = serving_name
|
|
863
933
|
if serving_grams is not None:
|
|
864
934
|
measure["value"] = serving_grams
|
|
935
|
+
if serving_grams is not None or serving_quantity is not None:
|
|
936
|
+
measure["amount"] = (
|
|
937
|
+
serving_quantity if serving_quantity is not None else 1.0
|
|
938
|
+
)
|
|
939
|
+
measure["type"] = "Atomic"
|
|
865
940
|
grams = (measure or {}).get("value") or 100.0
|
|
866
941
|
scale = 100.0 / grams if grams > 0 else 1.0
|
|
867
942
|
|
|
@@ -1642,9 +1717,11 @@ class CronometerClient:
|
|
|
1642
1717
|
merges per-entry:
|
|
1643
1718
|
|
|
1644
1719
|
- name, source, category: from the food object
|
|
1645
|
-
-
|
|
1646
|
-
measureId (falls back to
|
|
1647
|
-
|
|
1720
|
+
- serving_size: {measure_id, quantity, unit, grams} defining one
|
|
1721
|
+
portion in the entry's measureId (falls back to defaultMeasureId).
|
|
1722
|
+
Recipe measures have null grams: their value is a reference-serving
|
|
1723
|
+
count, not a gram weight.
|
|
1724
|
+
- servings: number of those portions consumed, when derivable
|
|
1648
1725
|
- nutrients: the food's nutrient profile scaled to the entry's amount
|
|
1649
1726
|
(per-100g for Weight/Atomic measures, per-serving for Recipe
|
|
1650
1727
|
measures), labeled with name/unit/category via the nutrient
|
|
@@ -1705,18 +1782,26 @@ class CronometerClient:
|
|
|
1705
1782
|
)
|
|
1706
1783
|
grams = entry.get("grams")
|
|
1707
1784
|
if measure:
|
|
1708
|
-
|
|
1709
|
-
|
|
1785
|
+
portion_value = measure.get("value")
|
|
1786
|
+
quantity = measure.get("amount", 1)
|
|
1787
|
+
if not (
|
|
1788
|
+
isinstance(quantity, (int, float))
|
|
1789
|
+
and math.isfinite(quantity)
|
|
1790
|
+
and quantity > 0
|
|
1791
|
+
):
|
|
1792
|
+
quantity = None
|
|
1793
|
+
entry["serving_size"] = {
|
|
1710
1794
|
"measure_id": measure.get("id"),
|
|
1711
|
-
"
|
|
1712
|
-
"
|
|
1795
|
+
"quantity": quantity,
|
|
1796
|
+
"unit": measure.get("name"),
|
|
1797
|
+
"grams": None if measure.get("type") == "Recipe" else portion_value,
|
|
1713
1798
|
}
|
|
1714
1799
|
if (
|
|
1715
1800
|
isinstance(grams, (int, float))
|
|
1716
|
-
and isinstance(
|
|
1717
|
-
and
|
|
1801
|
+
and isinstance(portion_value, (int, float))
|
|
1802
|
+
and portion_value
|
|
1718
1803
|
):
|
|
1719
|
-
entry["servings"] = round(grams /
|
|
1804
|
+
entry["servings"] = round(grams / portion_value, 4)
|
|
1720
1805
|
|
|
1721
1806
|
# Nutrient scaling depends on the measure type:
|
|
1722
1807
|
# - Recipe measures: nutrients are stored per one reference
|
|
@@ -175,10 +175,18 @@ def get_food_log(
|
|
|
175
175
|
entries, prefer get_daily_nutrition(days=N).
|
|
176
176
|
|
|
177
177
|
Returns every food entry logged for the day. Each "Serving" entry is
|
|
178
|
-
enriched (best-effort) with the food's name, source,
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
178
|
+
enriched (best-effort) with the food's name, source, serving_size, servings,
|
|
179
|
+
and that food's own nutrient profile scaled to the amount eaten. Non-food
|
|
180
|
+
entries (exercise, biometrics) carry their own name.
|
|
181
|
+
|
|
182
|
+
serving_size defines one portion: quantity units weighing grams in total.
|
|
183
|
+
servings is how many of those portions were consumed. For example,
|
|
184
|
+
serving_size={quantity: 2, unit: "cookies", grams: 30} with servings=1
|
|
185
|
+
means two cookies eaten; servings=0.5 means one cookie eaten. The size
|
|
186
|
+
uses the entry's selected measure, or the food's default as a fallback.
|
|
187
|
+
For serving-based recipes, serving_size.grams is null because the API
|
|
188
|
+
uses reference-serving counts instead of gram weights. An invalid
|
|
189
|
+
serving_size.quantity is reported as null.
|
|
182
190
|
|
|
183
191
|
Note: the per-entry "nutrients" are each food's individual contribution,
|
|
184
192
|
which is distinct from the day-level nutrition_summary aggregate below.
|
|
@@ -544,6 +552,8 @@ def get_food_details(food_id: int) -> str:
|
|
|
544
552
|
"measure_id": m.get("id"),
|
|
545
553
|
"name": m.get("name"),
|
|
546
554
|
"grams": m.get("value"),
|
|
555
|
+
"quantity": m.get("amount"),
|
|
556
|
+
"type": m.get("type"),
|
|
547
557
|
}
|
|
548
558
|
)
|
|
549
559
|
|
|
@@ -553,6 +563,7 @@ def get_food_details(food_id: int) -> str:
|
|
|
553
563
|
"name": data.get("name"),
|
|
554
564
|
"default_measure_id": data.get("defaultMeasureId"),
|
|
555
565
|
"measures": measures,
|
|
566
|
+
"barcodes": data.get("barcodes", []),
|
|
556
567
|
"nutrients": data.get("nutrients", []),
|
|
557
568
|
}
|
|
558
569
|
)
|
|
@@ -579,6 +590,7 @@ def add_custom_food(
|
|
|
579
590
|
extra_nutrients: dict[int, float] | None = None,
|
|
580
591
|
serving_name: str = "1 serving",
|
|
581
592
|
serving_grams: float = 100.0,
|
|
593
|
+
barcodes: list[str] | None = None,
|
|
582
594
|
) -> str:
|
|
583
595
|
"""Create a custom food in Cronometer with specified nutrition.
|
|
584
596
|
|
|
@@ -603,6 +615,12 @@ def add_custom_food(
|
|
|
603
615
|
named macro args already cover.
|
|
604
616
|
serving_name: Name for the serving size (default "1 serving").
|
|
605
617
|
serving_grams: Weight of one serving in grams (default 100).
|
|
618
|
+
barcodes: Product barcodes (EAN-13, UPC-A, EAN-8, UPC-E or GTIN-14),
|
|
619
|
+
e.g. the digits printed under the bars on the package; spaces and
|
|
620
|
+
dashes are ignored. Scanning one of them in the Cronometer app
|
|
621
|
+
then finds this food (search_foods does not match barcodes). The
|
|
622
|
+
check digit is verified, so a misread digit is rejected rather
|
|
623
|
+
than saved.
|
|
606
624
|
"""
|
|
607
625
|
try:
|
|
608
626
|
client = _get_client()
|
|
@@ -619,6 +637,7 @@ def add_custom_food(
|
|
|
619
637
|
extra_nutrients=extra_nutrients,
|
|
620
638
|
serving_name=serving_name,
|
|
621
639
|
serving_grams=serving_grams,
|
|
640
|
+
barcodes=barcodes,
|
|
622
641
|
)
|
|
623
642
|
|
|
624
643
|
# Fetch back to get the server-assigned measure_id
|
|
@@ -652,6 +671,8 @@ def update_custom_food(
|
|
|
652
671
|
extra_nutrients: dict[int, float] | None = None,
|
|
653
672
|
serving_name: str | None = None,
|
|
654
673
|
serving_grams: float | None = None,
|
|
674
|
+
serving_quantity: float | None = None,
|
|
675
|
+
barcodes: list[str] | None = None,
|
|
655
676
|
) -> str:
|
|
656
677
|
"""Edit an existing custom food (one you created) in place.
|
|
657
678
|
|
|
@@ -680,8 +701,21 @@ def update_custom_food(
|
|
|
680
701
|
extra_nutrients: Additional nutrients keyed by Cronometer nutrient ID
|
|
681
702
|
(from get_daily_nutrition) and valued per serving; must not reuse
|
|
682
703
|
an ID the named args already cover.
|
|
683
|
-
serving_name: New name for the default serving.
|
|
684
|
-
|
|
704
|
+
serving_name: New name for the default serving. The app shows the
|
|
705
|
+
serving as "<quantity> <name>"; a leading number ("2 cookies")
|
|
706
|
+
is taken as the quantity (see serving_quantity).
|
|
707
|
+
serving_grams: New total weight of the default serving in grams.
|
|
708
|
+
Also resets the quantity to serving_quantity (or 1).
|
|
709
|
+
serving_quantity: How many units make up the default serving
|
|
710
|
+
(default 1 whenever serving_grams is passed). Without
|
|
711
|
+
serving_grams the serving's total weight stays the same, so each
|
|
712
|
+
unit gets lighter or heavier: changing "2 cookies = 30 g" to 3
|
|
713
|
+
gives "3 cookies = 30 g". To keep the per-unit weight, also pass
|
|
714
|
+
serving_grams (45 here). Check the result with get_food_details,
|
|
715
|
+
which lists each measure's quantity.
|
|
716
|
+
barcodes: Replaces the food's barcodes (see add_custom_food for the
|
|
717
|
+
accepted formats); pass [] to remove them all. To add one, pass
|
|
718
|
+
the current barcodes from get_food_details plus the new one.
|
|
685
719
|
"""
|
|
686
720
|
try:
|
|
687
721
|
client = _get_client()
|
|
@@ -699,6 +733,8 @@ def update_custom_food(
|
|
|
699
733
|
extra_nutrients=extra_nutrients,
|
|
700
734
|
serving_name=serving_name,
|
|
701
735
|
serving_grams=serving_grams,
|
|
736
|
+
serving_quantity=serving_quantity,
|
|
737
|
+
barcodes=barcodes,
|
|
702
738
|
)
|
|
703
739
|
return _ok({"food_id": result["food_id"], "name": result["name"]})
|
|
704
740
|
except Exception as e:
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""Tests for barcode validation of custom foods.
|
|
2
|
+
|
|
3
|
+
normalize_barcodes accepts the GTIN family (EAN-13, UPC-A, EAN-8, UPC-E,
|
|
4
|
+
GTIN-14), strips the spaces and dashes codes are printed with, and verifies
|
|
5
|
+
the GS1 check digit so a misread digit is rejected rather than saved.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import pytest
|
|
11
|
+
|
|
12
|
+
from cronometer_api_mcp.barcode import normalize_barcodes
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@pytest.mark.parametrize(
|
|
16
|
+
("raw", "expected"),
|
|
17
|
+
[
|
|
18
|
+
("4006381333931", "4006381333931"), # EAN-13
|
|
19
|
+
("602652270284", "602652270284"), # UPC-A (from a real get_food)
|
|
20
|
+
("0 49000 05010 3", "049000050103"), # UPC-A as printed on a label
|
|
21
|
+
("9638-5074", "96385074"), # EAN-8
|
|
22
|
+
# UPC-E, one per expansion rule (the sixth digit picks it). The first
|
|
23
|
+
# three aren't valid EAN-8s, so only the UPC-E check accepts them;
|
|
24
|
+
# under rule 5-9 the two check digits always coincide.
|
|
25
|
+
("04252614", "04252614"), # -> UPC-A 042100005264
|
|
26
|
+
("01234531", "01234531"), # -> UPC-A 012300000451
|
|
27
|
+
("01234543", "01234543"), # -> UPC-A 012340000053
|
|
28
|
+
("01234565", "01234565"), # -> UPC-A 012345000065
|
|
29
|
+
("10012345678902", "10012345678902"), # GTIN-14
|
|
30
|
+
],
|
|
31
|
+
)
|
|
32
|
+
def test_normalize_barcodes_accepts_gtin_family(raw, expected):
|
|
33
|
+
assert normalize_barcodes([raw]) == [expected]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@pytest.mark.parametrize(
|
|
37
|
+
"raw",
|
|
38
|
+
[
|
|
39
|
+
"4006381333932", # EAN-13, last digit off by one
|
|
40
|
+
"602652270285", # UPC-A, wrong check digit
|
|
41
|
+
"04252615", # neither a valid EAN-8 nor a valid UPC-E
|
|
42
|
+
"24252618", # UPC-E check digit, but UPC-E only has number systems 0, 1
|
|
43
|
+
"01234566", # rule 5-9: wrong check digit as EAN-8 and as UPC-E
|
|
44
|
+
],
|
|
45
|
+
)
|
|
46
|
+
def test_normalize_barcodes_rejects_wrong_check_digit(raw):
|
|
47
|
+
with pytest.raises(ValueError, match="check digit"):
|
|
48
|
+
normalize_barcodes([raw])
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@pytest.mark.parametrize(
|
|
52
|
+
"raw",
|
|
53
|
+
[
|
|
54
|
+
"",
|
|
55
|
+
"12345", # no GTIN has 5 digits
|
|
56
|
+
"400638133393a",
|
|
57
|
+
"4006381333931", # full-width digits: isdigit() but not ASCII
|
|
58
|
+
],
|
|
59
|
+
)
|
|
60
|
+
def test_normalize_barcodes_rejects_malformed(raw):
|
|
61
|
+
with pytest.raises(ValueError, match="must be 8, 12, 13 or 14 digits"):
|
|
62
|
+
normalize_barcodes([raw])
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def test_normalize_barcodes_drops_duplicates():
|
|
66
|
+
assert normalize_barcodes(["4006381333931", "4006 3813 3393 1"]) == [
|
|
67
|
+
"4006381333931"
|
|
68
|
+
]
|
|
@@ -270,10 +270,11 @@ def test_enrich_diary_merges_names_measures_and_scaled_nutrients(tmp_path):
|
|
|
270
270
|
assert oats["name"] == "Oats"
|
|
271
271
|
assert oats["source"] == "USDA"
|
|
272
272
|
assert oats["category"] == "Grains"
|
|
273
|
-
assert oats["
|
|
273
|
+
assert oats["serving_size"] == {
|
|
274
274
|
"measure_id": 10,
|
|
275
|
-
"
|
|
276
|
-
"
|
|
275
|
+
"quantity": 1,
|
|
276
|
+
"unit": "cup",
|
|
277
|
+
"grams": 100.0,
|
|
277
278
|
}
|
|
278
279
|
assert oats["servings"] == 2.0 # 200g / 100g per cup
|
|
279
280
|
# per-100g energy 389 scaled to 200g -> 778
|
|
@@ -284,15 +285,20 @@ def test_enrich_diary_merges_names_measures_and_scaled_nutrients(tmp_path):
|
|
|
284
285
|
|
|
285
286
|
milk = entries[1]
|
|
286
287
|
# unknown measureId 999 -> fell back to defaultMeasureId 20
|
|
287
|
-
assert milk["
|
|
288
|
-
assert milk["
|
|
288
|
+
assert milk["serving_size"]["measure_id"] == 20
|
|
289
|
+
assert milk["serving_size"]["unit"] == "glass"
|
|
289
290
|
# 42 kcal/100g scaled to 50g -> 21
|
|
290
291
|
assert next(n for n in milk["nutrients"] if n["id"] == 208)["amount"] == 21.0
|
|
291
292
|
|
|
292
293
|
recipe = entries[2]
|
|
293
294
|
assert recipe["name"] == "Recipe Food"
|
|
294
|
-
assert recipe["
|
|
295
|
-
|
|
295
|
+
assert recipe["serving_size"] == {
|
|
296
|
+
"measure_id": 30,
|
|
297
|
+
"quantity": 1,
|
|
298
|
+
"unit": "serving",
|
|
299
|
+
"grams": None,
|
|
300
|
+
}
|
|
301
|
+
assert recipe["servings"] == 1.1
|
|
296
302
|
# Recipe measure: nutrients are per-serving and "grams" is a serving count,
|
|
297
303
|
# so 708.538 kcal/serving * 1.1 servings -> 779.39 (not grams/100)
|
|
298
304
|
energy = next(n for n in recipe["nutrients"] if n["id"] == 208)
|
|
@@ -304,6 +310,43 @@ def test_enrich_diary_merges_names_measures_and_scaled_nutrients(tmp_path):
|
|
|
304
310
|
assert entries[3] == {"type": "Exercise", "name": "Running", "order": 1}
|
|
305
311
|
|
|
306
312
|
|
|
313
|
+
@pytest.mark.parametrize(
|
|
314
|
+
("measure_type", "quantity", "value", "expected_quantity", "servings"),
|
|
315
|
+
[
|
|
316
|
+
("Weight", 100, 100, 100, 0.6),
|
|
317
|
+
("Atomic", 0.5, 120, 0.5, 0.5),
|
|
318
|
+
("Atomic", None, 120, None, 0.5),
|
|
319
|
+
("Atomic", 0, 120, None, 0.5),
|
|
320
|
+
("Atomic", -1, 120, None, 0.5),
|
|
321
|
+
("Atomic", "bad", 120, None, 0.5),
|
|
322
|
+
("Atomic", float("nan"), 120, None, 0.5),
|
|
323
|
+
("Atomic", float("inf"), 120, None, 0.5),
|
|
324
|
+
],
|
|
325
|
+
)
|
|
326
|
+
def test_enrich_diary_measure_quantity(
|
|
327
|
+
tmp_path, monkeypatch, measure_type, quantity, value, expected_quantity, servings
|
|
328
|
+
):
|
|
329
|
+
client = _enrich_client(tmp_path)
|
|
330
|
+
food = {
|
|
331
|
+
"id": 100,
|
|
332
|
+
"defaultMeasureId": 10,
|
|
333
|
+
"measures": [
|
|
334
|
+
{"id": 10, "type": measure_type, "amount": quantity, "value": value}
|
|
335
|
+
],
|
|
336
|
+
}
|
|
337
|
+
monkeypatch.setattr(client, "get_foods", lambda ids: [food])
|
|
338
|
+
monkeypatch.setattr(client, "get_nutrient_definitions", dict)
|
|
339
|
+
|
|
340
|
+
out = client.enrich_diary_servings(
|
|
341
|
+
{"diary": [{"type": "Serving", "foodId": 100, "measureId": 999, "grams": 60}]}
|
|
342
|
+
)
|
|
343
|
+
|
|
344
|
+
entry = out["diary"][0]
|
|
345
|
+
assert entry["serving_size"]["quantity"] == expected_quantity
|
|
346
|
+
assert entry["serving_size"]["grams"] == value
|
|
347
|
+
assert entry["servings"] == servings
|
|
348
|
+
|
|
349
|
+
|
|
307
350
|
def test_enrich_diary_is_best_effort_when_get_foods_fails(tmp_path):
|
|
308
351
|
client = _enrich_client(tmp_path)
|
|
309
352
|
|
|
@@ -825,10 +868,40 @@ def test_import_recipe_rejects_blank_input(tmp_path, monkeypatch):
|
|
|
825
868
|
|
|
826
869
|
|
|
827
870
|
# ---------------------------------------------------------------------------
|
|
828
|
-
# create_custom_food
|
|
871
|
+
# create_custom_food
|
|
829
872
|
# ---------------------------------------------------------------------------
|
|
830
873
|
|
|
831
874
|
|
|
875
|
+
@pytest.mark.parametrize("serving_grams", [100.0, 200.0])
|
|
876
|
+
def test_create_custom_food_supports_weight_units(tmp_path, serving_grams):
|
|
877
|
+
client, state = make_cold_client(tmp_path, [{"result": "SUCCESS", "id": 555}])
|
|
878
|
+
|
|
879
|
+
client.create_custom_food(
|
|
880
|
+
"Test Food",
|
|
881
|
+
calories=200,
|
|
882
|
+
protein_g=10,
|
|
883
|
+
fat_g=5,
|
|
884
|
+
carbs_g=20,
|
|
885
|
+
serving_name="plate",
|
|
886
|
+
serving_grams=serving_grams,
|
|
887
|
+
)
|
|
888
|
+
|
|
889
|
+
data = state["payloads"][0]["data"]
|
|
890
|
+
serving, grams, ounces = data["measures"]
|
|
891
|
+
assert [m["name"] for m in data["measures"]] == ["plate", "g", "oz"]
|
|
892
|
+
assert all(m["type"] == "Weight" for m in data["measures"])
|
|
893
|
+
assert all(m["amount"] == 1.0 for m in data["measures"])
|
|
894
|
+
assert serving["value"] == serving_grams
|
|
895
|
+
assert grams["value"] == 1.0
|
|
896
|
+
assert ounces["value"] == pytest.approx(28.3495231)
|
|
897
|
+
|
|
898
|
+
nutrients = {n["id"]: n["amount"] for n in data["nutrients"]}
|
|
899
|
+
assert nutrients[208] == 200 * 100 / serving_grams
|
|
900
|
+
assert nutrients[203] == 10 * 100 / serving_grams
|
|
901
|
+
assert nutrients[204] == 5 * 100 / serving_grams
|
|
902
|
+
assert nutrients[205] == 20 * 100 / serving_grams
|
|
903
|
+
|
|
904
|
+
|
|
832
905
|
def test_create_custom_food_extra_nutrients_payload(tmp_path):
|
|
833
906
|
"""extra_nutrients are appended, normalized to per-100g like the macros."""
|
|
834
907
|
client, state = make_cold_client(tmp_path, [{"result": "SUCCESS", "id": 555}])
|
|
@@ -865,6 +938,44 @@ def test_create_custom_food_extra_nutrients_overlap_raises(tmp_path):
|
|
|
865
938
|
)
|
|
866
939
|
|
|
867
940
|
|
|
941
|
+
# ---------------------------------------------------------------------------
|
|
942
|
+
# create_custom_food: barcodes
|
|
943
|
+
# ---------------------------------------------------------------------------
|
|
944
|
+
|
|
945
|
+
|
|
946
|
+
def _create_test_food(client, **kwargs):
|
|
947
|
+
return client.create_custom_food(
|
|
948
|
+
"Test Food", calories=200, protein_g=10, fat_g=5, carbs_g=20, **kwargs
|
|
949
|
+
)
|
|
950
|
+
|
|
951
|
+
|
|
952
|
+
def test_create_custom_food_sends_normalized_barcodes(tmp_path):
|
|
953
|
+
"""Barcodes go out as the food's `barcodes` list of bare digit strings,
|
|
954
|
+
the shape get_food reports for branded foods."""
|
|
955
|
+
client, state = make_cold_client(tmp_path, [{"result": "SUCCESS", "id": 555}])
|
|
956
|
+
|
|
957
|
+
_create_test_food(client, barcodes=["0 49000 05010 3", "4006381333931"])
|
|
958
|
+
|
|
959
|
+
data = state["payloads"][0]["data"]
|
|
960
|
+
assert data["barcodes"] == ["049000050103", "4006381333931"]
|
|
961
|
+
|
|
962
|
+
|
|
963
|
+
def test_create_custom_food_without_barcodes_sends_empty_list(tmp_path):
|
|
964
|
+
client, state = make_cold_client(tmp_path, [{"result": "SUCCESS", "id": 555}])
|
|
965
|
+
|
|
966
|
+
_create_test_food(client)
|
|
967
|
+
|
|
968
|
+
assert state["payloads"][0]["data"]["barcodes"] == []
|
|
969
|
+
|
|
970
|
+
|
|
971
|
+
def test_create_custom_food_bad_barcode_raises_before_request(tmp_path):
|
|
972
|
+
client, state = make_cold_client(tmp_path, [{"result": "SUCCESS", "id": 555}])
|
|
973
|
+
|
|
974
|
+
with pytest.raises(ValueError, match="check digit"):
|
|
975
|
+
_create_test_food(client, barcodes=["4006381333932"])
|
|
976
|
+
assert state["payloads"] == []
|
|
977
|
+
|
|
978
|
+
|
|
868
979
|
def test_enrich_diary_no_servings_skips_lookup(tmp_path):
|
|
869
980
|
client = _enrich_client(tmp_path)
|
|
870
981
|
calls = {"n": 0}
|
|
@@ -162,11 +162,212 @@ def test_update_custom_food_serving_overrides_measure_and_scale(tmp_path):
|
|
|
162
162
|
data = state["payloads"][1]["data"]
|
|
163
163
|
(measure,) = data["measures"]
|
|
164
164
|
assert measure["id"] == 900
|
|
165
|
-
assert measure["name"] == "1
|
|
165
|
+
assert measure["name"] == "cup" # the leading 1 is the quantity
|
|
166
|
+
assert measure["amount"] == 1.0
|
|
166
167
|
assert measure["value"] == 200
|
|
167
168
|
assert nutrients_by_id(state["payloads"][1])[208] == 200.0 # 400 per 200 g
|
|
168
169
|
|
|
169
170
|
|
|
171
|
+
def test_update_custom_food_preserves_weight_units(tmp_path):
|
|
172
|
+
food = custom_food()
|
|
173
|
+
food["measures"][0]["type"] = "Weight"
|
|
174
|
+
weight_units = [
|
|
175
|
+
{"id": 901, "name": "g", "amount": 1, "value": 1, "type": "Weight"},
|
|
176
|
+
{
|
|
177
|
+
"id": 902,
|
|
178
|
+
"name": "oz",
|
|
179
|
+
"amount": 1,
|
|
180
|
+
"value": 28.3495231,
|
|
181
|
+
"type": "Weight",
|
|
182
|
+
},
|
|
183
|
+
]
|
|
184
|
+
food["measures"].extend(dict(unit) for unit in weight_units)
|
|
185
|
+
client, state = make_cold_client(tmp_path, [food, OK])
|
|
186
|
+
|
|
187
|
+
client.update_custom_food(
|
|
188
|
+
FOOD_ID, serving_name="plate", serving_grams=200, calories=400
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
data = state["payloads"][1]["data"]
|
|
192
|
+
assert data["defaultMeasureId"] == 900
|
|
193
|
+
assert data["measures"][0]["id"] == 900
|
|
194
|
+
assert data["measures"][0]["value"] == 200
|
|
195
|
+
assert data["measures"][1:] == weight_units
|
|
196
|
+
assert nutrients_by_id(state["payloads"][1])[208] == 200
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
def weight_default_food() -> dict:
|
|
200
|
+
"""A food first saved as "400 g": its default measure is 400 units of a
|
|
201
|
+
Weight measure, which the app renders as "400 <name>"."""
|
|
202
|
+
food = custom_food()
|
|
203
|
+
food["measures"][0].update(name="1 serving", amount=400, value=250, type="Weight")
|
|
204
|
+
return food
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
def test_update_custom_food_serving_grams_resets_quantity_and_type(tmp_path):
|
|
208
|
+
"""Setting the weight makes the default measure one named serving, so a
|
|
209
|
+
food first saved as "400 g" stops rendering as "400 <name>"."""
|
|
210
|
+
client, state = make_cold_client(tmp_path, [weight_default_food(), OK])
|
|
211
|
+
|
|
212
|
+
client.update_custom_food(FOOD_ID, serving_name="serving", serving_grams=250)
|
|
213
|
+
|
|
214
|
+
(measure,) = state["payloads"][1]["data"]["measures"]
|
|
215
|
+
assert measure["id"] == 900
|
|
216
|
+
assert measure["name"] == "serving"
|
|
217
|
+
assert measure["value"] == 250
|
|
218
|
+
assert measure["amount"] == 1.0
|
|
219
|
+
assert measure["type"] == "Atomic"
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def test_update_custom_food_serving_quantity(tmp_path):
|
|
223
|
+
"""serving_quantity sets how many units the default serving is, alone or
|
|
224
|
+
together with the weight."""
|
|
225
|
+
client, state = make_cold_client(
|
|
226
|
+
tmp_path, [weight_default_food(), OK, custom_food(), OK]
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
client.update_custom_food(FOOD_ID, serving_quantity=1)
|
|
230
|
+
(measure,) = state["payloads"][1]["data"]["measures"]
|
|
231
|
+
assert (measure["amount"], measure["value"], measure["type"]) == (1, 250, "Atomic")
|
|
232
|
+
|
|
233
|
+
client.update_custom_food(FOOD_ID, serving_grams=30, serving_quantity=2)
|
|
234
|
+
(measure,) = state["payloads"][3]["data"]["measures"]
|
|
235
|
+
assert (measure["amount"], measure["value"]) == (2, 30)
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
@pytest.mark.parametrize(
|
|
239
|
+
"kwargs",
|
|
240
|
+
[
|
|
241
|
+
{"serving_name": "2 cookies"},
|
|
242
|
+
{"serving_name": "cookies", "serving_quantity": 2},
|
|
243
|
+
],
|
|
244
|
+
)
|
|
245
|
+
@pytest.mark.parametrize(
|
|
246
|
+
("measure_id", "quantity", "unit", "grams", "counts"),
|
|
247
|
+
[
|
|
248
|
+
(900, 2, "cookies", 30, (0.5, 1, 1.5)),
|
|
249
|
+
(901, 1, "cookie", 15, (1, 2, 3)),
|
|
250
|
+
],
|
|
251
|
+
)
|
|
252
|
+
def test_update_custom_food_serving_size_in_diary(
|
|
253
|
+
tmp_path, monkeypatch, kwargs, measure_id, quantity, unit, grams, counts
|
|
254
|
+
):
|
|
255
|
+
food = custom_food()
|
|
256
|
+
food["measures"].append(
|
|
257
|
+
{"id": 901, "name": "cookie", "amount": 1, "value": 15, "type": "Atomic"}
|
|
258
|
+
)
|
|
259
|
+
client, state = make_cold_client(tmp_path, [food, OK])
|
|
260
|
+
client.update_custom_food(FOOD_ID, serving_grams=30, **kwargs)
|
|
261
|
+
|
|
262
|
+
saved = state["payloads"][1]["data"]
|
|
263
|
+
monkeypatch.setattr(client, "get_foods", lambda ids: [saved])
|
|
264
|
+
monkeypatch.setattr(client, "get_nutrient_definitions", dict)
|
|
265
|
+
diary = client.enrich_diary_servings(
|
|
266
|
+
{
|
|
267
|
+
"diary": [
|
|
268
|
+
{
|
|
269
|
+
"type": "Serving",
|
|
270
|
+
"foodId": FOOD_ID,
|
|
271
|
+
"measureId": measure_id,
|
|
272
|
+
"grams": consumed_grams,
|
|
273
|
+
}
|
|
274
|
+
for consumed_grams in (15, 30, 45)
|
|
275
|
+
]
|
|
276
|
+
}
|
|
277
|
+
)
|
|
278
|
+
|
|
279
|
+
for entry, count, calories in zip(diary["diary"], counts, (30, 60, 90)):
|
|
280
|
+
assert entry["serving_size"] == {
|
|
281
|
+
"measure_id": measure_id,
|
|
282
|
+
"quantity": quantity,
|
|
283
|
+
"unit": unit,
|
|
284
|
+
"grams": grams,
|
|
285
|
+
}
|
|
286
|
+
assert entry["servings"] == count
|
|
287
|
+
assert "measure" not in entry
|
|
288
|
+
assert "quantity" not in entry
|
|
289
|
+
energy = next(n for n in entry["nutrients"] if n["id"] == 208)
|
|
290
|
+
assert energy["amount"] == calories
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
@pytest.mark.parametrize(
|
|
294
|
+
("given", "kwargs", "name", "amount"),
|
|
295
|
+
[
|
|
296
|
+
("1 serving", {}, "serving", 1.0),
|
|
297
|
+
("10 pieces", {}, "pieces", 10.0),
|
|
298
|
+
("1.5 cups", {}, "cups", 1.5),
|
|
299
|
+
("2 cookies", {"serving_quantity": 3}, "cookies", 3),
|
|
300
|
+
("1/2 cup", {"serving_grams": 120}, "1/2 cup", 1.0),
|
|
301
|
+
("0 calorie syrup", {"serving_grams": 15}, "0 calorie syrup", 1.0),
|
|
302
|
+
],
|
|
303
|
+
)
|
|
304
|
+
def test_update_custom_food_quantity_led_serving_name(
|
|
305
|
+
tmp_path, given, kwargs, name, amount
|
|
306
|
+
):
|
|
307
|
+
"""A plain number leading serving_name becomes the quantity, as the server
|
|
308
|
+
does for a new measure; an explicit serving_quantity wins."""
|
|
309
|
+
client, state = make_cold_client(tmp_path, [weight_default_food(), OK])
|
|
310
|
+
|
|
311
|
+
client.update_custom_food(FOOD_ID, serving_name=given, **kwargs)
|
|
312
|
+
|
|
313
|
+
(measure,) = state["payloads"][1]["data"]["measures"]
|
|
314
|
+
assert (measure["name"], measure["amount"], measure["type"]) == (
|
|
315
|
+
name,
|
|
316
|
+
amount,
|
|
317
|
+
"Atomic",
|
|
318
|
+
)
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
def test_update_custom_food_serving_name_alone_keeps_quantity(tmp_path):
|
|
322
|
+
client, state = make_cold_client(tmp_path, [weight_default_food(), OK])
|
|
323
|
+
|
|
324
|
+
client.update_custom_food(FOOD_ID, serving_name="portion")
|
|
325
|
+
|
|
326
|
+
(measure,) = state["payloads"][1]["data"]["measures"]
|
|
327
|
+
assert (measure["name"], measure["amount"], measure["type"]) == (
|
|
328
|
+
"portion",
|
|
329
|
+
400,
|
|
330
|
+
"Weight",
|
|
331
|
+
)
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
@pytest.mark.parametrize("field", ["serving_grams", "serving_quantity"])
|
|
335
|
+
@pytest.mark.parametrize("bad", [0, -1, float("nan"), float("inf")])
|
|
336
|
+
def test_update_custom_food_rejects_bad_serving_numbers(tmp_path, field, bad):
|
|
337
|
+
client, state = make_cold_client(tmp_path, [])
|
|
338
|
+
|
|
339
|
+
with pytest.raises(ValueError, match=field):
|
|
340
|
+
client.update_custom_food(FOOD_ID, **{field: bad})
|
|
341
|
+
assert state["payloads"] == []
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
def test_update_custom_food_rejects_overflowing_name_quantity(tmp_path):
|
|
345
|
+
"""A leading number too large for a float would become inf; it is
|
|
346
|
+
rejected before anything is fetched or saved."""
|
|
347
|
+
client, state = make_cold_client(tmp_path, [])
|
|
348
|
+
|
|
349
|
+
with pytest.raises(ValueError, match="serving_name quantity"):
|
|
350
|
+
client.update_custom_food(FOOD_ID, serving_name="9" * 400 + " cookies")
|
|
351
|
+
assert state["payloads"] == []
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
def test_update_custom_food_quantity_alone_keeps_total_weight(tmp_path):
|
|
355
|
+
"""Without serving_grams, a new quantity keeps the serving's total weight:
|
|
356
|
+
"2 cookies = 30 g" becomes "3 cookies = 30 g"."""
|
|
357
|
+
food = custom_food()
|
|
358
|
+
food["measures"][0].update(name="cookies", amount=2, value=30)
|
|
359
|
+
client, state = make_cold_client(tmp_path, [food, OK])
|
|
360
|
+
|
|
361
|
+
client.update_custom_food(FOOD_ID, serving_quantity=3)
|
|
362
|
+
|
|
363
|
+
(measure,) = state["payloads"][1]["data"]["measures"]
|
|
364
|
+
assert (measure["name"], measure["amount"], measure["value"]) == (
|
|
365
|
+
"cookies",
|
|
366
|
+
3,
|
|
367
|
+
30,
|
|
368
|
+
)
|
|
369
|
+
|
|
370
|
+
|
|
170
371
|
def test_update_custom_food_extra_nutrients(tmp_path):
|
|
171
372
|
"""extra_nutrients are set (scaled) by id, replacing an existing entry or
|
|
172
373
|
appending a new one, and may not overlap the named macro args."""
|
|
@@ -185,6 +386,42 @@ def test_update_custom_food_extra_nutrients(tmp_path):
|
|
|
185
386
|
client2.update_custom_food(FOOD_ID, extra_nutrients={204: 1.0})
|
|
186
387
|
|
|
187
388
|
|
|
389
|
+
def test_update_custom_food_replaces_barcodes(tmp_path):
|
|
390
|
+
"""barcodes replaces the whole list, normalized; nothing else changes."""
|
|
391
|
+
client, state = make_cold_client(tmp_path, [custom_food(barcodes=["96385074"]), OK])
|
|
392
|
+
|
|
393
|
+
client.update_custom_food(FOOD_ID, barcodes=["0 49000 05010 3"])
|
|
394
|
+
|
|
395
|
+
data = state["payloads"][1]["data"]
|
|
396
|
+
assert data["barcodes"] == ["049000050103"]
|
|
397
|
+
assert data["nutrients"] == custom_food()["nutrients"]
|
|
398
|
+
assert data["measures"] == custom_food()["measures"]
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
def test_update_custom_food_empty_barcodes_clears_them(tmp_path):
|
|
402
|
+
client, state = make_cold_client(tmp_path, [custom_food(barcodes=["96385074"]), OK])
|
|
403
|
+
|
|
404
|
+
client.update_custom_food(FOOD_ID, barcodes=[])
|
|
405
|
+
|
|
406
|
+
assert state["payloads"][1]["data"]["barcodes"] == []
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
def test_update_custom_food_keeps_barcodes_when_not_passed(tmp_path):
|
|
410
|
+
client, state = make_cold_client(tmp_path, [custom_food(barcodes=["96385074"]), OK])
|
|
411
|
+
|
|
412
|
+
client.update_custom_food(FOOD_ID, name="Renamed")
|
|
413
|
+
|
|
414
|
+
assert state["payloads"][1]["data"]["barcodes"] == ["96385074"]
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
def test_update_custom_food_rejects_bad_barcode_before_fetch(tmp_path):
|
|
418
|
+
client, state = make_cold_client(tmp_path, [])
|
|
419
|
+
|
|
420
|
+
with pytest.raises(ValueError, match="check digit"):
|
|
421
|
+
client.update_custom_food(FOOD_ID, barcodes=["4006381333932"])
|
|
422
|
+
assert state["payloads"] == []
|
|
423
|
+
|
|
424
|
+
|
|
188
425
|
def test_update_custom_food_refuses_database_foods(tmp_path):
|
|
189
426
|
"""Only user-created foods may be edited; a database food is rejected
|
|
190
427
|
before anything is sent to add_food."""
|
|
@@ -306,7 +306,7 @@ wheels = [
|
|
|
306
306
|
|
|
307
307
|
[[package]]
|
|
308
308
|
name = "mcp"
|
|
309
|
-
version = "2.
|
|
309
|
+
version = "2.3.0"
|
|
310
310
|
source = { registry = "https://pypi.org/simple" }
|
|
311
311
|
dependencies = [
|
|
312
312
|
{ name = "anyio" },
|
|
@@ -324,22 +324,22 @@ dependencies = [
|
|
|
324
324
|
{ name = "typing-inspection" },
|
|
325
325
|
{ name = "uvicorn", marker = "sys_platform != 'emscripten'" },
|
|
326
326
|
]
|
|
327
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
327
|
+
sdist = { url = "https://files.pythonhosted.org/packages/9d/8d/e0d339616f4810e9051d4aba6887afab289ab1f81875fe908b606cdfd0e3/mcp-2.3.0.tar.gz", hash = "sha256:8b147a50441cf059dc88c684e0aeed3687f0aa0f39c6cde7b90330effd2b34d8", size = 4171955, upload-time = "2026-10-02T22:06:56.091Z" }
|
|
328
328
|
wheels = [
|
|
329
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
329
|
+
{ url = "https://files.pythonhosted.org/packages/20/d7/4a2878f128df729db3ca04e71bfce26405cc2e0c9ebe19c592feeb4c61b9/mcp-2.3.0-py3-none-any.whl", hash = "sha256:dd0c44c089d16453e8ae31a3877a0054d7a2314caaa81f5e0541b9b1734b2377", size = 368664, upload-time = "2026-10-02T22:06:52.119Z" },
|
|
330
330
|
]
|
|
331
331
|
|
|
332
332
|
[[package]]
|
|
333
333
|
name = "mcp-types"
|
|
334
|
-
version = "2.
|
|
334
|
+
version = "2.3.0"
|
|
335
335
|
source = { registry = "https://pypi.org/simple" }
|
|
336
336
|
dependencies = [
|
|
337
337
|
{ name = "pydantic" },
|
|
338
338
|
{ name = "typing-extensions" },
|
|
339
339
|
]
|
|
340
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
340
|
+
sdist = { url = "https://files.pythonhosted.org/packages/9e/2d/7c251e34207f6c51000312fc8839111ac45cfe02023f90b44e7f1051dd8e/mcp_types-2.3.0.tar.gz", hash = "sha256:d1e46549edb35ee19a94940fcee6d1addd7e589ab7ea92dda83f5d84781fc362", size = 65898, upload-time = "2026-10-02T22:06:57.863Z" }
|
|
341
341
|
wheels = [
|
|
342
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
342
|
+
{ url = "https://files.pythonhosted.org/packages/ce/48/32583066b155bb5d4507e7887dc88ee23118cc4de8e2a12870c49719e2a8/mcp_types-2.3.0-py3-none-any.whl", hash = "sha256:968efdbdaedfab06adae40d378a34395f1090c5921d4be3c9cde283aaf76d91d", size = 69108, upload-time = "2026-10-02T22:06:54.099Z" },
|
|
343
343
|
]
|
|
344
344
|
|
|
345
345
|
[[package]]
|
|
@@ -476,11 +476,11 @@ wheels = [
|
|
|
476
476
|
|
|
477
477
|
[[package]]
|
|
478
478
|
name = "python-dotenv"
|
|
479
|
-
version = "1.2.
|
|
479
|
+
version = "1.2.4"
|
|
480
480
|
source = { registry = "https://pypi.org/simple" }
|
|
481
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
481
|
+
sdist = { url = "https://files.pythonhosted.org/packages/74/26/2fbeedb218a787a5eea551c7532cac4e009f83d689dd2faa0d0353473f86/python_dotenv-1.2.4.tar.gz", hash = "sha256:f0d53e69935a851c0dcc78f3ab7aaccd8cabef0b92382b576b824212902873c0", size = 60824, upload-time = "2026-10-01T05:36:10Z" }
|
|
482
482
|
wheels = [
|
|
483
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
483
|
+
{ url = "https://files.pythonhosted.org/packages/60/d1/38f3a3405989a89ac18390803e70c6ad7c7760da4f9b83cbeca0c44a0c72/python_dotenv-1.2.4-py3-none-any.whl", hash = "sha256:42269a8a5b3fd54ffa6f3d84b18abed50064717576b4ecf03dc4a55d8aa04fdc", size = 23266, upload-time = "2026-10-01T05:36:08.633Z" },
|
|
484
484
|
]
|
|
485
485
|
|
|
486
486
|
[[package]]
|
|
@@ -554,27 +554,27 @@ wheels = [
|
|
|
554
554
|
|
|
555
555
|
[[package]]
|
|
556
556
|
name = "ruff"
|
|
557
|
-
version = "0.16.
|
|
558
|
-
source = { registry = "https://pypi.org/simple" }
|
|
559
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
560
|
-
wheels = [
|
|
561
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
562
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
563
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
564
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
565
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
566
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
567
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
568
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
569
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
570
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
571
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
572
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
573
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
574
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
575
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
576
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
577
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
557
|
+
version = "0.16.10"
|
|
558
|
+
source = { registry = "https://pypi.org/simple" }
|
|
559
|
+
sdist = { url = "https://files.pythonhosted.org/packages/c4/49/23802c45f093eb14bde54b141d2b2f058edfa63a06db7beed047308cc08f/ruff-0.16.10.tar.gz", hash = "sha256:eff4728c4eaae93f0955cd264d24b2ab348e74bf59986ccf282ba6dc16b3b017", size = 4958724, upload-time = "2026-10-01T18:03:21.697Z" }
|
|
560
|
+
wheels = [
|
|
561
|
+
{ url = "https://files.pythonhosted.org/packages/2f/21/ebce22e1d90cdb2cd691026b9c6e9bec6499f0b396089481755b5d49efff/ruff-0.16.10-py3-none-linux_armv6l.whl", hash = "sha256:488b0fe3f3574210e5cf80d9f59b9e3ab17a127a8155de3f307b392589cfb511", size = 10095557, upload-time = "2026-10-01T18:02:36.072Z" },
|
|
562
|
+
{ url = "https://files.pythonhosted.org/packages/cb/98/a54de85876a8b2612bfa0d84c7b9abfb39c6a3354aee7800b09c1649b9e3/ruff-0.16.10-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:e748ff95c934c4e978783b8e687bc174e7bd84e8ad24e3243e1ecfcda5e0282d", size = 10340577, upload-time = "2026-10-01T18:02:39.258Z" },
|
|
563
|
+
{ url = "https://files.pythonhosted.org/packages/9f/16/1a5a4a2657effe4806110f2b907313802f1367fcdbb29e8122766e407fab/ruff-0.16.10-py3-none-macosx_11_0_arm64.whl", hash = "sha256:3031a4a2e8e7b8a46f70be45f198c35a11ece509a94b80334d8d397a33c67550", size = 9774282, upload-time = "2026-10-01T18:02:41.79Z" },
|
|
564
|
+
{ url = "https://files.pythonhosted.org/packages/6e/fb/470085af734da396e68cd80fb0a3e7c109a459716ae59588c0f6fab8a17d/ruff-0.16.10-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:494401c86df4c4c25f69b9419605d944467ee98c42fb6ad405ef4fa40b8fb67d", size = 9920895, upload-time = "2026-10-01T18:02:44.458Z" },
|
|
565
|
+
{ url = "https://files.pythonhosted.org/packages/57/de/f10cffe4f88a37ea6615ec460f01bf76f0bc1477737a35d9ee61a630a78b/ruff-0.16.10-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d203abc0ff2b773ee33d00ab8df0bb67046fbc7c07b119332f08b9b345cf8221", size = 9902707, upload-time = "2026-10-01T18:02:47.041Z" },
|
|
566
|
+
{ url = "https://files.pythonhosted.org/packages/ff/44/3fdcedf83ae60ef837dd239170e480dce606a9142cfa2db911afdf855fd9/ruff-0.16.10-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:bd83d1235a5258d318477bc5b576303974cbdef5df0c01a1bff14efcc23bd12a", size = 10619287, upload-time = "2026-10-01T18:02:49.485Z" },
|
|
567
|
+
{ url = "https://files.pythonhosted.org/packages/c1/62/02e76a5574002153618eafbb70e159468addc72a5d2c488e65cbb4639d2d/ruff-0.16.10-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:bc2610fb269fa56dd8a68669ae470fa6272902668c0fc2ebc3aa112b2633d5b8", size = 11339942, upload-time = "2026-10-01T18:02:52.008Z" },
|
|
568
|
+
{ url = "https://files.pythonhosted.org/packages/6b/c4/cde27d47ad8d4126c587e608c67c46e7feac11763f606d261a1bc8a489e6/ruff-0.16.10-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3e70175e29cc94c26ea296c80e470180b744b7419026898e58f520c6ab32578e", size = 10934316, upload-time = "2026-10-01T18:02:54.811Z" },
|
|
569
|
+
{ url = "https://files.pythonhosted.org/packages/e4/03/17234145f302a645a123e8c3bb2411ecf4669fbc350de3b0d803230a1729/ruff-0.16.10-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f33f43a864a8483eebd160e713336c8bab02c934feaff0a33cf5ccb41546d09a", size = 10387968, upload-time = "2026-10-01T18:02:57.497Z" },
|
|
570
|
+
{ url = "https://files.pythonhosted.org/packages/71/29/2493af60240ee7644b38a4b821f5f9c3b5a4fa3178770fe1d0c685217395/ruff-0.16.10-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:1dfc6f0088149fb6a362c1c446bcbb3fd2157b3852fe2fa68409276eab9ad9b3", size = 10537906, upload-time = "2026-10-01T18:03:00.006Z" },
|
|
571
|
+
{ url = "https://files.pythonhosted.org/packages/2e/9a/f56b28f3b143bb9e518c34fb89ab191b626bca8b70dbf8af0d2e2d473572/ruff-0.16.10-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:6553498afc35f580f036030795810b9e6bcea31604b0fd9e8d352795473042e3", size = 10012938, upload-time = "2026-10-01T18:03:03.006Z" },
|
|
572
|
+
{ url = "https://files.pythonhosted.org/packages/c2/c4/fca37362848ea4d4d80712df13632e645e7c7cfb1bdedf140699ac7a090b/ruff-0.16.10-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:a3b8471dea115d37f123882be852bed13403746d3a76c11de4a19ec5f9ff5a03", size = 9897945, upload-time = "2026-10-01T18:03:05.818Z" },
|
|
573
|
+
{ url = "https://files.pythonhosted.org/packages/7d/c7/e0bc57664d6e0c61fd22f620af260fe9662d7e1ddb320ea7f160e76ef165/ruff-0.16.10-py3-none-musllinux_1_2_i686.whl", hash = "sha256:92e59a70bcbd9d3a5483656da906ec28edfdacfce00afd99edb8b4e9d15644be", size = 10333134, upload-time = "2026-10-01T18:03:08.25Z" },
|
|
574
|
+
{ url = "https://files.pythonhosted.org/packages/21/aa/5c9f3b68737c0e4a33a1db5dfab44f7b786d96ca91a7233112ddab1e6dc2/ruff-0.16.10-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:7ae7375f803b5520dc9f546bed7e3a0acb70b91812e9bb4b19927de22f25b77d", size = 10741702, upload-time = "2026-10-01T18:03:10.775Z" },
|
|
575
|
+
{ url = "https://files.pythonhosted.org/packages/78/fa/0f9c2020dc316c53d983be011720b8157cc052b97e3f4dfa7db6d0f880a6/ruff-0.16.10-py3-none-win32.whl", hash = "sha256:2a12e01cb9156c10c466f63b46eaae5ecea28dfbd21b5836353ae498e7d1349a", size = 10139176, upload-time = "2026-10-01T18:03:13.267Z" },
|
|
576
|
+
{ url = "https://files.pythonhosted.org/packages/99/29/cfb0df9448d4d4ad48c2de029ada9ebd71baa6da983a6c77ee6c6cd0fe82/ruff-0.16.10-py3-none-win_amd64.whl", hash = "sha256:97f2015c92aa97105b0eab19eb5d224884399281cfc5da86a92db4ab5e7fb2ca", size = 10584734, upload-time = "2026-10-01T18:03:16.006Z" },
|
|
577
|
+
{ url = "https://files.pythonhosted.org/packages/fc/05/c16957eb287c3fc062e032619a25868d93d408a844b725bcf514f7a378ff/ruff-0.16.10-py3-none-win_arm64.whl", hash = "sha256:25a65fe998c4e6861ec079ada5826a2fc605e6cbccbe9dcd7fac1f54e791621b", size = 10366440, upload-time = "2026-10-01T18:03:19.04Z" },
|
|
578
578
|
]
|
|
579
579
|
|
|
580
580
|
[[package]]
|
|
@@ -643,11 +643,11 @@ wheels = [
|
|
|
643
643
|
|
|
644
644
|
[[package]]
|
|
645
645
|
name = "tzdata"
|
|
646
|
-
version = "2026.
|
|
646
|
+
version = "2026.5"
|
|
647
647
|
source = { registry = "https://pypi.org/simple" }
|
|
648
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
648
|
+
sdist = { url = "https://files.pythonhosted.org/packages/d9/68/f1b440335057bfce71b6e50a9d09445aa2ecbd08359a337976627b8409e7/tzdata-2026.5.tar.gz", hash = "sha256:8cc73c0a0bfca7dbfa59235d60b2eff82231dee33f53d206db1acd9173cfc0a7", size = 200404, upload-time = "2026-10-03T09:23:14.143Z" }
|
|
649
649
|
wheels = [
|
|
650
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
650
|
+
{ url = "https://files.pythonhosted.org/packages/94/21/1e5995a1c920cce14e4bffae20c665ec10e7ed03ab25e006cd741092b718/tzdata-2026.5-py2.py3-none-any.whl", hash = "sha256:b683bd1b6659ddcd810ff02ad09ba821d4bf1065072805063eb35c49617905ac", size = 347996, upload-time = "2026-10-03T09:23:12.535Z" },
|
|
651
651
|
]
|
|
652
652
|
|
|
653
653
|
[[package]]
|
|
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
|