File tree Expand file tree Collapse file tree 8 files changed +41
-38
lines changed
mp_api/client/routes/materials Expand file tree Collapse file tree 8 files changed +41
-38
lines changed Original file line number Diff line number Diff line change 3232
3333 - name : Install Python dependencies
3434 run : |
35- python -m pip install --upgrade pip
35+ python -m pip install --upgrade " pip<25.3"
3636 pip install -r requirements/requirements-${{ matrix.os }}_py${{ matrix.python-version }}.txt
3737 pip install -r requirements/requirements-${{ matrix.os }}_py${{ matrix.python-version }}_extras.txt
3838
Original file line number Diff line number Diff line change 2323 - name : Upgrade Python dependencies
2424 shell : bash
2525 run : |
26- python -m pip install --upgrade pip pip-tools
27- python -m piptools compile -q --upgrade --resolver=backtracking - o requirements/requirements-${{ matrix.os }}_py${{ matrix.python-version }}.txt pyproject.toml
28- python -m piptools compile -q --upgrade --resolver=backtracking -- all-extras -o requirements/requirements-${{ matrix.os }}_py${{ matrix.python-version }}_extras.txt pyproject.toml
26+ python -m pip install --upgrade " pip<25.3" pip-tools
27+ python -m piptools compile -q --upgrade -o requirements/requirements-${{ matrix.os }}_py${{ matrix.python-version }}.txt pyproject.toml
28+ python -m piptools compile -q --upgrade --all-extras -o requirements/requirements-${{ matrix.os }}_py${{ matrix.python-version }}_extras.txt pyproject.toml
2929 - name : Detect changes
3030 id : changes
3131 shell : bash
Original file line number Diff line number Diff line change @@ -304,12 +304,17 @@ def find_structure(
304304 use_document_model = False ,
305305 ).get ("data" )
306306
307- if len (results ) > 1 : # type: ignore
307+ if not results :
308+ return []
309+
310+ material_ids = validate_ids ([doc ["material_id" ] for doc in results ])
311+
312+ if len (material_ids ) > 1 : # type: ignore
308313 if not allow_multiple_results :
309314 raise ValueError (
310315 "Multiple matches found for this combination of tolerances, but "
311316 "`allow_multiple_results` set to False."
312317 )
313- return results # type: ignore
318+ return material_ids # type: ignore
314319
315- return results [ 0 ][ "material_id" ] if ( results and results [ 0 ]) else [ ]
320+ return material_ids [ 0 ]
Original file line number Diff line number Diff line change @@ -10,9 +10,9 @@ bibtexparser==1.4.3
1010 # via pymatgen
1111blake3==1.0.8
1212 # via emmet-core
13- boto3==1.40.59
13+ boto3==1.40.61
1414 # via mp-api (pyproject.toml)
15- botocore==1.40.59
15+ botocore==1.40.61
1616 # via
1717 # boto3
1818 # s3transfer
@@ -51,7 +51,7 @@ mpmath==1.3.0
5151 # via sympy
5252msgpack==1.1.2
5353 # via mp-api (pyproject.toml)
54- narwhals==2.9 .0
54+ narwhals==2.10 .0
5555 # via plotly
5656networkx==3.5
5757 # via pymatgen
@@ -110,7 +110,7 @@ python-dateutil==2.9.0.post0
110110 # botocore
111111 # matplotlib
112112 # pandas
113- python-dotenv==1.1 .1
113+ python-dotenv==1.2 .1
114114 # via pydantic-settings
115115pytz==2025.2
116116 # via pandas
@@ -129,7 +129,7 @@ ruamel-yaml-clib==0.2.14
129129 # via ruamel-yaml
130130s3transfer==0.14.0
131131 # via boto3
132- scipy==1.16.2
132+ scipy==1.16.3
133133 # via pymatgen
134134six==1.17.0
135135 # via python-dateutil
Original file line number Diff line number Diff line change @@ -26,9 +26,9 @@ blake3==1.0.8
2626 # via emmet-core
2727boltons==25.0.0
2828 # via mpcontribs-client
29- boto3==1.40.59
29+ boto3==1.40.61
3030 # via mp-api (pyproject.toml)
31- botocore==1.40.59
31+ botocore==1.40.61
3232 # via
3333 # boto3
3434 # s3transfer
@@ -133,7 +133,7 @@ jsonschema-specifications==2025.9.1
133133 # via jsonschema
134134kiwisolver==1.4.9
135135 # via matplotlib
136- lark==1.3.0
136+ lark==1.3.1
137137 # via rfc3987-syntax
138138latexcodec==3.0.1
139139 # via pybtex
@@ -181,7 +181,7 @@ mypy-extensions==1.1.0
181181 # via
182182 # mp-api (pyproject.toml)
183183 # mypy
184- narwhals==2.9 .0
184+ narwhals==2.10 .0
185185 # via plotly
186186networkx==3.5
187187 # via
@@ -262,7 +262,7 @@ pre-commit==4.3.0
262262 # via mp-api (pyproject.toml)
263263prompt-toolkit==3.0.52
264264 # via ipython
265- psutil==7.1.1
265+ psutil==7.1.2
266266 # via custodian
267267ptyprocess==0.7.0
268268 # via pexpect
@@ -352,7 +352,7 @@ python-dateutil==2.9.0.post0
352352 # bravado-core
353353 # matplotlib
354354 # pandas
355- python-dotenv==1.1 .1
355+ python-dotenv==1.2 .1
356356 # via pydantic-settings
357357pytz==2025.2
358358 # via
@@ -409,7 +409,7 @@ scikit-image==0.25.2
409409 # via pymatgen-analysis-defects
410410scikit-learn==1.7.2
411411 # via matminer
412- scipy==1.16.2
412+ scipy==1.16.3
413413 # via
414414 # ase
415415 # pymatgen
Original file line number Diff line number Diff line change @@ -10,9 +10,9 @@ bibtexparser==1.4.3
1010 # via pymatgen
1111blake3==1.0.8
1212 # via emmet-core
13- boto3==1.40.59
13+ boto3==1.40.61
1414 # via mp-api (pyproject.toml)
15- botocore==1.40.59
15+ botocore==1.40.61
1616 # via
1717 # boto3
1818 # s3transfer
@@ -51,7 +51,7 @@ mpmath==1.3.0
5151 # via sympy
5252msgpack==1.1.2
5353 # via mp-api (pyproject.toml)
54- narwhals==2.9 .0
54+ narwhals==2.10 .0
5555 # via plotly
5656networkx==3.5
5757 # via pymatgen
@@ -110,7 +110,7 @@ python-dateutil==2.9.0.post0
110110 # botocore
111111 # matplotlib
112112 # pandas
113- python-dotenv==1.1 .1
113+ python-dotenv==1.2 .1
114114 # via pydantic-settings
115115pytz==2025.2
116116 # via pandas
@@ -129,7 +129,7 @@ ruamel-yaml-clib==0.2.14
129129 # via ruamel-yaml
130130s3transfer==0.14.0
131131 # via boto3
132- scipy==1.16.2
132+ scipy==1.16.3
133133 # via pymatgen
134134six==1.17.0
135135 # via python-dateutil
Original file line number Diff line number Diff line change @@ -26,9 +26,9 @@ blake3==1.0.8
2626 # via emmet-core
2727boltons==25.0.0
2828 # via mpcontribs-client
29- boto3==1.40.59
29+ boto3==1.40.61
3030 # via mp-api (pyproject.toml)
31- botocore==1.40.59
31+ botocore==1.40.61
3232 # via
3333 # boto3
3434 # s3transfer
@@ -133,7 +133,7 @@ jsonschema-specifications==2025.9.1
133133 # via jsonschema
134134kiwisolver==1.4.9
135135 # via matplotlib
136- lark==1.3.0
136+ lark==1.3.1
137137 # via rfc3987-syntax
138138latexcodec==3.0.1
139139 # via pybtex
@@ -181,7 +181,7 @@ mypy-extensions==1.1.0
181181 # via
182182 # mp-api (pyproject.toml)
183183 # mypy
184- narwhals==2.9 .0
184+ narwhals==2.10 .0
185185 # via plotly
186186networkx==3.5
187187 # via
@@ -262,7 +262,7 @@ pre-commit==4.3.0
262262 # via mp-api (pyproject.toml)
263263prompt-toolkit==3.0.52
264264 # via ipython
265- psutil==7.1.1
265+ psutil==7.1.2
266266 # via custodian
267267ptyprocess==0.7.0
268268 # via pexpect
@@ -352,7 +352,7 @@ python-dateutil==2.9.0.post0
352352 # bravado-core
353353 # matplotlib
354354 # pandas
355- python-dotenv==1.1 .1
355+ python-dotenv==1.2 .1
356356 # via pydantic-settings
357357pytz==2025.2
358358 # via
@@ -409,7 +409,7 @@ scikit-image==0.25.2
409409 # via pymatgen-analysis-defects
410410scikit-learn==1.7.2
411411 # via matminer
412- scipy==1.16.2
412+ scipy==1.16.3
413413 # via
414414 # ase
415415 # pymatgen
Original file line number Diff line number Diff line change @@ -96,16 +96,14 @@ def test_get_structures(self, mpr):
9696 structs = mpr .get_structures ("Mn-O" , final = False )
9797 assert len (structs ) > 0
9898
99- @pytest .mark .skip (reason = "Endpoint issues" )
10099 def test_find_structure (self , mpr ):
101100 path = os .path .join (MAPIClientSettings ().TEST_FILES , "Si_mp_149.cif" )
102- with open (path ) as file :
103- data = mpr .find_structure (path )
104- assert len (data ) > 0
101+ data = mpr .find_structure (path )
102+ assert isinstance (data , str ) and data == "mp-149"
105103
106- s = CifParser (file ).get_structures ()[0 ]
107- data = mpr .find_structure (s )
108- assert len (data ) > 0
104+ s = CifParser (path ).get_structures ()[0 ]
105+ data = mpr .find_structure (s )
106+ assert isinstance (data , str ) and data == "mp-149"
109107
110108 def test_get_bandstructure_by_material_id (self , mpr ):
111109 bs = mpr .get_bandstructure_by_material_id ("mp-149" )
You can’t perform that action at this time.
0 commit comments