Skip to content

Commit ac1407f

Browse files
authored
Merge branch 'main' into doc-for-mpcontrib-app
2 parents d69adbd + d75b4dc commit ac1407f

File tree

98 files changed

+2697
-1247
lines changed

Some content is hidden

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

98 files changed

+2697
-1247
lines changed

.github/pull_request_template.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!--
2+
3+
All previous Crystal Toolkit contributors/co-authors are encouraged to merge their own PRs once CI passes.
4+
Crystal Toolkit is a community project, and merging your own PRs is encouraged to help
5+
maintain the overall health of the code. If you do not have the required permissions to merge
6+
your PR, contact @mkhorton or another repository admin.
7+
8+
If you have concerns about your PR, or if it has expansive changes, please request review
9+
from @mkhorton or another active contributor.
10+
11+
If you are a new contributor, your PR will be fully reviewed before merging by a previous
12+
contributor/co-author.
13+
14+
-->
15+
16+
## Checklist
17+
18+
Work-in-progress pull requests are encouraged but please [mark your PR as draft](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request#converting-a-pull-request-to-a-draft).
19+
20+
Usually the following items should be checked before merging a PR:
21+
22+
- [ ] Doc strings have been added in the [Google docstring format](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings).
23+
- [ ] Type annotations are *highly* encouraged. Run [`mypy path/to/file.py`](https://github.com/python/mypy) to type check your code. Type checks are run in CI.
24+
- [ ] Tests for any new functionality as well as bug fixes, where appropriate.
25+
- [ ] Create a new [Issue](https://github.com/materialsproject/crystaltoolkit/issues) for any TODO items that will result from merging the PR.
26+
27+
We recommended installing [`pre-commit`](https://pre-commit.com) to run all our linters locally. That will increase your development speed since you don't have to wait for our CI to tell about errors, your code will be checked at commit time.
28+
29+
```sh
30+
pip install -U pre-commit
31+
pre-commit install
32+
```

.github/workflows/pull-request.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@ jobs:
2222
cache: 'pip'
2323
cache-dependency-path: '**/pyproject.toml'
2424
- name: Install webdriver
25-
run: sudo apt-get update && sudo apt-get install firefox-geckodriver chromium-chromedriver
25+
run: sudo apt-get update && sudo apt-get install chromium-chromedriver
2626
- name: Install dependencies
2727
run: |
28-
python${{ matrix.python-version }} -m pip install --user --upgrade pip pip-tools numpy
29-
python${{ matrix.python-version }} -m piptools sync --user requirements/ubuntu-latest_py${{ matrix.python-version }}_extras.txt
30-
python${{ matrix.python-version }} -m pip install --user --no-deps .
31-
- name: Test with pytest
28+
python -m pip install --user --upgrade pip pip-tools numpy
29+
python -m piptools sync --user requirements/ubuntu-latest_py${{ matrix.python-version }}_extras.txt
30+
python -m pip install --user --no-deps .
31+
- name: Test modules
32+
run: pytest tests
33+
- name: Test example apps
3234
env:
3335
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
3436
run: pytest --color=yes --webdriver Chrome --headless crystal_toolkit/apps/examples/tests/

.github/workflows/pytest-docs.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: pytest_and_docs
1+
name: Tests
22

33
on: [release, workflow_dispatch]
44

@@ -23,9 +23,9 @@ jobs:
2323
run: sudo apt-get update && sudo apt-get install firefox-geckodriver
2424
- name: Install dependencies
2525
run: |
26-
python${{ matrix.python-version }} -m pip install --user --upgrade pip pip-tools numpy
27-
python${{ matrix.python-version }} -m piptools sync --user requirements/ubuntu-latest_py${{ matrix.python-version }}_extras.txt
28-
python${{ matrix.python-version }} -m pip install --user --no-deps .
26+
python -m pip install --user --upgrade pip pip-tools numpy
27+
python -m piptools sync --user requirements/ubuntu-latest_py${{ matrix.python-version }}_extras.txt
28+
python -m pip install --user --no-deps .
2929
- name: Build new docs
3030
run: |
3131
cd docs_rst
@@ -44,7 +44,7 @@ jobs:
4444
git add -A
4545
git commit -m "Automated doc build"
4646
git push
47-
- name: Test with pytest
47+
- name: pytest
4848
env:
4949
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
5050
run: pytest --color=yes --webdriver Firefox --headless crystal_toolkit/apps/examples/tests/

.github/workflows/release.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: release
1+
name: Release
22

33
on: workflow_dispatch
44

@@ -37,23 +37,24 @@ jobs:
3737
echo "Next release: ${NEXT_RELEASE}"
3838
git config --local user.email "[email protected]"
3939
git config --local user.name "github-actions"
40-
python${{ matrix.python-version }} -m pip install --upgrade pip
41-
python${{ matrix.python-version }} -m pip install --user --upgrade pip build setuptools setuptools_scm wheel
42-
SETUPTOOLS_SCM_PRETEND_VERSION=${NEXT_RELEASE} python${{ matrix.python-version }} -m setuptools_scm
40+
python -m pip install --upgrade pip
41+
python -m pip install --user --upgrade pip build setuptools setuptools_scm wheel
42+
SETUPTOOLS_SCM_PRETEND_VERSION=${NEXT_RELEASE} python -m setuptools_scm
4343
git add crystal_toolkit/_version.py
4444
git commit -m "version bump: ${NEXT_RELEASE}"
4545
git push
4646
git tag ${NEXT_RELEASE}
4747
git push --tags
48+
echo "NEXT_RELEASE=${NEXT_RELEASE}" >> $GITHUB_ENV
4849
4950
- name: Install dependencies
5051
run: |
51-
python${{ matrix.python-version }} -m pip install --user `grep numpy== requirements/ubuntu-latest_py${{ matrix.python-version }}_extras.txt`
52-
python${{ matrix.python-version }} -m pip install --user -r requirements/ubuntu-latest_py${{ matrix.python-version }}_extras.txt
53-
python${{ matrix.python-version }} -m pip install --user --no-deps .[server]
52+
python -m pip install --user `grep numpy== requirements/ubuntu-latest_py${{ matrix.python-version }}_extras.txt`
53+
python -m pip install --user -r requirements/ubuntu-latest_py${{ matrix.python-version }}_extras.txt
54+
python -m pip install --user --no-deps .[server]
5455
5556
- name: Build package
56-
run: python${{ matrix.python-version }} -m build
57+
run: SETUPTOOLS_SCM_PRETEND_VERSION=${{env.NEXT_RELEASE}} python -m build
5758

5859
- name: Publish package
5960
uses: pypa/gh-action-pypi-publish@release/v1.5

.github/workflows/upgrade-dependencies.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ jobs:
2626
- name: Upgrade Python dependencies
2727
shell: bash
2828
run: |
29-
python${{ matrix.python-version }} -m pip install --upgrade pip pip-tools numpy
30-
python${{ matrix.python-version }} -m piptools compile -q --upgrade -o requirements/${{ matrix.os }}_py${{ matrix.python-version }}.txt pyproject.toml
31-
python${{ matrix.python-version }} -m piptools compile -q --upgrade --all-extras -o requirements/${{ matrix.os }}_py${{ matrix.python-version }}_extras.txt pyproject.toml
29+
python -m pip install --upgrade pip pip-tools numpy
30+
python -m piptools compile -q --upgrade -o requirements/${{ matrix.os }}_py${{ matrix.python-version }}.txt pyproject.toml
31+
python -m piptools compile -q --upgrade --all-extras -o requirements/${{ matrix.os }}_py${{ matrix.python-version }}_extras.txt pyproject.toml
3232
- name: Detect changes
3333
id: changes
3434
shell: bash

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ docs_rst/_build
1212
build/*
1313
*.egg-info
1414
dist/*
15+
.vscode

.pre-commit-config.yaml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ci:
22
autoupdate_schedule: quarterly
3-
skip: [mypy, flake8]
3+
skip: [mypy, flake8, docformatter]
44

55
default_stages: [commit]
66

@@ -12,34 +12,35 @@ exclude: ^(docs/.+|.*lock.*|jupyterlab-extension/.+|.*\.(svg|js|css))$
1212

1313
repos:
1414
- repo: https://github.com/PyCQA/isort
15-
rev: 5.10.1
15+
rev: 5.12.0
1616
hooks:
1717
- id: isort
1818

1919
- repo: https://github.com/psf/black
20-
rev: 22.8.0
20+
rev: 23.1.0
2121
hooks:
2222
- id: black-jupyter
2323

2424
- repo: https://github.com/PyCQA/flake8
25-
rev: 5.0.4
25+
rev: 6.0.0
2626
hooks:
2727
- id: flake8
2828
additional_dependencies: [flake8-bugbear]
2929

3030
- repo: https://github.com/asottile/pyupgrade
31-
rev: v2.38.2
31+
rev: v3.3.1
3232
hooks:
3333
- id: pyupgrade
3434
args: [--py38-plus]
35+
exclude: ^crystal_toolkit/settings.py$
3536

3637
- repo: https://github.com/pre-commit/mirrors-mypy
37-
rev: v0.981
38+
rev: v0.991
3839
hooks:
3940
- id: mypy
4041

4142
- repo: https://github.com/pre-commit/pre-commit-hooks
42-
rev: v4.3.0
43+
rev: v4.4.0
4344
hooks:
4445
- id: check-case-conflict
4546
- id: check-symlinks
@@ -49,18 +50,18 @@ repos:
4950
- id: trailing-whitespace
5051

5152
- repo: https://github.com/codespell-project/codespell
52-
rev: v2.2.1
53+
rev: v2.2.2
5354
hooks:
5455
- id: codespell
5556
stages: [commit, commit-msg]
5657

5758
- repo: https://github.com/PyCQA/autoflake
58-
rev: v1.6.1
59+
rev: v2.0.1
5960
hooks:
6061
- id: autoflake
6162

6263
- repo: https://github.com/nbQA-dev/nbQA
63-
rev: 1.5.2
64+
rev: 1.6.1
6465
hooks:
6566
- id: nbqa-pyupgrade
6667
args: [--py38-plus]
@@ -75,7 +76,7 @@ repos:
7576
args: [--drop-empty-cells, --keep-output]
7677

7778
- repo: https://github.com/PyCQA/docformatter
78-
rev: v1.5.0
79+
rev: v1.6.0.rc1
7980
hooks:
8081
- id: docformatter
8182
args: [--config, setup.cfg]

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,18 @@ Following a discussion with a potential contributor, "new contributor" issues ar
1010

1111
## Status
1212

13-
[![Pytest Status](https://github.com/materialsproject/crystaltoolkit/workflows/pytest_and_docs/badge.svg)](https://github.com/materialsproject/crystaltoolkit/actions?query=workflow%3Apytest_and_docs)
13+
[![Tests](https://github.com/materialsproject/crystaltoolkit/actions/workflows/pytest-docs.yml/badge.svg)](https://github.com/materialsproject/crystaltoolkit/actions/workflows/pytest-docs.yml)
1414
[![Visual Regression Test Status](https://percy.io/static/images/percy-badge.svg)](https://percy.io/Materials-Project/crystaltoolkit)
1515
[![Docker Build Status](https://img.shields.io/docker/cloud/build/materialsproject/crystaltoolkit)](https://hub.docker.com/repository/docker/materialsproject/crystaltoolkit/general)
16-
[![Release](https://github.com/materialsproject/crystaltoolkit/workflows/release/badge.svg)](https://github.com/materialsproject/crystaltoolkit/actions?query=workflow%3Arelease)
16+
[![Release](https://github.com/materialsproject/crystaltoolkit/actions/workflows/release.yml/badge.svg)](https://github.com/materialsproject/crystaltoolkit/actions/workflows/release.yml)
1717
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/materialsproject/crystaltoolkit/main.svg)](https://results.pre-commit.ci/latest/github/materialsproject/crystaltoolkit/main)
1818

19+
## Installation
20+
21+
```sh
22+
pip install crystal-toolkit
23+
```
24+
1925
## Documentation
2026

2127
[Documentation can be found at docs.crystaltoolkit.org](https://docs.crystaltoolkit.org)
@@ -60,6 +66,7 @@ The [Crystal Toolkit Development Team](https://github.com/materialsproject/cryst
6066
* [Stephen Weitzner](https://github.com/sweitzner) contributed POV-Ray integration (in progress)
6167
* [Richard Tran](https://github.com/CifLord) for contributing plotly-powered Wulff shapes to pymatgen, which Crystal Toolkit uses
6268
* [Guy Moore](https://github.com/guymoore13) for contributing magnetic moment visualization
69+
* [Steve Zeltmann](https://github.com/sezelt) for contributing electron diffraction
6370

6471
New contributors are welcome, please see our [Code of Conduct.](code-of-conduct.md) If you are a new contributor please modify this README in your Pull Request to add your name to the list.
6572

crystal_toolkit/_version.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
__version__ = "2022.11.30.dev8"
1+
from __future__ import annotations
2+
3+
__version__ = "2023.02.01"

crystal_toolkit/apps/constants.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from collections import defaultdict
24

35
from monty.serialization import loadfn
@@ -7,15 +9,15 @@
79

810
APP_METADATA = loadfn(SETTINGS.APP_METADATA)
911

10-
# List of URLs available in the website
12+
# list of URLs available in the website
1113
_BASE_URL = "https://materialsproject.org/"
1214
_apps_sitemap = []
1315

1416
# Construct a nested dictionary showing the relationship between apps
1517
# based on their urls, used for About page etc.
1618
APP_TREE = {}
1719
for app_class_name, metadata in APP_METADATA.items():
18-
if metadata["url"] and (not metadata["url"].startswith("http")):
20+
if metadata["url"] and not metadata["url"].startswith("http"):
1921
_apps_sitemap.append(_BASE_URL + metadata["url"])
2022
path = metadata["url"].replace("/", ".")
2123
if not get(APP_TREE, path):

0 commit comments

Comments
 (0)