Skip to content

Latest commit

 

History

History
24 lines (22 loc) · 1.18 KB

File metadata and controls

24 lines (22 loc) · 1.18 KB

docstub 0.2.0

A first prototype of the tool with the following features:

  • Given a source directory examples/example_pkg, create a stub files for every contained Python file in examples/example-stubs/
  • No need to import the source package!
  • PYI files that already exist in the source package take precedence and are copied directly
  • Type description in NumPy style docstrings are parsed and transformed into Python ready type annotations
    • supports tuple of float like syntax
    • supports array syntax like: (N,) uint8 array-like or array of dtype float and shape (10, ..., 3) (shape is discarded for now)
    • supports literals like {"reflect", "mirror", "constant"}
    • supports <some type>, optional, extra information
    • see included examples/ for more...
  • Any is used wherever types are missing, except for the first parameter of methods and classmethods
  • Specify how used types can be imported via a map in docstub.toml::[tool.docstub.docnames]. Imports using from and as are supported. This map can also serve to provide synonyms.
  • Created stub files are automatically formatted with isort and black, if these optional dependencies are available.