Skip to content

Commit 42ec13e

Browse files
upstream/master
2 parents 19f1b2c + c56a25a commit 42ec13e

File tree

2,639 files changed

+158153
-279552
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,639 files changed

+158153
-279552
lines changed

.gitattributes

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +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
5-
docs_rst/**/* linguist-documentation
65
dev_scripts/**/* linguist-vendored

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 3 additions & 1 deletion
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/workflows/test.yml

Lines changed: 70 additions & 33 deletions
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:
@@ -20,10 +22,14 @@ on:
2022
permissions:
2123
contents: read
2224

25+
concurrency:
26+
group: ${{ github.workflow }}-${{ github.ref }}
27+
cancel-in-progress: true
28+
2329
jobs:
24-
pytest:
30+
test:
2531
# prevent this action from running on forks
26-
if: ${{ !github.event.pull_request.head.repo.fork }}
32+
if: github.repository == 'materialsproject/pymatgen'
2733
strategy:
2834
fail-fast: false
2935
matrix:
@@ -60,8 +66,9 @@ jobs:
6066
env:
6167
PMG_MAPI_KEY: ${{ secrets.PMG_MAPI_KEY }}
6268
MPLBACKEND: Agg # https://github.com/orgs/community/discussions/26434
63-
PMG_TEST_FILES_DIR: ${{ github.workspace }}/test_files
69+
PMG_TEST_FILES_DIR: ${{ github.workspace }}/tests/files
6470
GULP_LIB: ${{ github.workspace }}/cmd_line/gulp/Libraries
71+
PMG_VASP_PSP_DIR: ${{ github.workspace }}/tests/files
6572

6673
steps:
6774
- uses: actions/checkout@v3
@@ -71,73 +78,103 @@ jobs:
7178
python-version: ${{ matrix.python-version }}
7279
cache: pip
7380
cache-dependency-path: setup.py
74-
- name: Add CLIs to GITHUB_PATH
75-
if: runner.os != 'Windows'
81+
- name: Copy CLIs to bin
82+
if: runner.os == 'Linux'
7683
# This is the way to update env variables in a way that persist for the entire job.
7784
run: |
78-
for pkg in cmd_line/*;
79-
do echo "$(pwd)/cmd_line/$pkg/Linux_64bit" >> "$GITHUB_PATH";
80-
done
85+
sudo cp cmd_line/gulp/Linux_64bit/* /usr/local/bin/
86+
- name: Install Bader
87+
if: runner.os == 'Linux'
88+
run: |
89+
wget http://theory.cm.utexas.edu/henkelman/code/bader/download/bader_lnx_64.tar.gz
90+
tar xvzf bader_lnx_64.tar.gz
91+
sudo mv bader /usr/local/bin/
92+
continue-on-error: true
93+
- name: Install Enumlib
94+
if: runner.os == 'Linux'
95+
run: |
96+
git clone --recursive https://github.com/msg-byu/enumlib.git
97+
cd enumlib/symlib/src
98+
export F90=gfortran
99+
make
100+
cd ../../src
101+
make enum.x
102+
sudo mv enum.x /usr/local/bin/
103+
cd ..
104+
sudo cp aux_src/makeStr.py /usr/local/bin/
105+
continue-on-error: true
106+
- name: Install Packmol
107+
if: runner.os == 'Linux'
108+
run: |
109+
wget -O packmol.tar.gz https://github.com/m3g/packmol/archive/refs/tags/v20.14.2.tar.gz
110+
tar xvzf packmol.tar.gz
111+
export F90=gfortran
112+
cd packmol-20.14.2
113+
./configure
114+
make
115+
sudo mv packmol /usr/local/bin/
116+
cd ..
117+
rm -rf .coverage*
118+
continue-on-error: true
81119
- name: Install dependencies
82120
run: |
83121
python -m pip install --upgrade pip wheel
84122
python -m pip install numpy cython packaging
85123
python -m pip install -e '.[dev,optional]'
86124
- name: pytest split ${{ matrix.split }}
87-
# to update the test durations, run
88-
# pytest --store-durations --durations-path test_files/.pytest-split-durations
89-
# and commit the results (requires pip install pytest-split)
90125
run: |
91-
pytest --cov=pymatgen --splits 10 --group ${{ matrix.split }} --durations-path test_files/.pytest-split-durations
126+
pytest --cov=pymatgen --splits 10 --group ${{ matrix.split }} --durations-path tests/files/.pytest-split-durations tests
92127
- name: Upload coverage
128+
# Only upload coverage for ubuntu py3.11 runs. Continue on error as coverage is not critical.
129+
if: github.event_name != 'pull_request' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
93130
uses: actions/upload-artifact@v3
94131
with:
95132
name: coverage-${{ matrix.split }}
96133
path: .coverage
97134

98135
coverage:
99-
needs: pytest
136+
# Only upload coverage for ubuntu py3.11 runs. Continue on error as coverage is not critical.
137+
if: github.event_name != 'pull_request'
138+
needs: test
100139
runs-on: ubuntu-latest
101140
steps:
102141
- uses: actions/checkout@v3
103-
- name: Set up Python 3.10
104-
uses: actions/setup-python@v4
105-
with:
106-
python-version: "3.10"
107-
- name: Install Coverage
108-
run: python -m pip install coverage
109142
- name: Download coverage artifacts
110-
continue-on-error: true
111143
uses: actions/download-artifact@v3
112-
- name: Run coverage
113-
continue-on-error: true
144+
- name: Combine coverage
114145
run: |
115-
coverage combine coverage*/.coverage*
116-
coverage report
117-
coverage xml
118-
- name: Coveralls Python
119-
continue-on-error: true
120-
uses: AndreMiras/coveralls-python-action@v20201129
146+
pip install coverage[toml]
147+
find . -name "*.pyc" -delete
148+
for i in {1..10}; do mv coverage-$i/.coverage .coverage.$i; rm -rf coverage-$i; done
149+
coverage combine
150+
- name: Upload coverage reports to Codecov
151+
uses: codecov/codecov-action@v3
152+
with:
153+
token: ${{ secrets.CODECOV_TOKEN }}
154+
verbose: true
121155

122156
build_sdist:
123-
needs: pytest
124-
name: Build source distribution
157+
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.task == 'release')
158+
needs: test
125159
runs-on: ubuntu-latest
126160
steps:
127161
- uses: actions/checkout@v3
128162
- uses: actions/setup-python@v4
129163
name: Install Python
130164
with:
131165
python-version: "3.10"
132-
- run: python -m pip install build
166+
- run: |
167+
python -m pip install build
168+
pip install -e .
133169
- name: Build sdist
134170
run: python -m build --sdist
135171
- uses: actions/upload-artifact@v3
136172
with:
137173
path: dist/*.tar.gz
138174

139175
build_wheels:
140-
needs: pytest
176+
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.task == 'release')
177+
needs: test
141178
strategy:
142179
matrix:
143180
os: [ubuntu-latest, macos-latest, windows-latest]
@@ -146,7 +183,7 @@ jobs:
146183
steps:
147184
- uses: actions/checkout@v3
148185
- name: Build wheels
149-
uses: pypa/cibuildwheel@v2.12.3
186+
uses: pypa/cibuildwheel@v2.14.1
150187
env:
151188
CIBW_BUILD: cp${{ matrix.python-version }}-*
152189
- name: Save artifact

.gitignore

Lines changed: 1 addition & 0 deletions
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

Lines changed: 20 additions & 6 deletions
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
@@ -8,7 +8,7 @@ ci:
88

99
repos:
1010
- repo: https://github.com/astral-sh/ruff-pre-commit
11-
rev: v0.0.275
11+
rev: v0.0.285
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.4.0
29+
rev: v1.5.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,18 @@ repos:
4544
- id: cython-lint
4645
args: [--no-pycodestyle]
4746
- id: double-quote-cython-strings
47+
48+
- repo: https://github.com/adamchainz/blacken-docs
49+
rev: 1.16.0
50+
hooks:
51+
- id: blacken-docs
52+
53+
- repo: https://github.com/igorshubovych/markdownlint-cli
54+
rev: v0.35.0
55+
hooks:
56+
- id: markdownlint
57+
# MD013: line too long
58+
# MD033: no inline HTML
59+
# MD041: first line in a file should be a top-level heading
60+
# MD025: single title
61+
args: [--disable, MD013, MD025, MD033, MD041, "--"]

ADMIN.md

Lines changed: 10 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ The general procedure for releasing `pymatgen` comprises the following
99
steps:
1010

1111
1. Make sure all CI checks are green. We don't want to release known bugs.
12-
2. Update and edit changelog.
13-
3. Release PyPI versions + doc.
14-
4. Release `conda` versions.
15-
5. Release Dash documentation.
12+
1. Update changelog.
13+
1. Run `invoke make-doc` to update the HTML docs.
14+
1. Tag the latest commit with `git tag v<yyyy.mm.dd>`.
15+
1. Make a GitHub release with auto-generated release notes.
16+
1. Make sure the release action runs that publishes the new version to PyPI and conda-forge runs to completion.
1617

1718
## Initial setup
1819

@@ -23,72 +24,29 @@ You will also need `sphinx` and `doc2dash`.
2324
pip install --upgrade invoke sphinx doc2dash
2425
```
2526

26-
Add your PyPI username and password and GITHUB_RELEASE_TOKEN into your
27-
environment:
28-
29-
```sh
30-
export TWINE_USERNAME=PYPIUSERNAME
31-
export TWINE_PASSWORD=PYPIPASSWORD
32-
export GITHUB_RELEASES_TOKEN=TOKEN_YOU_GET_FROM_GITHUB
33-
```
34-
35-
You may want to add these to your .bash_profile to avoid having to type
36-
these each time.
37-
38-
### Machine-specific issues
39-
40-
The above instructions are general, but some known issues are machine-specific:
41-
42-
- Installing lxml via pip required <span
43-
class="title-ref">STATIC_DEPS=true pip install lxml</span> on macOS
44-
10.13.
45-
- It can be useful to <span class="title-ref">pip install --upgrade pip
46-
twine setuptools</span> (this may be necessary if there are
47-
authentication errors when connecting to PyPI).
48-
- You may have to <span class="title-ref">brew install hdf5
49-
netcdf</span> or similar to be able to pip install the optional
50-
requirement <span class="title-ref">netCDF4</span>.
51-
5227
## Doing the release
5328

54-
Ensure appropriate environment variables are set including <span
55-
class="title-ref">DISCOURSE_API_USERNAME</span>, <span
56-
class="title-ref">DISCOURSE_API_KEY</span> and <span
57-
class="title-ref">GITHUB_RELEASES_TOKEN</span>.
58-
59-
First update the change log. The autogenerated change log is simply a
60-
list of commit messages since the last version. Make sure to edit the
61-
log for brevity and to attribute significant features to appropriate
62-
developers:
29+
First update the change log. The autogenerated change log is simply a list of commit messages since the last version. Make sure to edit the log for brevity and to attribute significant features to appropriate developers:
6330

6431
```sh
6532
invoke update-changelog
6633
```
6734

68-
Then, do the release with the following sequence of commands (you can
69-
put them in a bash script in your PATH somewhere):
35+
Then, do the release with the following sequence of commands (you can put them in a bash script in your PATH somewhere):
7036

7137
```sh
7238
invoke release --notest --nodoc
7339
invoke update-doc
7440
python setup.py develop
7541
```
7642

77-
Double check that the releases are properly done on Pypi. If you are
78-
releasing on a Mac, you should see a pymatgen.version.tar.gz and two
79-
wheels (Py37 and P). There will be a py37 wheel for Windows that is
80-
generated by Appveyor.
43+
Double check that the releases are properly done on Pypi. If you are releasing on a Mac, you should see a pymatgen.version.tar.gz and two wheels (Py37 and P). There will be a py37 wheel for Windows that is generated by Appveyor.
8144

8245
## Materials.sh
8346

84-
Fork and clone the
85-
[materials.sh](https://github.com/materialsvirtuallab/materials.sh).
86-
This repo contains the `conda` skeletons to build the `conda` versions for
87-
various matsci codes on the Anaconda [matsci
88-
channel](https://anaconda.org/matsci).
47+
Fork and clone the [materials.sh](https://github.com/materialsvirtuallab/materials.sh). This repo contains the `conda` skeletons to build the `conda` versions for various matsci codes on the Anaconda [matsci channel](https://anaconda.org/matsci).
8948

90-
The first time this is run, you may need to <span class="title-ref">pip
91-
install beautifulsoup4</span>.
49+
The first time this is run, you may need to `pip install beautifulsoup4`.
9250

9351
If you doing this for the first time, make sure conda-build and
9452
anaconda-client are installed:
@@ -114,16 +72,3 @@ versions.
11472

11573
Check that the [matsci channel](https://anaconda.org/matsci) versions
11674
are properly updated.
117-
118-
## Dash docs
119-
120-
Fork and clone the [Dash User Contributions
121-
repo](https://github.com/Kapeli/Dash-User-Contributions).
122-
123-
Generate the offline Dash doc using:
124-
125-
```sh
126-
invoke contribute-dash
127-
```
128-
129-
Create a pull request and submit.

0 commit comments

Comments
 (0)