Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Generate stubs for public methods of private classes which are superclasses of public classes #64

Closed
Masara opened this issue Feb 20, 2024 · 2 comments · Fixed by #69
Labels
enhancement 💡 New feature or request released Included in a release

Comments

@Masara
Copy link
Contributor

Masara commented Feb 20, 2024

Is your feature request related to a problem?

Currently (after PR #50), if public classes inherit from private classes, the stubs for the public class will be generated and reference those private classes, but the private classes won't be generated and are therefore "invisible" for the user.

Desired solution

If a public class inherits from a private class, the private class should generate stubs, too.

To do this, we would need to extend the information in the API data so that superclass information also points in the other direction, i.e. we need to find out the subclasses for all classes.

The stubs generator should add the public methods of the internal classes to the public classes.

Additional Context

An example test case where the private super class should be generated can be found @ Stub-Generator\tests\data\various_modules_package\aliasing\aliasing_module_1.py for the class AliasingModuleClassC.

@Masara Masara added the enhancement 💡 New feature or request label Feb 20, 2024
@lars-reimann
Copy link
Member

lars-reimann commented Feb 20, 2024

I'd rather propose generating stubs for inherited public methods in the public classes. The stubs are meant to mirror the public interface of a library, which internal classes are not a part of.

@Masara Masara changed the title feat: Generate stubs for private classes which are superclasses of public classes feat: Generate stubs for public methods of private classes which are superclasses of public classes Feb 28, 2024
lars-reimann pushed a commit that referenced this issue Mar 4, 2024
)

Closes #64

### Summary of Changes

Now stubs for public methods of internal classes that are being
inherited will be created for the classes that inherit them.

---------

Co-authored-by: megalinter-bot <[email protected]>
@github-project-automation github-project-automation bot moved this from Backlog to ✔️ Done in Library Analysis Mar 4, 2024
lars-reimann pushed a commit that referenced this issue Mar 29, 2024
## [0.2.0](v0.1.0...v0.2.0) (2024-03-29)

### Features

* Added generation for Safe-DS stubs files ([#33](#33)) ([ab45b45](ab45b45))
* Correct stubs for TypeVars ([#67](#67)) ([df8c5c9](df8c5c9)), closes [#63](#63)
* Create stubs for public methods of inherited internal classes ([#69](#69)) ([71b38d7](71b38d7)), closes [#64](#64)
* Rework import generation for stubs. ([#50](#50)) ([216e179](216e179)), closes [#38](#38) [#24](#24) [#38](#38) [#24](#24)
* Safe-DS stubs also contain docstring information. ([#78](#78)) ([bdb43bd](bdb43bd))
* Stubs are created for referenced declarations in other packages ([#70](#70)) ([522f38d](522f38d)), closes [#66](#66)

### Bug Fixes

* Some packages couldn't be analyzed ([#51](#51)) ([fa3d020](fa3d020)), closes [#48](#48)
* Stub generation testing and fixing of miscellaneous bugs ([#76](#76)) ([97b0ab3](97b0ab3))
@lars-reimann
Copy link
Member

🎉 This issue has been resolved in version 0.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 💡 New feature or request released Included in a release
Projects
Status: ✔️ Done
Development

Successfully merging a pull request may close this issue.

2 participants