Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f0128a2
converting XDSM to a Pydantic BaseModel.
robfalck Oct 2, 2025
37c58f0
Separated latex writer.
robfalck Oct 10, 2025
6bdb751
util.py
robfalck Oct 10, 2025
eb2a89e
added __main__ with exporting of json to other formats.
robfalck Oct 23, 2025
41b2b7a
removed notional html output
robfalck Oct 23, 2025
f8021da
removed deprecated numpy distutils.
robfalck Oct 23, 2025
5b1f950
Docs and pyproject.toml
robfalck Oct 23, 2025
1208d39
More documentation, tests, and some cleanup.
robfalck Oct 23, 2025
0db435a
ruff passes with a few ignores for string formatting.
robfalck Oct 23, 2025
eca0d66
test of example json files. cli cleanup.
robfalck Oct 24, 2025
795f6f4
ruff check passing
robfalck Oct 24, 2025
3bf2caf
ruff format
robfalck Oct 24, 2025
24d183e
cleanup of MatrixEqn and Jacobian schema
robfalck Nov 13, 2025
fa4c408
Update JSON output to add terminal line ending.
robfalck Dec 1, 2025
de0b50a
Restored docstrings/comments in XDSM.
robfalck Dec 1, 2025
dbc5e18
ruff fixes for matrix_eqn
robfalck Dec 1, 2025
1a64455
Better docstrings for to_json/from_json. from_json can now handle str…
robfalck Dec 2, 2025
004f009
lint
robfalck Dec 2, 2025
6d6e098
cleanup based on feedback from ewu63
robfalck Dec 11, 2025
9186a34
Removed unneeded __init__. Removed unused NodeType.
robfalck Dec 12, 2025
ad4b6c3
ruff check/format
robfalck Dec 12, 2025
059437a
Ruff format on test
robfalck Dec 12, 2025
aee422e
Add autodoc_pydantic to doc requirements.txt.
robfalck Dec 23, 2025
359441f
eof fix
robfalck Dec 23, 2025
8c6cd13
docs build without warning
robfalck Dec 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
examples/*
!examples/*.py
!examples/*.json

*.so
*.o
Expand Down
55 changes: 53 additions & 2 deletions doc/API.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,59 @@
.. _pyXDSM_API:

pyXDSM API
==========

XDSM Class
----------
.. currentmodule:: pyxdsm.XDSM

.. autoclass:: pyxdsm.XDSM.XDSM
The main XDSM class for creating Extended Design Structure Matrix diagrams.

.. autopydantic_model:: pyxdsm.XDSM.XDSM
:members:
:undoc-members:
:show-inheritance:
:member-order: bysource
:exclude-members: model_config, model_fields, model_computed_fields

Pydantic Models
---------------

SystemNode
^^^^^^^^^^

.. autopydantic_model:: pyxdsm.XDSM.SystemNode
:members:
:undoc-members:
:show-inheritance:

ConnectionEdge
^^^^^^^^^^^^^^

.. autopydantic_model:: pyxdsm.XDSM.ConnectionEdge
:members:
:undoc-members:
:show-inheritance:

OutputNode
^^^^^^^^^^

.. autopydantic_model:: pyxdsm.XDSM.OutputNode
:members:
:undoc-members:
:show-inheritance:

ProcessChain
^^^^^^^^^^^^

.. autopydantic_model:: pyxdsm.XDSM.ProcessChain
:members:
:undoc-members:
:show-inheritance:

AutoFadeConfig
^^^^^^^^^^^^^^

.. autopydantic_model:: pyxdsm.XDSM.AutoFadeConfig
:members:
:undoc-members:
:show-inheritance:
36 changes: 35 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,42 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions.extend(["numpydoc"])
extensions.extend([
"numpydoc",
"sphinx.ext.intersphinx",
"sphinxcontrib.autodoc_pydantic",
])
numpydoc_show_class_members = False

# -- intersphinx configuration ------------------------------------------------

intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"pydantic": ("https://docs.pydantic.dev/latest/", None),
}

# -- autodoc_pydantic configuration -------------------------------------------

# Show all configuration options for Pydantic models
autodoc_pydantic_model_show_json = False
autodoc_pydantic_model_show_config_summary = False
autodoc_pydantic_model_show_config_member = False
autodoc_pydantic_model_show_validator_members = False
autodoc_pydantic_model_show_validator_summary = False
autodoc_pydantic_model_show_field_summary = True
autodoc_pydantic_model_members = True
autodoc_pydantic_model_undoc_members = True

# Settings for fields
autodoc_pydantic_field_list_validators = False
autodoc_pydantic_field_doc_policy = "both" # Show both docstring and description
autodoc_pydantic_field_show_constraints = True
autodoc_pydantic_field_show_alias = True
autodoc_pydantic_field_show_default = True

# Validator settings
autodoc_pydantic_validator_replace_signature = True
autodoc_pydantic_validator_list_fields = True

# mock import for autodoc
autodoc_mock_imports = ["numpy"]
36 changes: 36 additions & 0 deletions doc/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,42 @@ This will output ``mdf.tex``, a standalone tex document that (by default) is als
:scale: 30


This example uses the `.to_json` method to serialize the XDSM to a JSON file:

.. literalinclude:: ../examples/mdf.json

This can be loaded programmatically using the static :meth:`~pyxdsm.XDSM.XDSM.from_json` method.
Alternatively a command-line tool can be used to write the JSON to a PDF, a tikz file, or another JSON file.

Command-line Usage
------------------

The JSON file can be used directly from the command line:

.. code-block:: bash

python -m pyxdsm mdf.json -o mdf.pdf

This generates a PDF from the JSON specification. Other output formats are also supported:

.. code-block:: bash

# Generate only TikZ (no PDF compilation)
python -m pyxdsm mdf.json -o mdf.tikz

# Export to a different JSON file
python -m pyxdsm mdf.json -o output.json

# Generate PDF with default name (mdf.pdf)
python -m pyxdsm mdf.json

For more options, use the ``--help`` flag:

.. code-block:: bash

python -m pyxdsm --help


More complicated example
------------------------

Expand Down
1 change: 1 addition & 0 deletions doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
numpydoc
sphinx_mdolab_theme
autodoc-pydantic
Loading