Skip to content

Commit 47869a7

Browse files
committed
Merge remote-tracking branch 'upstream/master' into dev
2 parents 353da7f + 118c245 commit 47869a7

File tree

2,666 files changed

+140195
-258542
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,666 files changed

+140195
-258542
lines changed

.gitattributes

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# declare HTML, rST and test files as vendored/docs to exclude them when calculating repo languages on GitHub
2-
**/test_files/**/* linguist-vendored
2+
tests/files/**/* linguist-vendored
33
cmd_line/* linguist-vendored
44
docs/**/* linguist-generated
55
docs_rst/**/* linguist-documentation

.github/ISSUE_TEMPLATE/bug_report.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ about: Create a report to help us improve
55

66
#### Description
77

8-
A clear and concise bug description.
8+
A clear and concise bug description. Please submit only issues regarding pymatgen only. If you encounter errors
9+
related to any of pymatgen's dependencies (e.g., [mp-api](https://github.com/materialsproject/api)), please post
10+
Issues on the respective Github Issues pages.
911

1012
#### Repro
1113

.github/PULL_REQUEST_TEMPLATE.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
11
## Summary
22

3-
Major updates:
3+
Major changes:
44

55
- feature 1: ...
66
- fix 1: ...
77

88
## Todos
99

10-
If this is a work in progress, about what else needs to be done?
10+
If this is work in progress, what else needs to be done?
1111

1212
- feature 2: ...
1313
- fix 2:
1414

1515
## Checklist
1616

17-
Ensure:
18-
1917
- [ ] Google format doc strings added. Check with `ruff`.
2018
- [ ] Type annotations included. Check with `mypy`.
2119
- [ ] Tests added for new features/fixes.
22-
- [ ] All tests and linting pass.
20+
- [ ] If applicable, new classes/functions/modules have [`duecredit`](https://github.com/duecredit/duecredit) `@due.dcite` decorators to reference relevant papers by DOI ([example](https://github.com/materialsproject/pymatgen/blob/91dbe6ee9ed01d781a9388bf147648e20c6d58e0/pymatgen/core/lattice.py#L1168-L1172))
2321

24-
Tip: Install `pre-commit` hooks to auto-check before every commit:
22+
Tip: Install `pre-commit` hooks to auto-check types and linting before every commit:
2523

2624
```sh
2725
pip install -U pre-commit

.github/dependabot.yml

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
version: 2
2-
updates:
3-
- package-ecosystem: github-actions
4-
directory: /
5-
schedule:
6-
interval: monthly
1+
# version: 2
2+
# updates:
3+
# - package-ecosystem: github-actions
4+
# directory: /
5+
# schedule:
6+
# interval: monthly
77

8-
- package-ecosystem: pip
9-
directory: /
10-
schedule:
11-
interval: monthly
8+
# - package-ecosystem: pip
9+
# directory: /
10+
# schedule:
11+
# interval: monthly

.github/workflows/lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Set up Python
2121
uses: actions/setup-python@v4
2222
with:
23-
python-version: '3.11'
23+
python-version: "3.11"
2424
cache: pip
2525
cache-dependency-path: setup.py
2626

.github/workflows/test.yml

+79-47
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ name: Tests
55
on:
66
push:
77
branches: [master]
8+
paths-ignore: ["**/*.md", docs/**]
89
pull_request:
910
branches: [master]
11+
paths-ignore: ["**/*.md", docs/**]
1012
release:
1113
types: [published]
1214
workflow_dispatch:
@@ -21,14 +23,15 @@ permissions:
2123
contents: read
2224

2325
jobs:
24-
pytest:
26+
test:
2527
# prevent this action from running on forks
2628
if: github.repository == 'materialsproject/pymatgen'
2729
strategy:
30+
fail-fast: false
2831
matrix:
2932
# pytest-split automatically distributes work load so parallel jobs finish in similar time
3033
os: [ubuntu-latest, windows-latest]
31-
python-version: ['3.8', '3.11']
34+
python-version: ["3.8", "3.11"]
3235
split: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
3336
# include/exclude is meant to maximize CI coverage of different platforms and python
3437
# versions while minimizing the total number of jobs. We run all pytest splits with the
@@ -37,30 +40,31 @@ jobs:
3740
# coverage on unix). Also sample some splits on macos for all python versions
3841
exclude:
3942
- os: windows-latest
40-
python-version: '3.11'
43+
python-version: "3.11"
4144
- os: ubuntu-latest
42-
python-version: '3.8'
45+
python-version: "3.8"
4346
include:
4447
- os: macos-latest
45-
python-version: '3.8'
48+
python-version: "3.8"
4649
split: 1
4750
- os: macos-latest
48-
python-version: '3.9'
51+
python-version: "3.9"
4952
split: 2
5053
- os: macos-latest
51-
python-version: '3.10'
54+
python-version: "3.10"
5255
split: 3
5356
- os: macos-latest
54-
python-version: '3.11'
57+
python-version: "3.11"
5558
split: 4
5659

5760
runs-on: ${{ matrix.os }}
5861

5962
env:
6063
PMG_MAPI_KEY: ${{ secrets.PMG_MAPI_KEY }}
6164
MPLBACKEND: Agg # https://github.com/orgs/community/discussions/26434
62-
PMG_TEST_FILES_DIR: ${{ github.workspace }}/test_files
65+
PMG_TEST_FILES_DIR: ${{ github.workspace }}/tests/files
6366
GULP_LIB: ${{ github.workspace }}/cmd_line/gulp/Libraries
67+
PMG_VASP_PSP_DIR: ${{ github.workspace }}/tests/files
6468

6569
steps:
6670
- uses: actions/checkout@v3
@@ -70,90 +74,117 @@ jobs:
7074
python-version: ${{ matrix.python-version }}
7175
cache: pip
7276
cache-dependency-path: setup.py
73-
- name: Add CLIs to GITHUB_PATH
74-
if: runner.os != 'Windows'
77+
- name: Copy CLIs to bin
78+
if: runner.os == 'Linux'
7579
# This is the way to update env variables in a way that persist for the entire job.
7680
run: |
77-
for pkg in cmd_line/*;
78-
do echo "$(pwd)/cmd_line/$pkg/Linux_64bit" >> "$GITHUB_PATH";
79-
done
80-
- name: Install m3gnet
81-
# conditional install necessary because TF lacks py3.11 support
82-
# https://github.com/tensorflow/tensorflow/issues/58032
83-
if: matrix.python-version != '3.11'
84-
run: python -m pip install m3gnet
81+
sudo cp cmd_line/gulp/Linux_64bit/* /usr/local/bin/
82+
- name: Install Bader
83+
if: runner.os == 'Linux'
84+
run: |
85+
wget http://theory.cm.utexas.edu/henkelman/code/bader/download/bader_lnx_64.tar.gz
86+
tar xvzf bader_lnx_64.tar.gz
87+
sudo mv bader /usr/local/bin/
88+
continue-on-error: true
89+
- name: Install Enumlib
90+
if: runner.os == 'Linux'
91+
run: |
92+
git clone --recursive https://github.com/msg-byu/enumlib.git
93+
cd enumlib/symlib/src
94+
export F90=gfortran
95+
make
96+
cd ../../src
97+
make enum.x
98+
sudo mv enum.x /usr/local/bin/
99+
cd ..
100+
sudo cp aux_src/makeStr.py /usr/local/bin/
101+
continue-on-error: true
102+
- name: Install Packmol
103+
if: runner.os == 'Linux'
104+
run: |
105+
wget -O packmol.tar.gz https://github.com/m3g/packmol/archive/refs/tags/v20.14.2.tar.gz
106+
tar xvzf packmol.tar.gz
107+
export F90=gfortran
108+
cd packmol-20.14.2
109+
./configure
110+
make
111+
sudo mv packmol /usr/local/bin/
112+
cd ..
113+
rm -rf .coverage*
114+
continue-on-error: true
85115
- name: Install dependencies
86116
run: |
87117
python -m pip install --upgrade pip wheel
88118
python -m pip install numpy cython packaging
89119
python -m pip install -e '.[dev,optional]'
90120
- name: pytest split ${{ matrix.split }}
91-
# to update the test durations, run
92-
# pytest --store-durations --durations-path test_files/.pytest-split-durations
121+
# to update the test durations, do pip install pytest-split and run
122+
# pytest --store-durations --durations-path tests/files/.pytest-split-durations
93123
# and commit the results (requires pip install pytest-split)
94124
run: |
95-
pytest --cov=pymatgen --splits 10 --group ${{ matrix.split }} --durations-path test_files/.pytest-split-durations
125+
pytest --cov=pymatgen --splits 10 --group ${{ matrix.split }} --durations-path tests/files/.pytest-split-durations tests
96126
- name: Upload coverage
127+
# Only upload coverage for ubuntu py3.11 runs.
128+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
97129
uses: actions/upload-artifact@v3
98130
with:
99131
name: coverage-${{ matrix.split }}
100132
path: .coverage
101133

102134
coverage:
103-
needs: pytest
135+
needs: test
104136
runs-on: ubuntu-latest
105137
steps:
106138
- uses: actions/checkout@v3
107-
- name: Set up Python 3.10
108-
uses: actions/setup-python@v4
109-
with:
110-
python-version: '3.10'
111-
- name: Install Coverage
112-
run: python -m pip install coverage
113139
- name: Download coverage artifacts
114-
continue-on-error: true
115140
uses: actions/download-artifact@v3
116-
- name: Run coverage
117-
continue-on-error: true
141+
- name: Combine coverage
118142
run: |
119-
coverage combine coverage*/.coverage*
120-
coverage report
121-
coverage xml
122-
- name: Coveralls Python
123-
continue-on-error: true
124-
uses: AndreMiras/coveralls-python-action@v20201129
143+
pip install coverage[toml]
144+
find . -name "*.pyc" -delete
145+
for i in {1..10}; do mv coverage-$i/.coverage .coverage.$i; rm -rf coverage-$i; done
146+
coverage combine
147+
- name: Upload coverage reports to Codecov
148+
uses: codecov/codecov-action@v3
149+
with:
150+
token: ${{ secrets.CODECOV_TOKEN }}
151+
verbose: true
125152

126153
build_sdist:
127-
needs: pytest
128-
name: Build source distribution
154+
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.task == 'release')
155+
needs: test
129156
runs-on: ubuntu-latest
130157
steps:
131158
- uses: actions/checkout@v3
132159
- uses: actions/setup-python@v4
133160
name: Install Python
134161
with:
135-
python-version: '3.10'
136-
- run: python -m pip install build
162+
python-version: "3.10"
163+
- run: |
164+
python -m pip install build
165+
pip install -e .
137166
- name: Build sdist
138167
run: python -m build --sdist
139168
- uses: actions/upload-artifact@v3
140169
with:
141170
path: dist/*.tar.gz
142171

143172
build_wheels:
144-
needs: pytest
173+
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.task == 'release')
174+
needs: test
145175
strategy:
146176
matrix:
147177
os: [ubuntu-latest, macos-latest, windows-latest]
148-
python-version: ['38', '39', '310', '311']
178+
python-version: ["38", "39", "310", "311"]
149179
runs-on: ${{ matrix.os }}
150180
steps:
151181
- uses: actions/checkout@v3
152182
- name: Build wheels
153-
uses: pypa/cibuildwheel@v2.12.3
183+
uses: pypa/cibuildwheel@v2.14.1
154184
env:
155185
CIBW_BUILD: cp${{ matrix.python-version }}-*
156-
- uses: actions/upload-artifact@v3
186+
- name: Save artifact
187+
uses: actions/upload-artifact@v3
157188
with:
158189
path: ./wheelhouse/*.whl
159190

@@ -169,7 +200,8 @@ jobs:
169200
uses: actions/setup-python@v4
170201
with:
171202
python-version: 3.11
172-
- uses: actions/download-artifact@v3
203+
- name: Get build artifacts
204+
uses: actions/download-artifact@v3
173205
with:
174206
name: artifact
175207
path: dist

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ dependencies/spglib*/build
1414
pymatgen/pymatgen.cfg
1515
dist
1616
_build
17+
_site
1718
build
1819
.project
1920
.pydevproject

.pre-commit-config.yaml

+16-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
exclude: ^(docs|.*test_files|cmd_line|tasks.py)
1+
exclude: ^(docs|tests/files|cmd_line|tasks.py)
22

33
ci:
44
autoupdate_schedule: monthly
@@ -7,8 +7,8 @@ ci:
77
autoupdate_commit_msg: pre-commit autoupdate
88

99
repos:
10-
- repo: https://github.com/charliermarsh/ruff-pre-commit
11-
rev: v0.0.272
10+
- repo: https://github.com/astral-sh/ruff-pre-commit
11+
rev: v0.0.284
1212
hooks:
1313
- id: ruff
1414
args: [--fix]
@@ -17,22 +17,21 @@ repos:
1717
rev: v4.4.0
1818
hooks:
1919
- id: check-yaml
20-
exclude: pymatgen/analysis/vesta_cutoffs.yaml
2120
- id: end-of-file-fixer
2221
- id: trailing-whitespace
2322

2423
- repo: https://github.com/psf/black
25-
rev: 23.3.0
24+
rev: 23.7.0
2625
hooks:
2726
- id: black
2827

2928
- repo: https://github.com/pre-commit/mirrors-mypy
30-
rev: v1.3.0
29+
rev: v1.4.1
3130
hooks:
3231
- id: mypy
3332

3433
- repo: https://github.com/codespell-project/codespell
35-
rev: v2.2.4
34+
rev: v2.2.5
3635
hooks:
3736
- id: codespell
3837
stages: [commit, commit-msg]
@@ -45,3 +44,13 @@ repos:
4544
- id: cython-lint
4645
args: [--no-pycodestyle]
4746
- id: double-quote-cython-strings
47+
48+
- repo: https://github.com/igorshubovych/markdownlint-cli
49+
rev: v0.35.0
50+
hooks:
51+
- id: markdownlint
52+
# MD013: line too long
53+
# MD033: no inline HTML
54+
# MD041: first line in a file should be a top-level heading
55+
# MD025: single title
56+
args: [--disable, MD013, MD025, MD033, MD041, "--"]

0 commit comments

Comments
 (0)