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

Explore types for JS and Python. #30199

Closed
Abhirup-99 opened this issue Mar 12, 2022 · 4 comments
Closed

Explore types for JS and Python. #30199

Abhirup-99 opened this issue Mar 12, 2022 · 4 comments

Comments

@Abhirup-99
Copy link

Is your feature request related to a problem? Please describe.
We are a new company exploring the healthcare module. Types for the various Python and JS functions would have been of great help while exploring the codebase. Would be interested in pushing some types upstream while exploring the codebase more. I am more interested in the Python types at this point. We have a Go and TS codebase, so everything is typed.

Describe the solution you'd like
Python handler functions have types to get an idea of the default codebase.

Additional context
Explore mypy and the Zulip project for the types if interested.

@Abhirup-99
Copy link
Author

Abhirup-99 commented Mar 14, 2022

Documentation from the developer's perspective might be helpful here.

@ankush
Copy link
Member

ankush commented Mar 14, 2022

Fully typed code seems quite far-fetched since a lot of our code is very dynamic in nature.

I've attempted to automate some typing when using Document objects but that doesn't go far. (reference: frappe/frappe#13223 )

Another problem is all DB methods are also dynamic and can load from any specified table with any type of return value. Typing all this manually is very error-prone and will just add more maintenance than reducing it 😅


Regardless of this, we are doing "best efforts" to add type hints on new code and plain non-dynamic code like utilities so it helps improve DX (autocomplete, lints). This won't be taken up as a concentrated effort anytime soon, but we are aware of this. Closing for now.

@ankush ankush closed this as completed Mar 14, 2022
@ankush
Copy link
Member

ankush commented Mar 14, 2022

@ankush ankush mentioned this issue Mar 14, 2022
5 tasks
@Abhirup-99
Copy link
Author

Fully typed code seems quite far-fetched since a lot of our code is very dynamic in nature.

I've attempted to automate some typing when using Document objects but that doesn't go far. (reference: frappe/frappe#13223 )

Another problem is all DB methods are also dynamic and can load from any specified table with any type of return value. Typing all this manually is very error-prone and will just add more maintenance than reducing it sweat_smile

Regardless of this, we are doing "best efforts" to add type hints on new code and plain non-dynamic code like utilities so it helps improve DX (autocomplete, lints). This won't be taken up as a concentrated effort anytime soon, but we are aware of this. Closing for now.

I agree with the viewpoint. I think this can be better improved by having documentation from a developer's perspective. The frappe documentation is great and so is the documentation for the end-user. The JS frontend is using namespaces and is beautifully encapsulated, but you can understand the struggle from the developer aspect looking at things, not understanding where it is actually written. Side effects of inheritance and functions maybe :). Used console.trace at the end to get a hold of the entire thing.

https://zulip.readthedocs.io/en/latest/subsystems/index.html. Another codebase I had seen with great encapsulations. But this has a great corresponding documentation from developer perspective to understand it.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants