1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320
|
[build-system]
requires = [
"Cython>=0.29.23",
# Building against NPY2 will support both NPY1 and NPY2
# https://numpy.org/devdocs/dev/depending_on_numpy.html#build-time-dependency
"numpy>=2.1.0",
"setuptools>=65.0.0",
]
build-backend = "setuptools.build_meta"
[project]
name = "pymatgen"
authors = [{ name = "Pymatgen Development Team", email = "ongsp@ucsd.edu" }]
maintainers = [
{ name = "Matthew Horton", email = "m.k.horton@gmail.com" },
{ name = "Shyue Ping Ong", email = "ongsp@ucsd.edu" },
]
description = """
Python Materials Genomics is a robust materials analysis code that defines core object representations for structures
and molecules with support for many electronic structure codes. It is currently the core analysis code powering the
Materials Project (https://materialsproject.org)."""
readme = "README.md"
requires-python = ">=3.10,<3.13"
keywords = [
"ABINIT",
"VASP",
"analysis",
"crystal",
"diagrams",
"electronic",
"gaussian",
"materials",
"nwchem",
"phase",
"project",
"qchem",
"science",
"structure",
]
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",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"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>=2025.1.9",
"networkx>=2.7", # PR4116
"palettable>=3.3.3",
"pandas>=2",
"plotly>=5.0.0",
"pybtex>=0.24.0",
"requests>=2.32",
"ruamel.yaml>=0.17.0",
"scipy>=1.13.0",
# scipy<1.14.1 is incompatible with NumPy 2.0 on Windows
# https://github.com/scipy/scipy/issues/21052
"scipy>=1.14.1; platform_system == 'Windows'",
"spglib>=2.5",
"sympy>=1.3", # PR #4116
"tabulate>=0.9",
"tqdm>=4.60",
"uncertainties>=3.1.4",
# NumPy documentation suggests pinning the current major version as the C API is used
# https://numpy.org/devdocs/dev/depending_on_numpy.html#runtime-dependency-version-ranges
"numpy>=1.25.0,<3",
]
version = "2025.2.18"
[project.urls]
Homepage = "https://pymatgen.org"
Documentation = "https://pymatgen.org"
Repository = "https://github.com/materialsproject/pymatgen"
Issues = "https://github.com/materialsproject/pymatgen/issues"
Pypi = "https://pypi.org/project/pymatgen"
[project.optional-dependencies]
abinit = ["netcdf4>=1.7.2"]
ase = ["ase>=3.23.0"]
ci = ["pytest-cov>=4", "pytest-split>=0.8", "pytest>=8", "pymatgen[symmetry]"]
docs = ["invoke", "sphinx", "sphinx_markdown_builder", "sphinx_rtd_theme"]
electronic_structure = ["fdint>=2.0.2"]
mlp = ["chgnet>=0.3.8", "matgl>=1.1.3"]
numba = ["numba>=0.55"]
numpy-v1 = ["numpy>=1.25.0,<2"] # Test NP1 on Windows (quite buggy ATM)
optional = [
"pymatgen[abinit,ase,mlp,tblite]",
"beautifulsoup4",
# BoltzTraP2 build fails on Windows GitHub runners
"BoltzTraP2>=24.9.4 ; platform_system != 'Windows'",
"chemview>=0.6",
"f90nml>=1.1.2",
"galore>=0.6.1",
"h5py>=3.11.0",
"hiphive>=1.3.1",
"jarvis-tools>=2020.7.14",
"matplotlib>=3.8",
"phonopy>=2.33.3",
"seekpath>=2.0.1",
]
# moyopy[interface] includes ase
symmetry = ["moyopy[interface]>=0.3", "spglib>=2.5"]
# tblite only support Python 3.12+ through conda-forge
# https://github.com/tblite/tblite/issues/175
tblite = [ "tblite[ase]>=0.3.0; platform_system=='Linux' and python_version<'3.12'"]
vis = ["vtk>=6.0.0"]
[project.scripts]
pmg = "pymatgen.cli.pmg:main"
feff_plot_cross_section = "pymatgen.cli.feff_plot_cross_section:main"
feff_plot_dos = "pymatgen.cli.feff_plot_dos:main"
get_environment = "pymatgen.cli.get_environment:main"
[tool.setuptools]
include-package-data = false
[tool.setuptools.packages.find]
where = ["src"]
include = ["pymatgen", "pymatgen.*"]
[tool.setuptools.package-data]
"pymatgen.analysis" = ["*.csv", "*.json", "*.yaml"]
"pymatgen.analysis.chemenv" = [
"coordination_environments/coordination_geometries_files/*.json",
"coordination_environments/coordination_geometries_files/*.txt",
"coordination_environments/strategy_files/ImprovedConfidenceCutoffDefaultParameters.json",
]
"pymatgen.analysis.structure_prediction" = ["*.yaml", "data/*.json"]
"pymatgen.analysis.diffraction" = ["*.json"]
"pymatgen.analysis.magnetism" = ["default_magmoms.yaml"]
"pymatgen.analysis.solar" = ["am1.5G.dat"]
"pymatgen.entries" = ["*.json.gz", "*.yaml", "data/*.json"]
"pymatgen.core" = ["*.json"]
"pymatgen" = ["py.typed"]
"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" = ["*.json", "structures/*.json"]
"pymatgen.vis" = ["*.yaml"]
"pymatgen.io.lammps" = ["CoeffsDataType.yaml", "templates/*.template"]
"pymatgen.symmetry" = ["*.json", "*.sqlite", "*.yaml"]
[tool.pdm.dev-dependencies]
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.cibuildwheel.linux]
archs = ["auto64"]
skip = ["*musllinux*"]
before-all = "ln -s /usr/lib64/libgfortran.so.5 /usr/lib64/libgfortran.so.3"
[tool.cibuildwheel.macos]
repair-wheel-command = "delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel} --ignore-missing-dependencies"
[tool.ruff]
target-version = "py310"
line-length = 120
output-format = "concise"
[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
"G", # Validate logging format strings
"INP", # Ban PEP-420 implicit namespace packages
"N", # PEP8-naming (many var/arg names are intended)
"PTH", # Prefer pathlib over os.path
"SLF", # Access "private" class members
"T20", # Check for print/pprint
"TD", # TODO tags related
# Single rules
"B023", # Function definition does not bind loop variable
"B904", # Within an except clause, raise exceptions with ...
"C408", # unnecessary-collection-call
"D105", # Missing docstring in magic method
"D205", # One blank line required between summary line and description
"D212", # Multi-line docstring summary should start at the first line
"FBT001", # Boolean-typed positional argument in function definition
"FBT002", # Boolean default positional argument in function
"PD011", # (A lot of false positive on non-Pandas objects)
"PERF203", # Use of try-except in for/while loop
"PERF401", # Replace "for" loops with list comprehension
"PLR0911", # Too many return statements
"PLR0912", # Too many branches
"PLR0913", # Too many arguments
"PLR0915", # Too many statements
"PLR1702", # Too many nested blocks
"PLR2004", # Magic-value-comparison TODO: fix these
"PLW2901", # Outer for loop variable overwritten by inner assignment target
"PT013", # Incorrect import of pytest
"S110", # Log for try-except-pass
"S112", # Log for try-except-continue
"S311", # Use random module for cryptographic purposes
"S314", # Replace xml with defusedxml to avoid XML attacks
"S603", # Check source for use of "subprocess" call
"S607", # Start process with relative path
"SIM105", # Use contextlib.suppress() instead of try-except-pass
"TRY003", # Avoid specifying long messages outside the exception class
"TRY300", # Check for return statements in try blocks
"TRY301", # Check 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
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"] # unused-import
"tests/**" = [
"ANN201", # missing-return-type-undocumented-public-function
"D", # pydocstyle
"PLR0124", # comparison-with-itself
"PLR2004", # magic-value-comparison
"PLR6301", # no-self-use
"S101", # Use of "assert"
]
"src/pymatgen/analysis/*" = ["D"]
"src/pymatgen/io/*" = ["D"]
"dev_scripts/*" = ["D"]
"src/pymatgen/util/string.py" = ["A005"]
"src/pymatgen/util/typing.py" = ["A005"]
"src/pymatgen/util/io.py" = ["A005"]
[tool.pytest.ini_options]
addopts = "--durations=30 --quiet -r xXs --color=yes --import-mode=importlib"
filterwarnings = [
# NOTE: the LAST matching option would be used
"ignore::UserWarning", # Ignore UserWarning
"error:We strongly encourage explicit `encoding`:EncodingWarning", # Mark `zopen` EncodingWarning as error
# TODO: remove the following filter once `monty.io` dropped custom EncodingWarning
"error:We strongly encourage explicit `encoding`:monty.io.EncodingWarning",
# TODO: pybtex (perhaps some others) emits the following warnings
'ignore:pkg_resources is deprecated as an API:DeprecationWarning',
'ignore:distutils Version classes are deprecated:DeprecationWarning',
'ignore:Deprecated call to `pkg_resources.declare_namespace:DeprecationWarning',
]
[tool.coverage.run]
parallel = true
omit = [
"pymatgen/cli/feff_*.py",
"pymatgen/cli/pmg_config.py",
"pymatgen/cli/pmg_plot.py",
"pymatgen/cli/pmg_potcar.py",
"pymatgen/dao.py",
]
[tool.coverage.report]
exclude_also = [
"@deprecated",
"def __repr__",
"except ImportError:",
"if TYPE_CHECKING:",
"if self.debug:",
"if settings.DEBUG",
"pragma: no cover",
"raise NotImplementedError",
"show_plot",
]
[tool.mypy]
ignore_missing_imports = true
namespace_packages = true
explicit_package_bases = true
no_implicit_optional = false
disable_error_code = ["annotation-unchecked", "override"]
[[tool.mypy.overrides]]
module = ["requests.*", "tabulate.*"]
ignore_missing_imports = true
[tool.codespell]
# TODO: un-ignore "ist/nd/ot/ontop/CoO" once support file-level ignore with pattern
ignore-words-list = """Nd, Te, titel, Mater,
Hart, Lew, Rute, atomate,
ist, nd, ot, ontop, CoO
"""
# TODO: un-skip lammps/test_inputs.py once support block ignore with pattern
skip = """*.json,
src/pymatgen/analysis/chemenv/coordination_environments/coordination_geometries_files/allcg.txt,
src/pymatgen/entries/MPCompatibility.yaml,
tests/io/lammps/test_inputs.py,
"""
check-filenames = true
[tool.pyright]
typeCheckingMode = "off"
reportPossiblyUnboundVariable = true
reportUnboundVariable = true
reportMissingImports = false
reportMissingModuleSource = false
reportInvalidTypeForm = false
exclude = ["**/tests"]
|