Safe-DS / Stub-Generator

Automated generation of Safe-DS stubs for Python libraries.
https://stubgen.safeds.com
MIT License
3 stars 0 forks source link

Wrong package name and Python module created #117

Closed lars-reimann closed 7 months ago

lars-reimann commented 7 months ago

Describe the bug

The package names and @PythonModule annotations of the created stubs are wrong. For example, the stub for the Image class of Safe-DS starts with

@PythonModule("safeds.data.image.containers._image")
package safeds.data.image.containers.Image

It should instead be

@PythonModule("safeds.data.image.containers")
package safeds.data.image.containers

and since the package name and @PythonModule are then identical, it can be shortened to just

package safeds.data.image.containers

To Reproduce

  1. Create stubs for Safe-DS (adjust the source path): safe-ds-stubgen -o "out" -nc -s "../library/src" --docstyle NUMPYDOC -v
  2. Open out/safeds/data/image/containers/_image/image.sdsstub

Expected behavior

  1. The class name should not be part of the package name.
  2. For internal modules, no stubs should be created, i.e. the @PythonModule should never include parts that begin with an underscore. In this case, the class Image is reexported, so naturally stubs should still be created, but under a different package/Python module.

Screenshots (optional)

No response

Additional Context (optional)

No response

lars-reimann commented 7 months ago

In data__api.json, all entries of reexported_by are also empty.

lars-reimann commented 7 months ago

Works when using an absolute path for the -s argument, making this a duplicate of #125.