Skip to content

Conversation

@matham
Copy link
Contributor

@matham matham commented Jun 17, 2025

Description

What is this PR

  • Bug fix
  • Addition of a new feature
  • Other

Why is this PR needed?

Some argparse parameters in workflows accept a string or None. E.g. torch_device. This adds support for providing none or None as input in argparse and converts it to None.

Similarly, it makes the float and int functions also accept them.

If users don't provide those arg, these args will typically default to None. But sometimes, you may want to explicitly provide the arg, but set it to None. Or if you programmatically set the arg when calling the command line in a script, you may want to be able to always set the arg. Presently, if you wanted the default None, you'd need to have dropped that parameter.

What does this PR do?

Adds the string parser and makes str, int, and float accept none and it's variations as explicit values, instead of only allowing it from the default value.

References

This is required for brainglobe/brainglobe-workflows#150.

How has this PR been tested?

I tested it locally.

Is this a breaking change?

No, it only expands input.

Does this PR require an update to the documentation?

No.

Checklist:

  • The code has been tested locally
  • Tests have been added to cover all new functionality (unit & integration)
  • The documentation has been updated to reflect any changes
  • The code has been formatted with pre-commit

@codecov
Copy link

codecov bot commented Jun 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.76%. Comparing base (c681d3e) to head (dc3a149).
⚠️ Report is 31 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #128      +/-   ##
==========================================
+ Coverage   92.65%   92.76%   +0.10%     
==========================================
  Files          33       33              
  Lines        1730     1755      +25     
==========================================
+ Hits         1603     1628      +25     
  Misses        127      127              
Flag Coverage Δ
numba 92.70% <100.00%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@matham matham marked this pull request as ready for review November 25, 2025 21:25
Copy link
Member

@alessandrofelder alessandrofelder left a comment

Choose a reason for hiding this comment

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

No notes from me - thanks @matham (Sorry it took me so long to look at this!!)

@alessandrofelder alessandrofelder merged commit a086f6e into brainglobe:main Jan 21, 2026
13 checks passed
@matham matham deleted the args branch January 21, 2026 20:30
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

Successfully merging this pull request may close these issues.

2 participants