vsrepo
vsrepo copied to clipboard
Rewrite vsgenstubs4
As the title says, it's not a fix, i just rewrote everything since the stubs were outdated, and the actual module was missing features.
Files changelog:
-
.gitignore
: Mainly to ignore __pycache__ files. -
setup.py
: Addedvsgenstubs4
command line action, copy .pyi (part) file when installing from pip. -
__init__.py
,__main__.py
: Added main so it's possible to dopython -m vsgenstubs4
, moved code from dunder init to init. -
init.py
: Rewrote the module- Made the typing way easier to the user
- Collapsed the docstrings, adding
\n
. With enough plugins it would've reached thousands of lines and VSCode would have stopped reading the pyi file; this edit is to try avoid this issue. - Moved
plugins
toload-plugin
. -
plugins
(-p
) is now for selecting only those plugins and if the stubs file already exists, append them. - Sort the plugins and functions alphabetically.
- Added
exclude-plugin
, which as the name implies, excludes that plugin from the stubs file. -
avs-plugin
now will print a user friendly error if the avs plugin isn't available. - Added
force
command, which will force the rewrite of the file.
-
_vapoursynth.part.pyi
: Rewrote it from the ground up from the latest vs git (R60) cython code.- Added missing global members:
FilterMode
,CoreCreationFlags
,FuncData
,Function
,Func
,FramePtr
,RawNode
,RawFrame
,ColorFamily.UNDEFINED
- Added all missing class methods.
- Removed methods and functions removed in R60.
- Typing: added
DataType
,CallBack
,_VapourSynthMapValue
types. - Minimized
Any
usage, looking up the cython code paths. - Added inspection API under
not TYPE_CHECKING
so it's shadowed by type checkers and editors, since it's not public yet, but developers have it ready and can easily use it. - Added __all__, __pyx_capi__
- Exposed enum values stop shadowing their literal value (eg a function that takes
Literal[vs.ColorFamily.YUV]
in an overload, previously errored withvs.YUV
)
- Added missing global members:
This is still Python 3.8 compatible.
Tested with R59, R60 (latest git), both with ~200 plugins.
Setsu, the .pyi-file is there to document the public API of the vapoursynth module. It shouldn't describe every minute detail of the vapoursynth-module, especially internal classes a user will never see