Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix outdated setup.py find_namespace_packages and add test_egg_sources_txt_is_complete #3374

Merged
merged 9 commits into from
Oct 4, 2023
69 changes: 64 additions & 5 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ nav_order: 4

## v2023.10.4

- Bug fixes for MPRester and packaged data.
### 🐛 Bug Fixes

- Fix missing `potcar_summary_stats.json.gz` in `setup.package_data` by @janosh in <https://github.com/materialsproject/pymatgen/pull/3372>
- Bug fixes for MPRester and packaged data by @shyuep

**Full Changelog**: <https://github.com/materialsproject/pymatgen/compare/v2023.10.3...v2023.10.4>

## v2023.10.3

Expand Down Expand Up @@ -67,12 +72,66 @@ nav_order: 4

**Full Changelog**: <https://github.com/materialsproject/pymatgen/compare/v2023.9.2...v2023.9.10>

### 🛠 Enhancements

- Add an input arg check for `Kpoints.automatic_density_by_lengths` by @Andrew-S-Rosen in <https://github.com/materialsproject/pymatgen/pull/3299>

### 🏥 Package Health

- Remove pydantic < 2 from `setup.py` and bump monty in `requirements.txt` by @Andrew-S-Rosen in <https://github.com/materialsproject/pymatgen/pull/3303>
- Move `py.typed` to package root by @Andrew-S-Rosen in <https://github.com/materialsproject/pymatgen/pull/3307>
- Consistent casing `setup->setUp` across test classes by @janosh in <https://github.com/materialsproject/pymatgen/pull/3305>

**Full Changelog**: <https://github.com/materialsproject/pymatgen/compare/v2023.9.2...v2023.9.10>

## v2023.9.2

- VaspInputSets now allow structure to be None for stateless initialization.
- MatPESStaticSet designed for generating PES data. (@SophiaRuan, @JiQi535)
- Breaking: Bump minimum Python version to 3.9, in line with numpy.
- Add `properties` to Structure and Molecule, with ASE adaptor support (@gpetretto, @Andrew-S-Rosen)
- Add `Lattice` property `params_dict` by @janosh in <https://github.com/materialsproject/pymatgen/pull/3239>
- Generate SupercellTransformation from minimum boundary distance by @JiQi535 in <https://github.com/materialsproject/pymatgen/pull/3238>
- More concise `test_from_boundary_distance` by @janosh in <https://github.com/materialsproject/pymatgen/pull/3242>
- Breaking: remove deprecated keyword `properties` from `Species` by @janosh in <https://github.com/materialsproject/pymatgen/pull/3243>
- Typo in Docs for PeriodicsSite by @jmmshn in <https://github.com/materialsproject/pymatgen/pull/3249>
- Fix `Vasprun.converged_electronic` check if `ALGO=CHI` in `INCAR` by @janosh in <https://github.com/materialsproject/pymatgen/pull/3250>
- Breaking: Have plot methods return `plt.Axes` object, not `matplotlib` module by @janosh in <https://github.com/materialsproject/pymatgen/pull/3237>
- Fix `ruff` D212 by @janosh in <https://github.com/materialsproject/pymatgen/pull/3251>
- Fix some Kpoints generated using wrong mesh types by @matthewkuner in <https://github.com/materialsproject/pymatgen/pull/3245>
- read `mag` from OSZICAR by @chiang-yuan in <https://github.com/materialsproject/pymatgen/pull/3146>
- Use `numpy.testing.assert_allclose` over `assert np.allclose` by @janosh in <https://github.com/materialsproject/pymatgen/pull/3253>
- Don't let tests pollute the `pymatgen` repo by @janosh in <https://github.com/materialsproject/pymatgen/pull/3255>
- Update `compatibility.md` by @mbercx in <https://github.com/materialsproject/pymatgen/pull/3260>
- Google-style doc string return types by @janosh in <https://github.com/materialsproject/pymatgen/pull/3258>
- Quasi-RRHO Thermochemistry Analysis Module by @arepstein in <https://github.com/materialsproject/pymatgen/pull/2028>
- Add keyword `check_occu: bool = True` to `CifParser.get_structures()` by @jonathanjdenney in <https://github.com/materialsproject/pymatgen/pull/2836>
- Fix bug in feff inputs.py by @kaifengZheng in <https://github.com/materialsproject/pymatgen/pull/3256>
- Cancel concurrent CI runs to save budget by @janosh in <https://github.com/materialsproject/pymatgen/pull/3263>
- Fix `Procar.get_projection_on_elements` for structures with multiple same-element ionic sites by @Na-Kawa in <https://github.com/materialsproject/pymatgen/pull/3261>
- Fix `TestMPScanStaticSet.test_as_from_dict()` by @janosh in <https://github.com/materialsproject/pymatgen/pull/3266>
- Bump activesupport from 7.0.6 to 7.0.7.2 in /docs by @dependabot in <https://github.com/materialsproject/pymatgen/pull/3267>
- Fix `TestMPStaticSet` using `MPRelaxSet` in `test_user_incar_kspacing` and `test_kspacing_override` by @janosh in <https://github.com/materialsproject/pymatgen/pull/3268>
- Fix `nelectrons` not updating when replacing species in `Molecule` by @janosh in <https://github.com/materialsproject/pymatgen/pull/3269>
- Add `properties` to Structure and Molecule by @gpetretto in <https://github.com/materialsproject/pymatgen/pull/3264>
- Fix `CifParser.get_structures(check_occu=False)` by @janosh in <https://github.com/materialsproject/pymatgen/pull/3272>
- Add `PotcarSingle.__repr__` by @janosh in <https://github.com/materialsproject/pymatgen/pull/3273>
- `__str__` to `__repr__` by @janosh in <https://github.com/materialsproject/pymatgen/pull/3274>
- Ion: handle dissolved gas formulas by @rkingsbury in <https://github.com/materialsproject/pymatgen/pull/3275>
- Add VASP input set `MatPESStaticSet` by @SophiaRuan in <https://github.com/materialsproject/pymatgen/pull/3254>
- Fix `test_valid_magmom_struct()` error message regex by @janosh in <https://github.com/materialsproject/pymatgen/pull/3276>
- fix tests of MatPESStaticSet by @SophiaRuan in <https://github.com/materialsproject/pymatgen/pull/3281>
- Breaking: bump minimum Python version to 3.9 by @janosh in <https://github.com/materialsproject/pymatgen/pull/3283>
- Breaking: Update `AseAtomsAdaptor` to handle `Structure.properties`/`Molecule.properties` by @Andrew-S-Rosen in <https://github.com/materialsproject/pymatgen/pull/3270>
- Slightly relax the constraint satisfy condition of get_primitive_structure() by @fyalcin in <https://github.com/materialsproject/pymatgen/pull/3285>
- [WIP] add custodian modified incar settings to incar and modify tests by @SophiaRuan in <https://github.com/materialsproject/pymatgen/pull/3284>
- Add keyword `bandgap_tol: float = 1e-4` to `MPScanRelaxSet` by @janosh in <https://github.com/materialsproject/pymatgen/pull/3287>
- `np.(arange->linspace)` in `io/vasp/optics.py` `get_delta`, `get_setp` and `epsilon_imag` by @LucasGVerga in <https://github.com/materialsproject/pymatgen/pull/3286>
- MatPESStaticSet restore GGA tag removal if xc_functional.upper() == "R2SCAN" by @janosh in <https://github.com/materialsproject/pymatgen/pull/3288>
- Bump pypa/cibuildwheel from 2.14.1 to 2.15.0 by @dependabot in <https://github.com/materialsproject/pymatgen/pull/3294>
- Bump cython from 3.0.0 to 3.0.2 by @dependabot in <https://github.com/materialsproject/pymatgen/pull/3292>
- Bump scipy from 1.11.1 to 1.11.2 by @dependabot in <https://github.com/materialsproject/pymatgen/pull/3291>
- Bump plotly from 5.11.0 to 5.16.1 by @dependabot in <https://github.com/materialsproject/pymatgen/pull/3289>
- Bump joblib from 1.3.1 to 1.3.2 by @dependabot in <https://github.com/materialsproject/pymatgen/pull/3290>
- Bump mp-api from 0.33.3 to 0.35.1 by @dependabot in <https://github.com/materialsproject/pymatgen/pull/3293>
- xyz.**iter**() -> iter(xyz) by @janosh in <https://github.com/materialsproject/pymatgen/pull/3228>
- Deprecate overlooked `from/as_..._string` methods by @janosh in <https://github.com/materialsproject/pymatgen/pull/3295>

## v2023.8.10

Expand Down
80 changes: 75 additions & 5 deletions docs/CHANGES.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

5 changes: 1 addition & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@

setup(
name="pymatgen",
packages=find_namespace_packages(
include=["pymatgen.*", "pymatgen.analysis.*", "pymatgen.io.*", "pymatgen.ext.*", "cmd_line"],
exclude=["pymatgen.*.tests", "pymatgen.*.*.tests", "pymatgen.*.*.*.tests"],
),
packages=find_namespace_packages(include=["pymatgen.*", "pymatgen.**.*", "cmd_line"]),
version="2023.10.4",
python_requires=">=3.9",
install_requires=[
Expand Down
22 changes: 0 additions & 22 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ def release(ctx, version=None, nodoc=False):

ctx.run("rm -f dist/*.*", warn=True)
ctx.run("python setup.py sdist bdist_wheel", warn=True)
check_egg_sources_txt_for_completeness()
ctx.run("twine upload --skip-existing dist/*.whl", warn=True)
ctx.run("twine upload --skip-existing dist/*.tar.gz", warn=True)
# post_discourse(ctx, warn=True)
Expand All @@ -249,24 +248,3 @@ def open_doc(ctx):
def lint(ctx):
for cmd in ["ruff", "mypy", "black", "pylint"]:
ctx.run(f"{cmd} pymatgen")


def check_egg_sources_txt_for_completeness():
"""Check that all source and data files in pymatgen/ are listed in pymatgen.egg-info/SOURCES.txt."""
src_txt = "pymatgen.egg-info/SOURCES.txt"
if not os.path.exists(src_txt):
raise FileNotFoundError(f"{src_txt} not found. Run `pip install .` to create")

with open(src_txt) as file:
sources = file.read()

for src_file in sources.splitlines():
if not os.path.exists(src_file):
raise ValueError(f"{src_file} does not exist!")

for ext in ("py", "json", "json.gz", "yaml", "csv"):
for filepath in glob(f"pymatgen/**/*.{ext}", recursive=True):
if "/tests/" in filepath or "dao" in filepath:
continue
if filepath not in sources:
raise ValueError(f"{filepath} not found in {src_txt}")
31 changes: 31 additions & 0 deletions tests/test_pkg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from __future__ import annotations

import os
from glob import glob

import pytest

src_txt_path = "pymatgen.egg-info/SOURCES.txt"
src_txt_missing = not os.path.isfile(src_txt_path)


@pytest.mark.skipif(src_txt_missing, reason=f"{src_txt_path} not found. Run `pip install .` to create")
def test_egg_sources_txt_is_complete():
"""Check that all source and data files in pymatgen/ are listed in pymatgen.egg-info/SOURCES.txt."""

with open(src_txt_path) as file:
sources = file.read()

# check that all files listed in SOURCES.txt exist
for src_file in sources.splitlines():
assert os.path.exists(src_file), f"{src_file!r} does not exist!"

# check that all files in pymatgen/ are listed in SOURCES.txt
for ext in ("py", "json", "json.gz", "yaml", "csv"):
for filepath in glob(f"pymatgen/**/*.{ext}", recursive=True):
if "/tests/" in filepath or filepath.endswith("dao.py"):
continue
if filepath not in sources:
raise ValueError(
f"{filepath} not found in {src_txt_path}. check setup.py package_data for outdated inclusion rules."
)
Loading