mpcontribs-client 5.8.3__py3-none-any.whl → 5.9.0__py3-none-any.whl

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.
@@ -61,6 +61,7 @@ from tempfile import gettempdir
61
61
  from plotly.express._chart_types import line as line_chart
62
62
  from cachetools import cached, LRUCache
63
63
  from cachetools.keys import hashkey
64
+ from pymatgen.core import SETTINGS
64
65
 
65
66
  RETRIES = 3
66
67
  MAX_WORKERS = 3
@@ -886,7 +887,9 @@ class Client(SwaggerClient):
886
887
  host = os.environ.get("MPCONTRIBS_API_HOST", DEFAULT_HOST)
887
888
 
888
889
  if not apikey:
889
- apikey = os.environ.get("MPCONTRIBS_API_KEY")
890
+ apikey = os.environ.get("MPCONTRIBS_API_KEY", SETTINGS.get("PMG_MAPI_KEY"))
891
+ if apikey and len(apikey) != 32:
892
+ raise MPContribsClientError(f"Invalid API key: {apikey}")
890
893
 
891
894
  if apikey and headers:
892
895
  apikey = None
@@ -1174,7 +1177,7 @@ class Client(SwaggerClient):
1174
1177
  name (str): unique name matching `^[a-zA-Z0-9_]{3,31}$`
1175
1178
  title (str): unique title with 5-30 characters
1176
1179
  authors (str): comma-separated list of authors
1177
- description (str): brief description (max 1500 characters)
1180
+ description (str): brief description (max 2000 characters)
1178
1181
  url (str): URL for primary reference (paper/website/...)
1179
1182
  """
1180
1183
  queries = [{"name": name}, {"title": title}]
@@ -2171,7 +2174,9 @@ class Client(SwaggerClient):
2171
2174
  for kk, vv in flatten(contrib[k], reducer="dot").items():
2172
2175
  if isinstance(vv, bool):
2173
2176
  flat[kk] = "Yes" if vv else "No"
2174
- elif isinstance(vv, str) and vv:
2177
+ elif (isinstance(vv, str) and vv) or isinstance(
2178
+ vv, (float, int)
2179
+ ):
2175
2180
  flat[kk] = vv
2176
2181
  contrib_copy[k] = deepcopy(unflatten(flat, splitter="dot"))
2177
2182
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mpcontribs-client
3
- Version: 5.8.3
3
+ Version: 5.9.0
4
4
  Summary: client library for MPContribs API
5
5
  Home-page: https://github.com/materialsproject/MPContribs/tree/master/mpcontribs-client
6
6
  Author: Patrick Huck
@@ -9,6 +9,7 @@ License: MIT
9
9
  Requires-Python: >=3.8
10
10
  Description-Content-Type: text/markdown
11
11
  License-File: LICENSE
12
+ Requires-Dist: numpy <2
12
13
  Requires-Dist: boltons
13
14
  Requires-Dist: bravado
14
15
  Requires-Dist: filetype
@@ -0,0 +1,6 @@
1
+ mpcontribs/client/__init__.py,sha256=K4OCUoMpwJvkAbJvM03-TPd5wzQi0RkBpjd8WJBwP7w,96983
2
+ mpcontribs_client-5.9.0.dist-info/LICENSE,sha256=5tG0Niaqw2hnuyZZYkRXLSnfVrZA47COwduU_6caPLM,1074
3
+ mpcontribs_client-5.9.0.dist-info/METADATA,sha256=5zIrQcDW0whyINa0Vnq8PnRIlHvd8tdvyDjPt05p7LE,2572
4
+ mpcontribs_client-5.9.0.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
5
+ mpcontribs_client-5.9.0.dist-info/top_level.txt,sha256=t8R5L_Dg9oDQMh2gyRFdZGnrzZsr7OjCBTrhTcmimC8,11
6
+ mpcontribs_client-5.9.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: setuptools (75.2.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,6 +0,0 @@
1
- mpcontribs/client/__init__.py,sha256=jCx5MiBycIWR8yD-q5d3MmreaDOal91IcLrWgjZE7c4,96703
2
- mpcontribs_client-5.8.3.dist-info/LICENSE,sha256=5tG0Niaqw2hnuyZZYkRXLSnfVrZA47COwduU_6caPLM,1074
3
- mpcontribs_client-5.8.3.dist-info/METADATA,sha256=V0m6nTJ6Dp7bPFvtACVKBc9TLW4oubTnWPUQ6gA7Y1M,2548
4
- mpcontribs_client-5.8.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
5
- mpcontribs_client-5.8.3.dist-info/top_level.txt,sha256=t8R5L_Dg9oDQMh2gyRFdZGnrzZsr7OjCBTrhTcmimC8,11
6
- mpcontribs_client-5.8.3.dist-info/RECORD,,