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

Implement the use of function annotations #91

Open
1 of 4 tasks
MicahGale opened this issue Jun 29, 2022 · 6 comments
Open
1 of 4 tasks

Implement the use of function annotations #91

MicahGale opened this issue Jun 29, 2022 · 6 comments
Labels
code improvement A feature request that will improve the software and its maintainability, but be invisible to users. good first issue Good for newcomers
Milestone

Comments

@MicahGale
Copy link
Collaborator

The following discussion from !37 should be addressed:

  • @MicahGale started a discussion:

    Mostly for myself: function annotations were added by PEP 3107 in python 3.0. That's an old enough feature that we can safely use it.

    I think we need to standardize our use of them.

    Can you open an issue to come up with a function annotation convention we will use, and discuss possible type enforcement. I do not want to add any external dependencies through this or require bleeding edge python installations.

Tasks:

  • Create standardized function annotation style guide
  • Investigate type enforcement/ coercion
  • implement for all functions
@MicahGale
Copy link
Collaborator Author

In GitLab by @tjlaboss on Jul 21, 2022, 14:50

Opinion: Type enforcement/coercion should not be done here. Coercion can still be used on a case-by-case basis, not part of a broad function annotation and type hinting update.

If there is a function annotation style guide for mcnpy, I can probably tackle the implementation between other tasks.

@MicahGale
Copy link
Collaborator Author

So are you in favor of just using typing notations as purely a developer/ user assistant?

Any good resources for developing a style guide?

@MicahGale
Copy link
Collaborator Author

marked the checklist item @MicahGale started a discussion: as completed

@MicahGale
Copy link
Collaborator Author

https://github.com/Instagram/MonkeyType This tool that @tjlaboss found could help with automating most of the work.

@MicahGale
Copy link
Collaborator Author

Oh right this issue is a little different now since the introduction of make_prop_pointer and make_prop_value_node has removed most of the property boiler plate type enforcement.

I think we are now at a stage that using this as a type enforcement scheme is unnecessary, but is just syntax sugar to help make it more usable for the end user.

@MicahGale
Copy link
Collaborator Author

As part of #559 and #507 type hints are now the standard.

The migration is on a rolling basis right now. This means:

  1. All new PRs are expected to use type hints
  2. at some point we will need to go back and add type hints for all functions.
  3. static typing enforcement is an open question that may be enforced in the future. For now the idea is to provide the information needed for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code improvement A feature request that will improve the software and its maintainability, but be invisible to users. good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant