feat!: require an explicit fluid_name in encomp.gases (breaking)#27
Merged
Conversation
BREAKING CHANGE: the seven public functions in encomp.gases no longer default
fluid_name to "Air", and it is now keyword-only. Pass fluid_name="Air" explicitly to
keep the previous behavior:
mass_to_normal_volume(mass) -> mass_to_normal_volume(mass, fluid_name="Air")
convert_gas_volume(V, "N", condition) -> convert_gas_volume(V, "N", condition, fluid_name="Air")
This was the last implicit physical identity in the library -- the same anti-pattern
already removed from encomp.coolprop.fluid (which requires name=) and
convert_volume_mass (which requires a density). A guessed fluid does not raise, it
returns plausible numbers for the wrong gas, which is exactly why it may not be
guessed. Keyword-only rather than positional because a required parameter cannot
follow the defaulted condition arguments, and because it matches cp.fluid(name=...).
AGENTS.md records that no exceptions to the invariant remain.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Breaking change
encomp.gases' seven public functions no longer defaultfluid_nameto"Air", and the parameter is now keyword-only.ideal_gas_densityis unaffected (it never had a default).Affected:
convert_gas_volume,mass_to_normal_volume,mass_from_normal_volume,mass_to_actual_volume,mass_from_actual_volume,actual_volume_to_normal_volume,normal_volume_to_actual_volume.Why
This was the last implicit physical identity in the library. The same anti-pattern was already removed from
encomp.coolprop.fluid(which requiresname=) andconvert_volume_mass(which requires a density), andAGENTS.mdstates the invariant —encomp.gaseswas the standing exception, flagged by the 1.9.2 holistic review as "an inconsistency of concept".A guessed fluid does not fail loudly: it returns plausible numbers for the wrong gas.
mass_to_normal_volume(Q(1, "kg"))silently answered for air even when the caller meant methane (a ~1.8× difference), which is precisely why the identity may not be defaulted.Keyword-only rather than positional-with-no-default because a required parameter cannot follow the defaulted
condition_*arguments — and it matches thecp.fluid(..., name=...)spelling. It also means the name can never land in a condition parameter by position.Notes
README.md, encomp does not follow strict semantic versioning, and breaking changes are called out in the release notes instead.AGENTS.mdnow records that no exceptions to the invariant remain, so the next review doesn't re-flag it.Gates
pytest 1190 passed · pyright 0 errors · pyrefly 0 errors · ty clean · ruff clean.
🤖 Generated with Claude Code