• Stars
    star
    132
  • Rank 272,591 (Top 6 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 1 year ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Python stubs for VFX and Animation

CG Stubs

Python stubs for VFX and Animation

These stubs are intended to be used with a type checker like mypy to provide static type checking of python code, as well as analysis and completion in IDEs like PyCharm and VSCode with Pylance.

Supported libraries and applications:

Note that pymel now has very excellent stubs included (more info here).

Installing

These are distributed as "stubs-only" python packages, so you can just pip install whichever packages you need:

pip install types-usd types-houdini types-katana types-mari types-nuke types-opencolorio types-PySide2 types-substance_painter

Generating the stubs

You only need to do this if you your goal is to help improve the stubs. Otherwise, just use pip.

In the instructions below, replace ocio with your desired package to generate.

First, look at ocio/stubgen_ocio.sh to see if there are any env vars to set in the # Custom variables section.

Next, you'll need to check out a custom build of mypy (until my PR gets merged):

git clone https://github.com/LumaPictures/cg-stubs
git clone https://github.com/chadrik/mypy
cd mypy
git checkout stubgen/shared-sig-gen-14
cd ..

Next, build the stubs using nox. Requires python 3.7+:

cd cg-stubs
python3 -m venv .venv
. .venv/bin/activate
pip install -r nox-requirements.txt
nox -s 'generate(ocio)'

If this fails, here's a more foolproof approach:

# setup your env, e.g. setpkg python-3.7
unset PYTHONPATH
python3 -m venv .venv37
. .venv37/bin/activate
python3 -m pip install -r nox-requirements.txt
rm -rf .nox
python3 -m nox -s 'generate(ocio)'

Testing while Developing

The easiest way to use the stubs while you're devleoping them is to create an editable install. Simply create a .pth file in the site-packages directory of the venv where your other deps live:

echo "/path/to/cg-stubs/ocio/stubs/" > /path/to/venv/lib/python3.7/site-packages/ocio.pth

The name of the .pth file does not matter. Note that if you're using the mypy daemon, be sure to run dmypy stop to reread freshly modified stubs.

Generating the USD stubs

The USD stubs currently require you to build a special fork of USD, until the necessary changes are merged.

git clone https://github.com/chadrik/USD
git checkout doc-stubs2
python3 -m venv .venv
.venv/bin/activate
pip install PySide6 PyOpenGL
python3 build_scripts/build_usd.py --python-docs --docs .build

Then update the variables in stubgen_usd.sh and generate as normal.

Generating the Substance Painter stubs

These must be generated from within the UI, because I could not figure out how to run a standlone interpreter.

import mypy.stubgen;mypy.stubgen.main(['-p', '_substance_painter'])

Then generate as normal to cleanup the stubs.

Generating the Houdini stubs

The Houdini stubs currently use a completely different approach to building which will eventually be ported to nox. So this may be unapproachable for most users for now.

Publishing to PyPI

To publish to pypi.org, first run the nox installation steps from the Generating section, then run the publish task (replacing ocio with the package to publish):

nox -s 'publish(ocio)'

To publish to a custom registry:

poetry config repositories.pypi-nexus https://nexus.myorg/repository/pypi/
nox -s 'publish(ocio)' --  --repository pypi-nexus -u pypi -p 'whatever'

More Repositories

1

pymel

Python in Maya Done Right
Python
479
star
2

usd-qt

Reusable Qt Components for Pixar's USD
Python
153
star
3

LumaNukeGizmos

Gizmos for nuke
Python
128
star
4

meteor-jquery-datatables

Sort, page, and filter millions of records reactively.
CoffeeScript
98
star
5

usd-arnold

USD schemas, exporters, and importers for Arnold renderer
C++
65
star
6

usd-uri-resolver

Pluggable URI ArResolver for USD
CMake
47
star
7

openvdb-render

Toolset for visualizing and rendering openvdb volumes in Maya
C++
42
star
8

pflow

Flow based programming for Python
Python
27
star
9

meteor-jquery-select2

A Blaze UI select2 component that supports reactive search.
CoffeeScript
26
star
10

arnold-rv

Driver for sending arnold frame buffers to Tweak's RV (Righteous Viewer).
C++
24
star
11

houdini-engine-clarisse

Houdini Engine integration for Isotropix Clarisse
C++
24
star
12

meteor-luma-ui

Routes, Styles, Components, and much more
HTML
23
star
13

gozbruh

Sync meshes between Maya and ZBrush running on different workstations
Python
22
star
14

nukecli

Nuke Command-line Tools
Python
17
star
15

setpkg

a command-line utility for managing environment variables
Python
12
star
16

usd-qt-components

Reusable UI components for viewing and authoring USD files
Python
12
star
17

bbcp2

bbcp - Fast file transfer over WAN
C++
10
star
18

luma_usd

Plugins for USD
C++
10
star
19

maya-to-hydra

This repo is no longer updated. Please see https://github.com/Autodesk/maya-usd
C++
10
star
20

meteor-jquery-sparklines

A reactive blaze component for rendering live jQuery Sparklines.
CoffeeScript
9
star
21

rez-build

7
star
22

meteor-spiner

A reactive REST API that builds structured JSON from PostgreSQL Records
CoffeeScript
4
star
23

pymel-docs

pymel documentation for readthedocs
Python
4
star
24

rt-slam

Luma fork of the rt-slam project, from LAAS
C++
4
star
25

qt_tools

Source code for the qt_tools project by David Van Brink
C
3
star
26

maya-usd-scripts

Scripts for helping with merging issues for Maya-USD and "old" Pixar and Animal Logic Repos
Shell
3
star
27

dbdump

Simple unidirectional MySQL data synchronization without complex configuration
Python
2
star
28

robotpkg

Luma fork of robotpkg project, from LAAS
C
2
star
29

meteor-luma-component

Blaze UI Component Mixins
CoffeeScript
1
star
30

ftrack_performance_tests

Comparison of Ftrack API to Sqlalchemy and raw SQL
Python
1
star
31

meteor-luma-admin

CoffeeScript
1
star
32

openrobot-MTI

luma fork of the openrobots MTI-interface library
C++
1
star
33

gdoc-example

Google Docs Example
CSS
1
star
34

meteor-backbone-relational

Client and Server models for handling relational data.
JavaScript
1
star
35

meteor-jquery-caret

Manipulate the caret's position in a text box or content-editable element
JavaScript
1
star
36

jafar

Luma fork of jafar project, from LAAS
C++
1
star