Commit Graph
10 Commits
Author SHA1 Message Date
baldurk 5cf2745c64 Add a script to make sure that python stubs are sensible 2026-09-14 13:19:54 +01:00
baldurk cd4b13836e Use annotation type string massaging on path with ForwardRef 2026-09-12 15:40:46 +01:00
baldurk 83c53890da Mark accessors/return values that can be None with Optional[]
* This helps with type checkers to know that things can be None or not (both to
  silence previous warnings about "unnecessary" checks that are actually
  necessary, and to ensure those checks aren't omitted by accident)
2026-09-11 15:04:03 +01:00
baldurk 75682ad346 For stubs generate files non-ident name
* For some reason python type checkers get confused at things like `from .Foo
  import Foo` and start then treating `Foo` as either the module or the class.
2026-08-13 21:05:16 +01:00
baldurk 2fbf67493f Add dummy implementation for constructor @overload
* This is needed to import the stubs when default parameters invoke constructors
  - like `ResourceId()`
2026-08-13 21:05:15 +01:00
baldurk f97094fb23 Don't include swig static member function wrappers in stubs 2026-08-13 21:05:14 +01:00
baldurk 5e462c5ebe Add type hints to python for class constructors
* We enforce default and copy constructors where possible, this isn't very
  pythonic but we can't use copy.deepcopy on our types.
* The structs that have specialised constructors e.g. FloatVector or Subresource
  also have those documented though we have no way to enforce it.
2026-08-13 17:46:47 +01:00
baldurk f9035e1c42 Assign enum value __doc__ attributes as python interpreter doesn't 2026-08-13 17:46:43 +01:00
baldurk 26a84363b8 Embed stubsgen.py and automatically generate stubs into user folder
* We create both a stubs folder for each specific version, and a 'latest' that
  is updated by newer RD versions.
* For development, the stubs will be regenerated any time the git commit hash
  changes for development builds.
2026-08-13 17:46:39 +01:00
baldurk 9223971536 Remove old stubs generation code and replace with our own script
* This is smaller and easier to maintain, and adds functionality like resolving
  circular dependencies to be able to import the stubs as-is on python 3.6+
2026-08-13 17:46:38 +01:00