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

What should be the role of idbstubs? #2

Closed
WMOkiishi opened this issue Nov 28, 2022 · 3 comments
Closed

What should be the role of idbstubs? #2

WMOkiishi opened this issue Nov 28, 2022 · 3 comments

Comments

@WMOkiishi
Copy link
Owner

Currently, things are set up such that every file in src/panda3d-stubs, except for interrogatedb.pyi and dtoolconfig.pyi, is written by running idbstubs, then formatted with Black. Changes to idbstubs affecting the output are accompanied by the changes resulting from rewriting those stubs.

I'm uncertain whether this is the best way to do things, though.

One alternative is to treat idbstubs more like Mypy's stubgen, which writes templates for stubs that can be expanded on. This would have the benefits of simplifying idbstubs (special_cases.py could be almost entirely eliminated) and not requiring it and Black to be re-run every time panda3d-stubs needs to be modified.

Another alternative would be to move in the opposite direction. idbstubs could be made to do more of the formatting Black does by itself, negating the need to run Black as often in a different way. This would have the benefit of simplifying the relationship between idbstubs and panda3d-stubs, as well as possibly removing the need to store the latter in the repository. (If this approach were taken, idbstubs would probably also be modified to write the stubs for interrogatedb and dtoolconfig.)

The current setup is not without merit, though. It compromises between simple code in idbstubs and a simple workflow for changing panda3d-stubs. It also means that updating those stubs for a new version of Panda3D is mostly automatic, a benefit shared with the second alternative.

There may be more routes that could be taken, and I am open to suggestions and examples of other projects that have dealt with similar decisions.

@WMOkiishi WMOkiishi reopened this Dec 22, 2022
@WMOkiishi
Copy link
Owner Author

(I made a typo and closed the wrong issue.)

@WMOkiishi
Copy link
Owner Author

As of d699a95 and 73d642f, idbstubs matches most of the formatting Black does while writing the stubs.

@WMOkiishi
Copy link
Owner Author

Since psf/black#3564 is available as part of the preview style in the latest release of Black, idbstubs formats the stubs the same way Black would as of 24e1a56. This means I have effectively settled on the second option presented in the initial issue. I have no plans to remove the stubs from the repository, though, as it's helpful to see how they're affected by external changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant