Skip to content

Conversation

RonnyPfannschmidt
Copy link
Contributor

Fixes #1022

Allows version_keyword to properly override infer_version when user provides specific configuration like calver schemes, regardless of hook execution order.

… infer_version

This test demonstrates the bug where version_keyword with specific configuration
(like calver-by-date) doesn't properly override the version already set by
infer_version. The test intentionally fails to show the current behavior vs
the desired behavior where version_keyword should always win when it provides
additional configuration.

Test uses SETUPTOOLS_SCM_PRETEND_METADATA to ensure deterministic calver dates.
…en config differs

When infer_version sets a version first, version_keyword should be able to
override it if it brings additional configuration (like a different version_scheme).

This commit implements a marker system:
- infer_version sets _setuptools_scm_version_set_by_infer=True when it sets a version
- version_keyword checks this marker and:
  - If no overrides: uses infer_version result (no warning)
  - If overrides present: clears version and recalculates with new config
  - If version set by other means: warns as before

This allows proper integration behavior where version_keyword can override
infer_version when the user provides specific configuration like calver schemes.
@RonnyPfannschmidt RonnyPfannschmidt merged commit 0b59018 into pypa:main Aug 2, 2025
19 checks passed
@RonnyPfannschmidt RonnyPfannschmidt deleted the fix-1022-unittest-integration-order branch August 2, 2025 11:19
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.

use_scm_version sometimes used, sometimes not

1 participant