Skip to content

Commit a77c088

Browse files
committed
test CI prefix pip commands with python -m
to fix windows error C:\hostedtoolcache\windows\Python\3.10.8\x64\python.exe: No module named twine
1 parent 4655ce2 commit a77c088

File tree

3 files changed

+18
-35
lines changed

3 files changed

+18
-35
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ jobs:
5151
done
5252
- name: Install dependencies
5353
run: |
54-
pip install --upgrade pip wheel
55-
pip install m3gnet
56-
pip install -e '.[dev,optional]'
54+
python -m pip install --upgrade pip wheel
55+
python -m pip install m3gnet
56+
python -m pip install -e '.[dev,optional]'
5757
- name: pytest split ${{ matrix.split }}
5858
# to update the test durations, run
5959
# pytest --store-durations --durations-path test_files/.pytest-split-durations
@@ -76,7 +76,7 @@ jobs:
7676
with:
7777
python-version: '3.10'
7878
- name: Install Coverage
79-
run: pip install coverage
79+
run: python -m pip install coverage
8080
- name: Download coverage artifacts
8181
continue-on-error: true
8282
uses: actions/download-artifact@v3
@@ -112,7 +112,7 @@ jobs:
112112
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
113113
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
114114
run: |
115-
pip install --upgrade pip wheel setuptools twine
116-
pip install numpy Cython # needed to get location of numpy header files in setup.py
115+
python -m pip install --upgrade pip wheel setuptools twine
116+
python -m pip install numpy Cython # needed to get location of numpy header files in setup.py
117117
python setup.py sdist bdist_wheel
118118
python -m twine upload --skip-existing dist/*.whl dist/*.tar.gz

pymatgen/entries/compatibility.py

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -347,22 +347,22 @@ def get_correction(self, entry) -> ufloat:
347347

348348
comp = entry.composition
349349
rform = comp.reduced_formula
350-
cpdenergies = self.cpd_energies
350+
cpd_energies = self.cpd_energies
351351

352352
# only correct GGA or GGA+U entries
353353
if entry.parameters.get("run_type", None) not in ["GGA", "GGA+U"]:
354354
return ufloat(0.0, 0.0)
355355

356356
correction = ufloat(0.0, 0.0)
357357

358-
if rform in cpdenergies:
358+
if rform in cpd_energies:
359359
if rform in ["H2", "H2O"]:
360-
corr = cpdenergies[rform] * comp.num_atoms - entry.uncorrected_energy - entry.correction
360+
corr = cpd_energies[rform] * comp.num_atoms - entry.uncorrected_energy - entry.correction
361361
err = self.cpd_errors[rform] * comp.num_atoms
362362

363363
correction += ufloat(corr, err)
364364
else:
365-
corr = cpdenergies[rform] * comp.num_atoms
365+
corr = cpd_energies[rform] * comp.num_atoms
366366
err = self.cpd_errors[rform] * comp.num_atoms
367367

368368
correction += ufloat(corr, err)
@@ -491,17 +491,17 @@ def get_correction(self, entry) -> ufloat:
491491
if entry.parameters.get("run_type", None) not in ["GGA", "GGA+U"]:
492492
return ufloat(0.0, 0.0)
493493

494-
ucorr = self.u_corrections.get(most_electroneg, {})
495-
usettings = self.u_settings.get(most_electroneg, {})
496-
uerrors = self.u_errors.get(most_electroneg, defaultdict(float))
494+
u_corr = self.u_corrections.get(most_electroneg, {})
495+
u_settings = self.u_settings.get(most_electroneg, {})
496+
u_errors = self.u_errors.get(most_electroneg, defaultdict(float))
497497

498498
for el in comp.elements:
499499
sym = el.symbol
500500
# Check for bad U values
501-
if calc_u.get(sym, 0) != usettings.get(sym, 0):
501+
if calc_u.get(sym, 0) != u_settings.get(sym, 0):
502502
raise CompatibilityError(f"Invalid U value of {calc_u.get(sym, 0)} on {sym}")
503-
if sym in ucorr:
504-
correction += ufloat(ucorr[sym], uerrors[sym]) * comp[el]
503+
if sym in u_corr:
504+
correction += ufloat(u_corr[sym], u_errors[sym]) * comp[el]
505505

506506
return correction
507507

@@ -670,14 +670,7 @@ def get_adjustments(self, entry: AnyComputedEntry) -> list[EnergyAdjustment]:
670670
uncertainty = np.nan
671671
else:
672672
uncertainty = uncertainties[k]
673-
adjustment_list.append(
674-
ConstantEnergyAdjustment(
675-
v,
676-
uncertainty=uncertainty,
677-
name=k,
678-
cls=self.as_dict(),
679-
)
680-
)
673+
adjustment_list.append(ConstantEnergyAdjustment(v, uncertainty=uncertainty, name=k, cls=self.as_dict()))
681674

682675
return adjustment_list
683676

pymatgen/entries/entry_tools.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,7 @@ def _get_host(structure, species_to_remove):
3939

4040

4141
def _perform_grouping(args):
42-
(
43-
entries_json,
44-
hosts_json,
45-
ltol,
46-
stol,
47-
angle_tol,
48-
primitive_cell,
49-
scale,
50-
comparator,
51-
groups,
52-
) = args
42+
entries_json, hosts_json, ltol, stol, angle_tol, primitive_cell, scale, comparator, groups = args
5343

5444
entries = json.loads(entries_json, cls=MontyDecoder)
5545
hosts = json.loads(hosts_json, cls=MontyDecoder)

0 commit comments

Comments
 (0)