Skip to content

v1.8.0: TransitionTable display, pymatgen-core, Python 3.11+#70

Merged
bjmorgan merged 12 commits intomainfrom
add-transition-table-str
Mar 27, 2026
Merged

v1.8.0: TransitionTable display, pymatgen-core, Python 3.11+#70
bjmorgan merged 12 commits intomainfrom
add-transition-table-str

Conversation

@bjmorgan
Copy link
Copy Markdown
Owner

@bjmorgan bjmorgan commented Mar 27, 2026

Summary

  • Add __str__ and _repr_html_ to TransitionTable for readable output in terminals and Jupyter notebooks
  • Validate TransitionTable matrix has numeric dtype at construction time
  • Escape HTML in _repr_html_ keys to prevent injection
  • Document table display in the transition tables guide
  • Replace duplicate docs tutorials with a single overview page linking to GitHub notebooks
  • Polish tutorial notebooks: add circumradii example, define terminology, simplify code, fix chemical formulae formatting
  • Use TransitionTable display directly in tutorials instead of wrapping in pd.DataFrame
  • Update README with tutorials section for pip-install users
  • Change runtime dependency from pymatgen to pymatgen-core; full pymatgen moved to dev dependencies
  • Bump minimum Python version from 3.10 to 3.11 (required by pymatgen-core)
  • Fix mypy no-any-return for Structure.copy() on Linux

Closes #43

TransitionTable previously had no useful string representation,
requiring custom helpers or pandas to display transition data.
Add formatted text output via __str__ and HTML table output via
_repr_html_ for Jupyter notebooks. Format auto-detects from
the matrix dtype: integer for counts, 3 decimal places for
probabilities.
- Add circumradii example to comparing_site_definitions tutorial,
  demonstrating sphere overlap and the persistence rule
- Define inradius and circumradius terms on first use
- Clean up argyrodite tutorial: use dict+loop for site types,
  fix prerequisites text, add sub/superscripts for chemical formulae,
  remove speculative mechanism discussion
- Simplify residence_times_and_transitions tutorial code
- Fix tutorials.md to use HTML sub/superscripts for Li6PS5Cl
Annotate the return type of structure.copy() explicitly, as
pymatgen-core 2026.3.9 does not expose a typed return on all
platforms.
The library only uses pymatgen.core directly. The full pymatgen
package (needed for io.vasp and symmetry in tests/benchmarks) moves
to a dev dependency.
Required by pymatgen-core, which only supports 3.11+.
- Fix "unambigious" typo in comparing_site_definitions tutorial
- Remove empty trailing code cell from the same notebook
- Add Displaying Tables section to the transition tables guide
@bjmorgan bjmorgan changed the title Add TransitionTable display methods and polish tutorials v1.8.0: TransitionTable display, pymatgen-core, Python 3.11+ Mar 27, 2026
Remove pandas DataFrame wrapping now that TransitionTable has
__str__ and _repr_html_ methods.

This comment was marked as resolved.

…ites

- Escape user-provided keys in _repr_html_ to prevent HTML injection
- List pymatgen in prerequisites for tutorials that import pymatgen.io.vasp
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread site_analysis/transition_table.py
Reject non-numeric dtypes at construction time rather than relying
on formatting to catch them.
@bjmorgan bjmorgan merged commit 5f74a60 into main Mar 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rewrite tutorials as self-contained, user-facing tutorials

2 participants