Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify and improve controls of latest_version for version commands #207

Merged
merged 4 commits into from
May 8, 2024

Conversation

dave-connors-3
Copy link
Collaborator

closes #199

This PR improves the ergonomics of determining which version of a model should be marked as the latest_version when using the dbt-meshify version and dbt-meshify operation bump-version commands.

This PR does not change the default behavior:

Old behavior:

  • no flags: latest_version remains the same
  • --latest flag increments the latest_version by one

New Behavior:

  • no flags: latest_version remains the same
    - --increment (new flag!) increments the latest_version by one
  • --latest flag -- makes the newest, greatest integer'd version the latest_version, per @dbeatty10 's example in the issue.

@nicholasyager nicholasyager added the enhancement New feature or request label May 7, 2024
Copy link
Collaborator

@nicholasyager nicholasyager left a comment

Choose a reason for hiding this comment

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

@dave-connors-3 This is a really well crafted PR. I appreciate the considerate inclusion of the --incremental flag, which both preserves existing flags/docs, and provides the current functionality in the new flag. The use of enums and dicts is both necessary and sufficient for making this all work.

I have one minor non-blocking comment about an unnecessary tracing comment.

Otherwise, this should be good to go. Thanks for putting this together.

Comment on lines 393 to 397
if latest and increment:
raise FatalMeshifyException(
"Cannot specify both --latest and --prerelease. Please choose one or the other."
)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Good call 👍🏻

Comment on lines 20 to 26
class LatestVersionBehavior(str, Enum):
"""An operation describes the type of work being performed."""

Prerelease = "prerelease"
Increment = "increment"
Latest = "latest"

Copy link
Collaborator

Choose a reason for hiding this comment

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

Great use of enums!

dbt_meshify/utilities/versioner.py Outdated Show resolved Hide resolved

# import ipdb; ipdb.set_trace()

new_latest_version_number = latest_version_number_map[latest_version_behavior]
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is really clever. Great use of enums and dicts.

dbt_meshify/main.py Outdated Show resolved Hide resolved
dbt_meshify/main.py Outdated Show resolved Hide resolved
Co-authored-by: Nicholas A. Yager <[email protected]>
@dave-connors-3 dave-connors-3 merged commit 8f9f2cf into main May 8, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

latest_version is merely incremented instead of making the newest version the latest version.
2 participants