Skip to content

Conversation

@Chaffelson
Copy link
Owner

extract parse_bool() utility for CLI boolean parameter handling

Addresses #397 - Extract boolean parsing logic from getenv_bool() into a reusable parse_bool() utility function.

Changes:

  • Add parse_bool() to nipyapi/utils.py for handling CLI boolean parameters where fire passes --flag=false as string 'false'
  • Refactor getenv_bool() to use parse_bool() internally
  • Remove duplicate _env_bool() from ci/cleanup.py and ci/stop_flow.py
  • Update ci/configure_inherited_params.py to use parse_bool()
  • Update docs/contributing.rst CLI Boolean Parameters section with examples
  • Add comprehensive TestParseBool test class in test_utils.py
  • Remove obsolete TestEnvBool from test_ci.py (covered by new tests)

The parse_bool() function handles:

  • String values: 'false', '0', 'no', 'off', 'n' -> False
  • String values: 'true', '1', 'yes', 'on', 'y' -> True
  • Bool passthrough: True/False unchanged
  • None handling with default parameter
  • Other types: uses Python truthiness

…ling

Addresses #397 - Extract boolean parsing logic from getenv_bool() into a
reusable parse_bool() utility function.

Changes:
- Add parse_bool() to nipyapi/utils.py for handling CLI boolean parameters
  where fire passes --flag=false as string 'false'
- Refactor getenv_bool() to use parse_bool() internally
- Remove duplicate _env_bool() from ci/cleanup.py and ci/stop_flow.py
- Update ci/configure_inherited_params.py to use parse_bool()
- Update docs/contributing.rst CLI Boolean Parameters section with examples
- Add comprehensive TestParseBool test class in test_utils.py
- Remove obsolete TestEnvBool from test_ci.py (covered by new tests)

The parse_bool() function handles:
- String values: 'false', '0', 'no', 'off', 'n' -> False
- String values: 'true', '1', 'yes', 'on', 'y' -> True
- Bool passthrough: True/False unchanged
- None handling with default parameter
- Other types: uses Python truthiness
@Chaffelson Chaffelson self-assigned this Jan 7, 2026
@codecov
Copy link

codecov bot commented Jan 7, 2026

Codecov Report

❌ Patch coverage is 83.33333% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.46%. Comparing base (0716aee) to head (d268af4).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
nipyapi/ci/cleanup.py 60.00% 4 Missing ⚠️
nipyapi/ci/configure_inherited_params.py 75.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #401   +/-   ##
=======================================
  Coverage   76.45%   76.46%           
=======================================
  Files          41       41           
  Lines        4732     4734    +2     
=======================================
+ Hits         3618     3620    +2     
  Misses       1114     1114           

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

@ottobackwards ottobackwards left a comment

Choose a reason for hiding this comment

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

lgtm!

@Chaffelson Chaffelson merged commit 56d2e1e into main Jan 8, 2026
12 checks passed
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.

3 participants