Conversation
Update docs from main
Updated the math formatting for the partition function in the docstring.
Removed detailed explanation of partition function calculation and simplified the description.
There was a problem hiding this comment.
Pull request overview
This PR updates the project’s documentation and docstrings to provide richer API reference material and a reorganized Sphinx docs site structure.
Changes:
- Expanded and standardized docstrings for core classes/functions (System, Configuration, Plotly formatting helpers).
- Reworked Sphinx docs structure (new
_sourcepages, new API landing page, new autoclass/autmodule pages; removed legacydocs/api/*structure). - Updated Sphinx configuration and added standard build entrypoints (Makefile/make.bat), plus refreshed README installation instructions.
Reviewed changes
Copilot reviewed 22 out of 23 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| pyzentropy/system.py | Expanded class/method docstrings and minor refactors to improve readability. |
| pyzentropy/configuration.py | Expanded class/method docstrings and clarified plotting API docs. |
| pyzentropy/plotly_utils.py | Added return type annotation and updated docstring formatting. |
| docs/conf.py | Reworked Sphinx configuration and linkcode behavior. |
| docs/index.rst | New docs landing structure including overview + reorganized toctrees. |
| docs/api.rst | New consolidated API Reference toctree. |
| docs/pyzentropy.system.rst | New autoclass page for System. |
| docs/pyzentropy.configuration.rst | New autoclass page for Configuration. |
| docs/pyzentropy.utilities.rst | New/updated utilities API page for plotly_utils. |
| docs/_source/overview.rst | New overview content describing zentropy method and capabilities. |
| docs/_source/installation.md | New Markdown-based installation guide under _source. |
| docs/_source/tutorials.md | New Tutorials landing page under _source. |
| docs/Makefile | Added standard Sphinx make targets for Unix-like environments. |
| docs/make.bat | Added standard Sphinx build script for Windows environments. |
| docs/requirements.txt | Minor formatting adjustment for docs dependency list. |
| docs/installation.rst | Removed old installation page (replaced by _source/installation.md). |
| docs/api/pyzentropy.system.rst | Removed legacy automodule API page (superseded by new structure). |
| docs/api/pyzentropy.configuration.rst | Removed legacy automodule API page (superseded by new structure). |
| docs/api/api_utilities.rst | Removed legacy API toctree. |
| docs/api/api_system.rst | Removed legacy API toctree. |
| docs/api/api_configuration.rst | Removed legacy API toctree. |
| docs/api/api.rst | Removed legacy API index page. |
| README.md | Updated installation instructions and headings to match new docs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| The configuration partition functions :math:`Z_k(T, V)` are first | ||
| computed. Then, the total partition function of the system is | ||
| then obtained by summing over all configurations: | ||
| :math:`Z(T, V) = \sum_k g_k Z_k`. |
There was a problem hiding this comment.
This :math: role contains \sum in a normal (non-raw) docstring, which triggers an “invalid escape sequence” warning at import/compile time. Use a raw docstring or escape the backslash (e.g., \\sum) so the LaTeX is preserved without Python warnings.
| Helmholtz free energies :math:`F_k(T, V)`. | ||
| helmholtz_energies_dV (np.ndarray): | ||
| helmholtz_energies_dV: | ||
| First volume derivatives :math:`\partial F_k / \partial V`. | ||
| helmholtz_energies_d2V2 (np.ndarray): | ||
| helmholtz_energies_d2V2: | ||
| Second volume derivatives :math:`\partial^2 F_k / \partial V^2`. |
There was a problem hiding this comment.
This docstring section includes LaTeX commands with backslashes (e.g., \partial) inside a normal Python string literal, which produces “invalid escape sequence” warnings at import/compile time. Use a raw docstring (r"""...""") or escape backslashes (\\partial, etc.) so the math renders without warnings.
| helmholtz_energies: | ||
| Helmholtz free energies :math:`F_k(T, V)`. | ||
| helmholtz_energies_dV (np.ndarray): | ||
| helmholtz_energies_dV: | ||
| First volume derivatives :math:`\partial F_k / \partial V`. | ||
| helmholtz_energies_d2V2 (np.ndarray): | ||
| helmholtz_energies_d2V2: | ||
| Second volume derivatives :math:`\partial^2 F_k / \partial V^2`. |
There was a problem hiding this comment.
Same issue as above: the Attributes portion of the docstring contains \partial / \partial^2 in a non-raw docstring, which triggers “invalid escape sequence” warnings. Use raw docstrings or escape the backslashes in these math expressions.
| .. toctree:: | ||
| :maxdepth: 2 | ||
| :caption: Contents: | ||
| _source/installation | ||
| _source/tutorials | ||
| api | ||
| :hidden: | ||
| :maxdepth: 2 | ||
| :caption: USER GUIDE |
There was a problem hiding this comment.
In reST, .. toctree:: option lines (e.g., :hidden:, :maxdepth:, :caption:) must appear immediately after the directive and before any entries. As written, the options come after the listed documents, which Sphinx will treat as additional entries and/or emit warnings. Move the option lines above _source/installation, _source/tutorials, and api (and similarly for the later toctrees).
| pyzentropy.configuration | ||
| pyzentropy.system | ||
| pyzentropy.utilities | ||
| :maxdepth: 6 No newline at end of file |
There was a problem hiding this comment.
.. toctree:: options must be placed before the file list. With :maxdepth: after the entries, Sphinx will not apply the option as intended (and may warn about an unknown document named :maxdepth: 6). Reorder so :maxdepth: comes right after the directive, then list the pyzentropy.* pages.
| pyzentropy.configuration | |
| pyzentropy.system | |
| pyzentropy.utilities | |
| :maxdepth: 6 | |
| :maxdepth: 6 | |
| pyzentropy.configuration | |
| pyzentropy.system | |
| pyzentropy.utilities |
| project = 'pyzentropy' | ||
| copyright = '2026, Nigel Lee En Hew' | ||
| author = 'Nigel Lee En Hew' | ||
| release = '0.1.0' | ||
| __version__ = release | ||
|
|
||
| # -- Options for napoleon ---------------------------------------------------- | ||
| napoleon_google_docstring = True | ||
| napoleon_numpy_docstring = True | ||
| napoleon_include_init_with_doc = False | ||
| napoleon_include_private_with_doc = False | ||
| napoleon_include_special_with_doc = True | ||
| napoleon_use_admonition_for_examples = False | ||
| napoleon_use_admonition_for_notes = False | ||
| napoleon_use_admonition_for_references = False | ||
| napoleon_use_ivar = False | ||
| napoleon_use_param = True | ||
| napoleon_use_rtype = True | ||
| napoleon_preprocess_types = False | ||
| napoleon_type_aliases = None | ||
| napoleon_attr_annotations = True | ||
| # -- General configuration --------------------------------------------------- | ||
| # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration | ||
|
|
||
| intersphinx_mapping = { | ||
| 'python': ('https://docs.python.org/3/', None), | ||
| 'sphinx': ('https://www.sphinx-doc.org/en/master/', None), | ||
| } | ||
| intersphinx_disabled_domains = ['std'] | ||
| extensions = ['sphinx.ext.linkcode', | ||
| 'sphinx.ext.duration', | ||
| 'sphinx.ext.coverage', | ||
| 'sphinx.ext.napoleon', | ||
| 'sphinx.ext.autodoc', | ||
| 'sphinx_autodoc_typehints', | ||
| 'sphinx_github_changelog', | ||
| 'sphinx_rtd_size', | ||
| 'sphinx.ext.mathjax', | ||
| 'myst_nb' | ||
| ] | ||
|
|
||
| templates_path = ['_templates'] | ||
| exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] | ||
|
|
||
| # -- Options for HTML output | ||
| # -- Options for HTML output ------------------------------------------------- | ||
| # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output | ||
|
|
||
| html_theme = 'sphinx_rtd_theme' | ||
| html_static_path = ['_static'] | ||
|
|
||
| # Resolve function for the linkcode extension. | ||
| def linkcode_resolve(domain, info): | ||
| if domain != 'py': | ||
| return None | ||
| if not info['module']: | ||
| def find_source(): | ||
| import inspect | ||
| import os, sys | ||
| obj = sys.modules[info["module"]] | ||
| for part in info["fullname"].split("."): | ||
| obj = getattr(obj, part) | ||
|
|
||
| fn = inspect.getsourcefile(obj) | ||
| fn = os.path.relpath(fn, start=os.path.dirname(__file__)) | ||
| source, lineno = inspect.getsourcelines(obj) | ||
| return fn, lineno, lineno + len(source) - 1 | ||
|
|
||
| if domain != "py" or not info["module"]: | ||
| return None | ||
| filename = info['module'].replace('.', '/') | ||
| return "https://github.com/PhasesResearchLab/pyzentropy/blob/main/%s.py" % filename | ||
|
|
||
| # -- Options for EPUB output | ||
| epub_show_urls = 'footnote' | ||
| try: | ||
| rel_path, line_start, line_end = find_source() | ||
| # __file__ is imported from pyzentropy | ||
| filename = f"pyzentropy/{rel_path}#L{line_start}-L{line_end}" | ||
| except Exception: | ||
| # no need to be relative to core here as module includes full path. | ||
| filename = info["module"].replace(".", "/") + ".py" | ||
|
|
||
| tag = "v" + str(__version__) | ||
| return f"https://github.com/PhasesResearchLab/pyzentropy/blob/{tag}/{filename}" No newline at end of file |
There was a problem hiding this comment.
The release/__version__ is hard-coded to 0.1.0, but the package version in pyproject.toml is 0.0.0. This will make the docs display the wrong version and will also generate linkcode URLs pointing at a tag (v0.1.0) that likely doesn’t exist for branch builds. Consider deriving the version from package metadata (e.g., importlib.metadata.version('pyzentropy')) and/or using the current branch (main) unless building a tagged release.
| Helmholtz free energies :math:`F(T, V)`. | ||
| helmholtz_energies_dV: | ||
| First volume derivatives :math:`\partial F / \partial V`. | ||
| helmholtz_energies_d2V2: | ||
| Second volume derivatives :math:`\partial^2 F / \partial V^2`. |
There was a problem hiding this comment.
These docstring math roles include backslashes (e.g., \partial) inside a normal Python string literal. In Python this creates “invalid escape sequence” warnings (\p, \m, etc.) at import/compile time and can break doc builds when warnings are treated as errors. Use a raw docstring (r"""...""") or escape the backslashes (\\partial, \\mathrm, etc.) throughout the math expressions.
No description provided.