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

ENH: Support for type hints #444

Closed
Gui-FernandesBR opened this issue Oct 28, 2023 · 1 comment
Closed

ENH: Support for type hints #444

Gui-FernandesBR opened this issue Oct 28, 2023 · 1 comment
Labels
Docs Docs and examples related Enhancement New feature or request, including adjustments in current codes

Comments

@Gui-FernandesBR
Copy link
Member

Is your feature request related to a problem? Please describe.

Type hints were a great addition of Python 3.5 (https://docs.python.org/3/library/typing.html), and it has been improved in the latest python 3.12 version (https://docs.python.org/3/whatsnew/3.12.html). Here are some points to consider:

  • Type hints improve code readability as it makes clear what are the expected values.
  • Enhances static type checking (mypy) to prevent potential errors before execution.
  • IDEs can use these type hints and this can extremely help you when coding.
  • It's easier to review a code when you know exactly the expected types of each argument (we add docstrings for this same reason).
  • All of these provide a better development experience

Describe the solution you'd like

  • There are some solutions on the market that would allow us to automatically generate the type annotations for all the functions, for example, https://github.com/Instagram/MonkeyType
  • Also, mypy could be used to check the annotations as a linter.
  • We should implement type hints in every single function or method. This would be a long process, so I'd say we should introduce this gradually, maybe opening PRs class by class to allow better .
  • Ideally, every new function added to the code should have type hints, ensuring we achieve a good support for type hints.

Additional context

  • Discussion needed here.
  • Type hints do not ensure you're code is free of errors, so it is not a "pill of safety" for users. That's why I think this could benefit devs more than users.
  • For a simplified introduction to type hints, see PEP 483
@Gui-FernandesBR Gui-FernandesBR changed the title Support for type hints ENH: Support for type hints Oct 30, 2023
@Gui-FernandesBR Gui-FernandesBR added this to the Release v1.X.0 milestone Oct 30, 2023
@Gui-FernandesBR Gui-FernandesBR added Enhancement New feature or request, including adjustments in current codes Docs Docs and examples related labels Oct 30, 2023
@Gui-FernandesBR
Copy link
Member Author

We decided to not adopt type hints and annotations in this repository as they would create a need for maintenance that is higher than the benefit.

We prefer to exhaustively document our code with doc string, which allows for a good documentation page as well.

Can be re-discussed in the future.

@Gui-FernandesBR Gui-FernandesBR closed this as not planned Won't fix, can't repro, duplicate, stale Nov 19, 2023
@github-project-automation github-project-automation bot moved this from Backlog to Closed in LibDev Roadmap Nov 19, 2023
Gui-FernandesBR pushed a commit that referenced this issue Aug 22, 2024
Fix code style issues with Black

BUG: fixing var and std swap mistake in calculations

BUG: fixing incorrect print of regressions coefficients on summary table.

DOC: adding sensitivity analysis data and simulation notebook.

DOC: expanded sensitivity analysis usage notebook

ENH: introducing ImportanceModel class for parameter importance analysis

MNT: adding imports and renaming analysis folder

ENH: implementing plot to ImportanceModel and fixing estimation/import errors

ENH: implementing summary method to ImportanceModel

MNT: adding optional requirements for ImportanceModel

MNT: using optional import tools and adding sensitivity dependency install to setup.py

MNT: renaming the term 'importance' to 'sensitivity' in variables, files, and folders

MNT: Improving doc and input validation.

ENH: implementing function in tools to extract data from MonteCarlo simulation's.

MNT: adding json dependency to tools.py

MNT: removing type hints for consistency with codebase (#444)

MNT: applying review suggestions to sensitivity analysis.

BUG: fixing var and std swap mistake in calculations
Gui-FernandesBR pushed a commit that referenced this issue Aug 25, 2024
Fix code style issues with Black

BUG: fixing var and std swap mistake in calculations

BUG: fixing incorrect print of regressions coefficients on summary table.

DOC: adding sensitivity analysis data and simulation notebook.

DOC: expanded sensitivity analysis usage notebook

ENH: introducing ImportanceModel class for parameter importance analysis

MNT: adding imports and renaming analysis folder

ENH: implementing plot to ImportanceModel and fixing estimation/import errors

ENH: implementing summary method to ImportanceModel

MNT: adding optional requirements for ImportanceModel

MNT: using optional import tools and adding sensitivity dependency install to setup.py

MNT: renaming the term 'importance' to 'sensitivity' in variables, files, and folders

MNT: Improving doc and input validation.

ENH: implementing function in tools to extract data from MonteCarlo simulation's.

MNT: adding json dependency to tools.py

MNT: removing type hints for consistency with codebase (#444)

MNT: applying review suggestions to sensitivity analysis.

BUG: fixing var and std swap mistake in calculations
Gui-FernandesBR pushed a commit that referenced this issue Aug 25, 2024
Fix code style issues with Black

BUG: fixing var and std swap mistake in calculations

BUG: fixing incorrect print of regressions coefficients on summary table.

DOC: adding sensitivity analysis data and simulation notebook.

DOC: expanded sensitivity analysis usage notebook

ENH: introducing ImportanceModel class for parameter importance analysis

MNT: adding imports and renaming analysis folder

ENH: implementing plot to ImportanceModel and fixing estimation/import errors

ENH: implementing summary method to ImportanceModel

MNT: adding optional requirements for ImportanceModel

MNT: using optional import tools and adding sensitivity dependency install to setup.py

MNT: renaming the term 'importance' to 'sensitivity' in variables, files, and folders

MNT: Improving doc and input validation.

ENH: implementing function in tools to extract data from MonteCarlo simulation's.

MNT: adding json dependency to tools.py

MNT: removing type hints for consistency with codebase (#444)

MNT: applying review suggestions to sensitivity analysis.

BUG: fixing var and std swap mistake in calculations
Gui-FernandesBR pushed a commit that referenced this issue Sep 8, 2024
Fix code style issues with Black

BUG: fixing var and std swap mistake in calculations

BUG: fixing incorrect print of regressions coefficients on summary table.

DOC: adding sensitivity analysis data and simulation notebook.

DOC: expanded sensitivity analysis usage notebook

ENH: introducing ImportanceModel class for parameter importance analysis

MNT: adding imports and renaming analysis folder

ENH: implementing plot to ImportanceModel and fixing estimation/import errors

ENH: implementing summary method to ImportanceModel

MNT: adding optional requirements for ImportanceModel

MNT: using optional import tools and adding sensitivity dependency install to setup.py

MNT: renaming the term 'importance' to 'sensitivity' in variables, files, and folders

MNT: Improving doc and input validation.

ENH: implementing function in tools to extract data from MonteCarlo simulation's.

MNT: adding json dependency to tools.py

MNT: removing type hints for consistency with codebase (#444)

MNT: applying review suggestions to sensitivity analysis.

BUG: fixing var and std swap mistake in calculations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Docs and examples related Enhancement New feature or request, including adjustments in current codes
Projects
Status: Closed
Development

No branches or pull requests

1 participant