Open
Conversation
Update __init__.py
Robustness fixes in str_utils.py: - Strip leading/trailing whitespace from string inputs - Accept bool inputs directly (pass-through True/False) - Accept int inputs: 1→True, 0→False; other ints are invalid - Raise TypeError for unsupported types (float, list, etc.) - Fix str2bool_exc(None): now raises ValueError instead of silently returning None, consistent with the function's contract Testing: - Add tests/test_str_utils.py with 76 tests covering all inputs, edge cases, error messages, and both str2bool / str2bool_exc Packaging: - Add pyproject.toml (PEP 517/518); keep setup.py for CI version injection from git tags - Update README: correct import examples, document new behaviour, add API reference table CI/CD: - Add matrix test job across Python 3.8–3.12 before build/publish - Gate build on tests passing; gate publish on build - Bump actions/checkout, setup-python, upload/download-artifact to latest versions (v4/v5) - Trigger tests on push to master and all pull requests, not just tags https://claude.ai/code/session_017rKszX11QmRRdhMhBf9vCu
Replaced non-existent 'setuptools.backends.legacy:build' with the correct 'setuptools.build_meta' backend. Also moved version to dynamic (provided by setup.py) to avoid duplicate-version conflict between pyproject.toml and setup.py. https://claude.ai/code/session_017rKszX11QmRRdhMhBf9vCu
Value sets: - Add 'on'/'off' and 'enabled'/'disabled' to TRUE_VALUES/FALSE_VALUES - Rename TRUE_SET/FALSE_SET → TRUE_VALUES/FALSE_VALUES (public, frozenset) - Export TRUE_VALUES and FALSE_VALUES via __init__.__all__ Refactor: - Extract _parse() — single place for all type-dispatch logic; both str2bool() and any future callers share it without duplication - Pre-compute _VALID string once at import time (was rebuilt on every raise_exc call) - _MISSING sentinel object cleanly separates 'unrecognized' from False/None return values - _Input type alias removes the repeated Optional[Union[str,bool,int]] Tests: 105 tests (up from 76), covering new values, public constants, frozenset immutability, and disjoint-set invariant https://claude.ai/code/session_017rKszX11QmRRdhMhBf9vCu
setup.py / pyproject.toml — single version source of truth:
- setup.py now always passes a version to setup() with a fallback
default, eliminating the ambiguous no-version code path when
PACKAGE_VERSION is unset (fixes the dual-declaration conflict noted
in review)
- Add Python 3.13 / 3.14 classifiers to pyproject.toml
CI (workflows.yml):
- Extend test matrix to include Python 3.13 and 3.14
Tests (109, up from 105):
- test_none_raises_value_error: add match="Cannot convert None to bool"
to lock in the user-facing error message
- Add four whitespace-only input tests (' ', '\t\n') covering the
default return, custom default, and raise_exc paths
https://claude.ai/code/session_017rKszX11QmRRdhMhBf9vCu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.