Skip to content

Add typing to aiida.cmdline.params module #6952

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

Merged
merged 12 commits into from
Jul 21, 2025

Conversation

danielhollas
Copy link
Collaborator

@danielhollas danielhollas commented Jul 18, 2025

This will hopefully make it a little bit safer to depend click internals. I needed to add a bunch to type: ignore statements, but that's a better trafeoff than not checking these files at all.

Split from #6883

@@ -13,7 +13,7 @@
import click


def edit_multiline_template(template_name, comment_marker='#=', extension=None, **kwargs):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was an actual bug, extension cannot be None. It was not a bug in practice since this function is always being called with a extension parameter explicitly specified.

@danielhollas danielhollas requested review from unkcpz and khsrali July 18, 2025 16:49
Copy link

codecov bot commented Jul 18, 2025

Codecov Report

Attention: Patch coverage is 98.36066% with 1 line in your changes missing coverage. Please review.

Project coverage is 79.18%. Comparing base (81dd4df) to head (69b9e7d).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/aiida/cmdline/params/options/interactive.py 90.91% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6952      +/-   ##
==========================================
+ Coverage   79.16%   79.18%   +0.03%     
==========================================
  Files         566      566              
  Lines       43461    43476      +15     
==========================================
+ Hits        34400    34422      +22     
+ Misses       9061     9054       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@khsrali khsrali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @danielhollas
I left a few comments, just to understand.

Comment on lines +107 to +108
if self.name is None:
return value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to be related to typing, right? perhaps belongs to #6883 ?

Copy link
Collaborator Author

@danielhollas danielhollas Jul 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this early return I get this error:

src/aiida/cmdline/params/options/interactive.py:110: error: 
Argument 1 to "get_parameter_source" of "Context" has incompatible type "str | None"; expected "str"  [arg-type]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, alright let's keep it then 👍

Copy link
Contributor

@khsrali khsrali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @danielhollas
All good 👍

@danielhollas danielhollas merged commit cfb7fd1 into aiidateam:main Jul 21, 2025
18 checks passed
@danielhollas danielhollas deleted the cmdline-typing branch July 21, 2025 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants