unitelabs.jsondocs

Packages

Attributes

  • Name
    __version__
    Type
    Value

    = version('unitelabs-jsondocs')

    Description

  • Name
    __all__
    Type
    Value

    = [ "write_package_json", "load_package", "ImproperDocumentationException", "ParameterDocumentationMismatchException" ]

    Description

Functions

  • load_package(package_name : str, package : typing.Optional[str]) -> dict[str, typing.Any]

    For a given an importable `package_name`, (as specified by `importlib.import_module`) parse the google-style documentation as a JSON string.

    Parameters

    • Name
      package_name
      Type
      str
      Default
      Description

      The name of the package/module to extract documentation from, or a relative path to a package/module, which requires `package` to also be set.

    • Name
      package
      Type
      typing.Optional[str]
      Default
      = None
      Description

      The import name of the package in the form of `package_name`, for use with relative paths.

    Response

    Type
    dict[str, typing.Any]
    Description

    A JSON string of the documentation.

  • write_package_json(
      package_name : str,
      outpath : typing.Optional[pathlib.Path],
      package : typing.Optional[str]
    ) -> None

    Write a JSON file of the documentation for the given `package_name`. Requires the package to be available on `sys.path`, i.e. installed in local environment.

    Parameters

    • Name
      package_name
      Type
      str
      Default
      Description

      The name of the package or the dot-separated import path (also the case for namespaced packages), to the module to extract documentation from, or a relative path to a package/module, which requires `package` to also be set.

    • Name
      outpath
      Type
      typing.Optional[pathlib.Path]
      Default
      = None
      Description

      The desired path of the JSON output file, defaults to directory in which this is run, using the distribution name.

    • Name
      package
      Type
      typing.Optional[str]
      Default
      = None
      Description

      The name of the package in the form of `package_name`, for use with relative paths.

Classes

Copyright © 2024