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

Implementation of new object-oriented API doesn't play nice with VS Code #1112

Open
tilmantroester opened this issue Jul 21, 2023 · 0 comments

Comments

@tilmantroester
Copy link
Contributor

I like OOP but playing around with the new API I found that it doesn't play nice with editors. In the example

cosmo = ccl.CosmologyVanillaLCDM()
cosmo.angular_cl

VS Code recognises that cosmo.angular_cl is a function but seems unable to infer the signature or access the docstring. If the current method to inject the functions as methods start working with tooltips, I think we should amend the docstring to explicitly state that the method is injected into the Cosmology object and the original function can be found in some other place.

For developers, cases like https://github.com/LSSTDESC/CCL/blob/master/pyccl/cosmology.py#L517 are confusing, since ctrl+f for "get_camb_pk_lin" does not yield any results in cosmology.py, even though one would expect that from it being used as a method of Cosmology.
Internally I'd avoid this kind of dynamically created APIs to keep the code easy to read and maintain.

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