Skip to content

Commit

Permalink
Merge branch 'master' into fix-incar-check-param
Browse files Browse the repository at this point in the history
Signed-off-by: Janosh Riebesell <[email protected]>
  • Loading branch information
janosh authored Aug 2, 2024
2 parents f0cbac6 + b35b99e commit 71f5245
Show file tree
Hide file tree
Showing 400 changed files with 801 additions and 355 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/issue-metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ permissions:

jobs:
build:
# prevent this action from running on forks
if: github.repository == 'materialsproject/pymatgen'
name: issue metrics
runs-on: ubuntu-latest
permissions:
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ci:

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.4
rev: v0.5.6
hooks:
- id: ruff
args: [ --fix, --unsafe-fixes ]
Expand All @@ -22,7 +22,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.0
rev: v1.11.1
hooks:
- id: mypy

Expand Down Expand Up @@ -65,6 +65,6 @@ repos:
args: [ --drop-empty-cells, --keep-output ]

- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.373
rev: v1.1.374
hooks:
- id: pyright
1 change: 1 addition & 0 deletions dev_scripts/chemenv/explicit_permutations.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import os

import numpy as np

from pymatgen.analysis.chemenv.coordination_environments.coordination_geometries import (
AllCoordinationGeometries,
ExplicitPermutationsAlgorithm,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import json

import numpy as np

from pymatgen.analysis.chemenv.coordination_environments.coordination_geometries import AllCoordinationGeometries
from pymatgen.analysis.chemenv.coordination_environments.coordination_geometry_finder import (
AbstractGeometry,
Expand Down
1 change: 1 addition & 0 deletions dev_scripts/chemenv/get_plane_permutations_optimized.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import numpy as np
import tabulate

from pymatgen.analysis.chemenv.coordination_environments.coordination_geometries import AllCoordinationGeometries
from pymatgen.analysis.chemenv.coordination_environments.coordination_geometry_finder import (
AbstractGeometry,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import matplotlib.pyplot as plt
import numpy as np

from pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies import (
AngleNbSetWeight,
CNBiasNbSetWeight,
Expand Down
1 change: 1 addition & 0 deletions dev_scripts/chemenv/test_algos.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from random import shuffle

import numpy as np

from pymatgen.analysis.chemenv.coordination_environments.coordination_geometries import AllCoordinationGeometries
from pymatgen.analysis.chemenv.coordination_environments.coordination_geometry_finder import (
AbstractGeometry,
Expand Down
1 change: 1 addition & 0 deletions dev_scripts/chemenv/view_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import annotations

import numpy as np

from pymatgen.analysis.chemenv.coordination_environments.coordination_geometries import (
SEPARATION_PLANE,
AllCoordinationGeometries,
Expand Down
1 change: 1 addition & 0 deletions dev_scripts/potcar_scrambler.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import numpy as np
from monty.os.path import zpath
from monty.serialization import zopen

from pymatgen.core import SETTINGS
from pymatgen.io.vasp import Potcar, PotcarSingle
from pymatgen.io.vasp.sets import _load_yaml_config
Expand Down
3 changes: 2 additions & 1 deletion dev_scripts/update_pt_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
import requests
from monty.dev import requires
from monty.serialization import dumpfn, loadfn
from pymatgen.core import Element, get_el_sp
from ruamel import yaml

from pymatgen.core import Element, get_el_sp

try:
from bs4 import BeautifulSoup
except ImportError:
Expand Down
1 change: 1 addition & 0 deletions dev_scripts/update_spacegroup_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import sys

from monty.serialization import dumpfn, loadfn

from pymatgen.symmetry.groups import PointGroup

__author__ = "Katharina Ueltzen @kaueltzen"
Expand Down
142 changes: 64 additions & 78 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ build-backend = "setuptools.build_meta"

[project]
name = "pymatgen"
authors = [
{ name = "Pymatgen Development Team", email = "[email protected]" },
]
authors = [{ name = "Pymatgen Development Team", email = "[email protected]" }]
maintainers = [
{ name = "Shyue Ping Ong", email = "[email protected]" },
{ name = "Matthew Horton", email = "[email protected]" },
{ name = "Janosh Riebesell", email = "[email protected]" },
{ name = "Matthew Horton", email = "[email protected]" },
{ name = "Shyue Ping Ong", email = "[email protected]" },
]
description = """
Python Materials Genomics is a robust materials analysis code that defines core object representations for structures
Expand All @@ -26,6 +24,7 @@ readme = "README.md"
requires-python = ">=3.9"
keywords = [
"ABINIT",
"VASP",
"analysis",
"crystal",
"diagrams",
Expand All @@ -38,25 +37,25 @@ keywords = [
"qchem",
"science",
"structure",
"VASP",
]
license = { text = "MIT" }
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Topic :: Scientific/Engineering :: Chemistry",
"Topic :: Scientific/Engineering :: Information Analysis",
"Topic :: Scientific/Engineering :: Physics",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
"joblib>=1",
"matplotlib>=3.8",
"monty>=2024.7.29",
"networkx>=2.2",
Expand All @@ -74,7 +73,8 @@ dependencies = [
"tabulate>=0.9",
"tqdm>=4.60",
"uncertainties>=3.1.4",
"joblib>=1",
'numpy>=1.25.0 ; platform_system != "Windows"',

This comment has been minimized.

Copy link
@DanielYang59

DanielYang59 Aug 3, 2024

Contributor

@janosh Looks like we accidentally have a duplicate here

pymatgen/pyproject.toml

Lines 57 to 78 in 976942c

dependencies = [
"joblib>=1",
"matplotlib>=3.8",
"monty>=2024.7.29",
"networkx>=2.2",
'numpy>=1.25.0,<2.0 ; platform_system == "Windows"',
'numpy>=1.25.0 ; platform_system != "Windows"',
"palettable>=3.3.3",
"pandas>=2",
"plotly>=4.5.0",
"pybtex>=0.24.0",
"requests>=2.32",
"ruamel.yaml>=0.17.0",
"scipy>=1.13.0",
"spglib>=2.5.0",
"sympy>=1.2",
"tabulate>=0.9",
"tqdm>=4.60",
"uncertainties>=3.1.4",
'numpy>=1.25.0 ; platform_system != "Windows"',
'numpy>=1.25.0,<2.0 ; platform_system == "Windows"',
]

'numpy>=1.25.0,<2.0 ; platform_system == "Windows"',
]
version = "2024.7.18"

Expand All @@ -91,17 +91,10 @@ ase = ["ase>=3.23.0"]
tblite = ["tblite[ase]>=0.3.0; python_version<'3.12'"]
vis = ["vtk>=6.0.0"]
abinit = ["netcdf4>=1.6.5"]
mlp = ["matgl>=1.1.1", "chgnet>=0.3.8"]
mlp = ["chgnet>=0.3.8", "matgl>=1.1.1"]
electronic_structure = ["fdint>=2.0.2"]
ci = [
"pytest>=8",
"pytest-cov>=4",
"pytest-split>=0.8",
]
docs = [
"sphinx",
"sphinx_rtd_theme",
]
ci = ["pytest-cov>=4", "pytest-split>=0.8", "pytest>=8"]
docs = ["sphinx", "sphinx_rtd_theme"]
optional = [
"ase>=3.23.0",
# TODO restore BoltzTraP2 when install fixed, hopefully following merge of
Expand Down Expand Up @@ -139,7 +132,7 @@ where = ["src"]
include = ["pymatgen", "pymatgen.*"]

[tool.setuptools.package-data]
"pymatgen.analysis" = ["*.yaml", "*.json", "*.csv"]
"pymatgen.analysis" = ["*.csv", "*.json", "*.yaml"]
"pymatgen.analysis.chemenv" = [
"coordination_environments/coordination_geometries_files/*.json",
"coordination_environments/coordination_geometries_files/*.txt",
Expand All @@ -152,27 +145,19 @@ include = ["pymatgen", "pymatgen.*"]
"pymatgen.entries" = ["*.json.gz", "*.yaml", "data/*.json"]
"pymatgen.core" = ["*.json"]
"pymatgen" = ["py.typed"]
"pymatgen.io.vasp" = ["*.yaml", "*.json", "*.json.gz", "*.json.bz2"]
"pymatgen.io.vasp" = ["*.json", "*.json.bz2", "*.json.gz", "*.yaml"]
"pymatgen.io.feff" = ["*.yaml"]
"pymatgen.io.cp2k" = ["*.yaml"]
"pymatgen.io.lobster" = ["lobster_basis/*.yaml"]
"pymatgen.command_line" = ["*"]
"pymatgen.util" = ["structures/*.json", "*.json"]
"pymatgen.util" = ["*.json", "structures/*.json"]
"pymatgen.vis" = ["*.yaml"]
"pymatgen.io.lammps" = ["CoeffsDataType.yaml", "templates/*.template"]
"pymatgen.symmetry" = ["*.yaml", "*.json", "*.sqlite"]
"pymatgen.symmetry" = ["*.json", "*.sqlite", "*.yaml"]

[tool.pdm.dev-dependencies]
lint = [
"mypy>=1.10.0",
"ruff>=0.4.9",
"pre-commit>=3.7.1",
]
test = [
"pytest>=8.2.2",
"pytest-cov>=5.0.0",
"pytest-split>=0.9.0",
]
lint = ["mypy>=1.10.0", "pre-commit>=3.7.1", "ruff>=0.4.9"]
test = ["pytest-cov>=5.0.0", "pytest-split>=0.9.0", "pytest>=8.2.2"]

[tool.versioningit.vcs]
method = "git"
Expand All @@ -193,56 +178,57 @@ line-length = 120
[tool.ruff.lint]
select = ["ALL"]
ignore = [
# Rule families
"ANN", # flake8-annotations (not ready, require types for ALL args)
"ARG", # Check for unused function arguments
"BLE", # General catch of Exception
"C90", # Check for functions with a high McCabe complexity
"COM", # flake8-commas (conflict with line wrapper)
"CPY", # Missing copyright notice at top of file (need preview mode)
"EM", # Format nice error messages
"ERA", # Check for commented-out code
"FIX", # Check for FIXME, TODO and other developer notes
"FURB", # refurb (need preview mode, too many preview errors)
"G", # validate logging format strings
"INP", # Ban PEP-420 implicit namespace packages
"N", # pep8-naming (many var/arg names are intended)
"NPY", # NumPy-specific rules (TODO: enable this)
"PTH", # Prefer pathlib over os.path
"S", # flake8-bandit (TODO: enable this)
"SLF", # Access "private" class members
"T20", # Check for print/pprint
"TD", # TODO tags related
# Rule families
"ANN", # flake8-annotations (not ready, require types for ALL args)
"ARG", # Check for unused function arguments
"BLE", # General catch of Exception
"C90", # Check for functions with a high McCabe complexity
"COM", # flake8-commas (conflict with line wrapper)
"CPY", # Missing copyright notice at top of file (need preview mode)
"EM", # Format nice error messages
"ERA", # Check for commented-out code
"FIX", # Check for FIXME, TODO and other developer notes
"FURB", # refurb (need preview mode, too many preview errors)
"G", # validate logging format strings
"INP", # Ban PEP-420 implicit namespace packages
"N", # pep8-naming (many var/arg names are intended)
"NPY", # NumPy-specific rules (TODO: enable this)
"PTH", # Prefer pathlib over os.path
"S", # flake8-bandit (TODO: enable this)
"SLF", # Access "private" class members
"T20", # Check for print/pprint
"TD", # TODO tags related

# Single rules
"B023", # Function definition does not bind loop variable
"B028", # No explicit stacklevel keyword argument found
"B904", # Within an except clause, raise exceptions with ...
"C408", # unnecessary-collection-call
"D105", # Missing docstring in magic method
"D205", # 1 blank line required between summary line and description
"D212", # Multi-line docstring summary should start at the first line
"DTZ003", # TODO: fix this (issue #3791)
"FBT001", # Boolean-typed positional argument in function definition
"FBT002", # Boolean default positional argument in function
"PD901", # pandas-df-variable-name
"PERF203", # try-except-in-loop
"PERF401", # manual-list-comprehension
"PLR0911", # too many return statements
"PLR0912", # too many branches
"PLR0913", # too many arguments
"PLR0915", # too many statements
"PLR2004", # magic values in comparison
"PLW2901", # Outer for loop variable overwritten by inner assignment target
"PT013", # pytest-incorrect-pytest-import
"SIM105", # Use contextlib.suppress() instead of try-except-pass
"TRY003", # Avoid specifying long messages outside the exception class
"TRY300", # Checks for return statements in try blocks
"TRY301", # Checks for raise statements within try blocks
# Single rules
"B023", # Function definition does not bind loop variable
"B028", # No explicit stacklevel keyword argument found
"B904", # Within an except clause, raise exceptions with ...
"C408", # unnecessary-collection-call
"D105", # Missing docstring in magic method
"D205", # 1 blank line required between summary line and description
"D212", # Multi-line docstring summary should start at the first line
"DTZ003", # TODO: fix this (issue #3791)
"FBT001", # Boolean-typed positional argument in function definition
"FBT002", # Boolean default positional argument in function
"PD901", # pandas-df-variable-name
"PERF203", # try-except-in-loop
"PERF401", # manual-list-comprehension
"PLR0911", # too many return statements
"PLR0912", # too many branches
"PLR0913", # too many arguments
"PLR0915", # too many statements
"PLR2004", # magic values in comparison
"PLW2901", # Outer for loop variable overwritten by inner assignment target
"PT013", # pytest-incorrect-pytest-import
"SIM105", # Use contextlib.suppress() instead of try-except-pass
"TRY003", # Avoid specifying long messages outside the exception class
"TRY300", # Checks for return statements in try blocks
"TRY301", # Checks for raise statements within try blocks
]
pydocstyle.convention = "google"
isort.required-imports = ["from __future__ import annotations"]
isort.split-on-trailing-comma = false
isort.known-first-party = ["pymatgen"]

[tool.ruff.format]
docstring-code-format = true
Expand Down
4 changes: 3 additions & 1 deletion src/pymatgen/alchemy/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@
from typing import TYPE_CHECKING

from monty.json import MSONable

from pymatgen.analysis.structure_matcher import ElementComparator, StructureMatcher
from pymatgen.core import get_el_sp
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer

if TYPE_CHECKING:
from pymatgen.core import Structure
from typing_extensions import Self

from pymatgen.core import Structure


class AbstractStructureFilter(MSONable, abc.ABC):
"""Structures that return True when passed to the test() method are retained during
Expand Down
4 changes: 3 additions & 1 deletion src/pymatgen/alchemy/materials.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from warnings import warn

from monty.json import MSONable, jsanitize

from pymatgen.core.structure import Structure
from pymatgen.io.cif import CifParser
from pymatgen.io.vasp.inputs import Poscar
Expand All @@ -23,9 +24,10 @@
from collections.abc import Sequence
from typing import Any

from pymatgen.alchemy.filters import AbstractStructureFilter
from typing_extensions import Self

from pymatgen.alchemy.filters import AbstractStructureFilter


class TransformedStructure(MSONable):
"""Container for new structures that include history of transformations.
Expand Down
3 changes: 2 additions & 1 deletion src/pymatgen/alchemy/transmuters.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
from collections.abc import Sequence
from typing import Callable

from pymatgen.alchemy.filters import AbstractStructureFilter
from typing_extensions import Self

from pymatgen.alchemy.filters import AbstractStructureFilter

__author__ = "Shyue Ping Ong, Will Richards"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
Expand Down
Loading

0 comments on commit 71f5245

Please sign in to comment.