Skip to content

Commit

Permalink
Re-adopt pydot and support Maya-2025 (#40)
Browse files Browse the repository at this point in the history
* Drop `pygraphviz` in favour of `pydot`
* Support Maya-2025 which uses PySide6
* Attribute context menu items in USDView for clearing and blocking values
* Extend CI to test USD-21.11 + Python-3.9
* Test data for faster tests
* Removed `sphinx_autodoc_typehints` since it led to singledispatched / overloaded functions to not appear in sphinx docs
* updated views._graph.Node internals to use "port" instead of "plug"

---------

Signed-off-by: Christian López Barrón <chris.gfz@gmail.com>
  • Loading branch information
chrizzFTD authored Dec 14, 2024
1 parent 2c09127 commit 3e519a5
Show file tree
Hide file tree
Showing 31 changed files with 1,516 additions and 854 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.12"]
python-version: ["3.9", "3.10", "3.12"]
include:
- python-version: "3.9"
install-arguments: ". PySide2 usd-core==22.5 PyOpenGL pygraphviz"
install-arguments: ". PySide2 usd-core==21.11 PyOpenGL" # 21.11 enables AR-2.0 by default
- python-version: "3.10"
install-arguments: ". PySide2 usd-core==23.2 PyOpenGL"
- python-version: "3.12"
install-arguments: ".[full]"
steps:
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2 # required for PY39+
build:
os: ubuntu-20.04
tools:
python: "3.9"
python: "3.10"
apt_packages:
- "graphviz"

Expand Down
37 changes: 19 additions & 18 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,23 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.inheritance_diagram',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.viewcode',
'sphinx.ext.graphviz',
"myst_parser",
'sphinx_copybutton',
'sphinx_toggleprompt',
'sphinx_togglebutton',
'sphinx_inline_tabs',
'hoverxref.extension',
'sphinx.ext.autosectionlabel',
'sphinx_autodoc_typehints']
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.inheritance_diagram',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.viewcode',
'sphinx.ext.graphviz',
"myst_parser",
'sphinx_copybutton',
'sphinx_toggleprompt',
'sphinx_togglebutton',
'sphinx_inline_tabs',
'hoverxref.extension',
'sphinx.ext.autosectionlabel',
]

# Offset to play well with copybutton
toggleprompt_offset_right = 35
Expand Down Expand Up @@ -103,9 +104,9 @@
# built documents.
#
# The short X.Y version.
version = '0.17'
version = '0.18'
# The full version, including alpha/beta/rc tags.
release = '0.17.1'
release = '0.18.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
89 changes: 8 additions & 81 deletions docs/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ DCC apps and other environments bundle them outside of ``pip``. To include them,
.. tab:: Maya

Visit the `official docs <https://help.autodesk.com/view/MAYAUL/2022/ENU/?guid=GUID-72A245EC-CDB4-46AB-BEE0-4BBBF9791627>`_ for more details.
Visit the `official docs <https://help.autodesk.com/view/MAYAUL/2025/ENU/?guid=GUID-72A245EC-CDB4-46AB-BEE0-4BBBF9791627>`_ for more details.

.. code-block:: bash
Expand All @@ -46,7 +46,7 @@ Extra Dependencies

The following optional dependencies should be installed separately.

- `graphviz <http://graphviz.org/>`_ and `pygraphviz`_ for graph widgets. See conda example below for instructions.
- `graphviz`_ for graph widgets. See conda example below for instructions.
- `usdview <https://openusd.org/release/toolset.html#usdview>`_
(hopefully will be available soon via `pypi <https://pypi.org/>`_). In the meantime, it can be built from USD source
(`conda recipe <https://github.com/PixarAnimationStudios/USD/issues/1260#issuecomment-656985888>`_).
Expand All @@ -69,11 +69,11 @@ walk-through on how to start using ``The Grill`` tools with a fresh
2. Launch `Anaconda Prompt <https://docs.anaconda.com/anaconda/user-guide/getting-started/#open-anaconda-prompt>`_
(it came as part of the `miniconda`_ installation).

3. Create a new ``conda`` environment with ``python=3.9``, for example:
3. Create a new ``conda`` environment with ``python=3.10``, for example:

.. code:: PowerShell
(base) C:\>conda create -n grilldemo01 python=3.9
(base) C:\>conda create -n grilldemo01 python=3.10
4. Activate that environment:

Expand All @@ -88,84 +88,11 @@ walk-through on how to start using ``The Grill`` tools with a fresh
(grilldemo01) C:\>python -m pip install grill[full]
6. If missing, (optionally) install `pygraphviz`_ via ``conda``:
6. If missing, (optionally) install `graphviz`_ via ``conda``:

.. warning::

At the moment, installing `pygraphviz`_ can be tricky. Hopefully a simpler pip+wheel based solution comes with `pygraphviz#167 <https://github.com/pygraphviz/pygraphviz/issues/167>`_.

Versions older than ``pip-23.3.2`` may have trouble installing `pygraphviz`_ in Windows for DCCs like ``Maya`` and ``Houdini``.
If you come through this trouble, visit `pygraphviz#468 <https://github.com/pygraphviz/pygraphviz/pull/468>`_ and try to install with this exact particular version of ``pip``.
The below tests ran successfully with ``Maya-2024`` and ``Houdini-20.0`` on ``Windows-10`` and ``pip-23.3.2``.

The current ``pip`` version can be extracted like so:

.. tab:: Standalone Python

.. code:: PowerShell
python -m pip -V
.. tab:: Houdini

.. code:: PowerShell
hython -m pip -V
.. tab:: Maya

.. code:: PowerShell
mayapy -m pip -V
To update to ``23.3.2``, update the interpreter command to run:

.. tab:: Standalone Python

.. code:: PowerShell
python -m pip install -U pip==23.3.2
.. tab:: Houdini

.. code:: PowerShell
hython -m pip install -U pip==23.3.2
.. tab:: Maya

.. code:: PowerShell
mayapy -m pip install -U pip==23.3.2
.. tab:: Standalone Python

Replace ``--global-option`` to the correct ``Include`` and ``Lib`` paths on the system (where ``graphviz\cgraph.h`` and ``cgraph.lib`` paths exist, respectively):

.. code:: PowerShell
(grilldemo01) C:\>conda install --channel conda-forge pygraphviz
(grilldemo01) C:\>python -m pip install --global-option=build_ext --global-option="-IC:\Users\Christian\.conda\envs\glowdeps\Library\include" --global-option="-LC:\Users\Christian\.conda\envs\glowdeps\Library\lib" pygraphviz
.. tab:: Houdini

Replace ``--global-option`` to the correct ``Include`` and ``Lib`` paths on the system (where ``graphviz\cgraph.h`` and ``cgraph.lib`` paths exist, respectively):

.. code:: PowerShell
(grilldemo01) C:\>conda install --channel conda-forge pygraphviz
(grilldemo01) C:\Program Files\Side Effects Software\Houdini 19.5.534\bin>hython -m pip install -vvv --use-pep517 --config-settings="--global-option=build_ext" --config-settings="--global-option=-IC:\Users\Christian\.conda\envs\pygraphviz310\Library\include" --config-settings="--global-option=-LC:\Users\Christian\.conda\envs\pygraphviz310\Library\lib" pygraphviz
.. tab:: Maya

Replace ``--global-option`` to the correct ``Include`` and ``Lib`` paths on the system (where ``graphviz\cgraph.h`` and ``cgraph.lib`` paths exist, respectively) **and** the Maya Python ``include`` and ``lib`` paths:

.. code:: PowerShell
(grilldemo01) C:\>conda install --channel conda-forge pygraphviz
(grilldemo01) C:\Program Files\Autodesk\Maya2023\bin>mayapy -m pip install -U pip==23.3.2
(grilldemo01) C:\Program Files\Autodesk\Maya2023\bin>mayapy -m pip install -vvv --use-pep517 --config-settings="--global-option=build_ext" --config-settings="--global-option=-IC:\Users\Christian\.conda\envs\pygraphviz310\Library\include;C:\Program Files\Autodesk\Maya2024\include\Python39\Python" --config-settings="--global-option=-LC:\Users\Christian\.conda\envs\pygraphviz310\Library\lib;C:\Program Files\Autodesk\Maya2024\lib" pygraphviz
.. code:: PowerShell
(grilldemo01) C:\>conda install conda-forge::graphviz
7. You should be able to see the ``👨‍🍳 Grill`` menu in **USDView**, **Maya** and **Houdini***.

Expand All @@ -191,7 +118,7 @@ walk-through on how to start using ``The Grill`` tools with a fresh
The manual execution of this step might be removed in the future.

.. _pygraphviz: https://pygraphviz.github.io/documentation/stable/install.html
.. _graphviz: http://graphviz.org
.. _miniconda: https://docs.conda.io/en/latest/miniconda.html
.. _Anaconda: https://docs.anaconda.com/anaconda/user-guide/getting-started/
.. _conda: https://docs.conda.io/projects/conda/en/latest/index.html
6 changes: 5 additions & 1 deletion grill/__startup__/maya.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
from maya import cmds
from PySide2 import QtCore

if cmds.about(qt=True).startswith("6"):
from PySide6 import QtCore
else:
from PySide2 import QtCore


def install():
Expand Down
Loading

0 comments on commit 3e519a5

Please sign in to comment.