Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Feat/version info #1639

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

Open
woile wants to merge 2 commits into master
base: master
Choose a base branch
Loading
from feat/version-info
Open

Feat/version info #1639

woile wants to merge 2 commits into master from feat/version-info

Conversation

@woile
Copy link
Member

@woile woile commented Oct 30, 2025
edited
Loading

Description

Allow the ability to just print major or minor from a version when using cz version -p.

This is useful, because under some scenarios, users may need just a chunk of the version. Example:

  • github actions recommend using a vX tag, where X is the major, this tag is moved to the latest commit usually.
  • docker image tags
  • api versioning
  • go modules

Checklist

Code Changes

  • Add test cases to all the changes you introduce
  • Run poetry all locally to ensure this change passes linter check and tests
  • Manually test the changes:
    • Verify the feature/bug fix works as expected in real-world scenarios
    • Test edge cases and error conditions
    • Ensure backward compatibility is maintained
  • Update the documentation for the changes

Documentation Changes

  • Run poetry doc locally to ensure the documentation pages renders correctly

Expected Behavior

cz version -p major should render the major part only

cz version -p minor should render the minor part only

Closes #1638

Copy link
Member Author

woile commented Oct 30, 2025

how am I supposed to fix Run codespell to check for common misspellings in files?

Copy link
Member

Lee-W commented Oct 30, 2025

I usually use pre-commit run codespell --all-files

woile reacted with heart emoji

Copy link
Member Author

woile commented Oct 31, 2025

Fixed! 🤞🏻

Lee-W reacted with thumbs up emoji

@Lee-W Lee-W added this to the 4.10.0 milestone Nov 2, 2025
Copy link

codecov bot commented Nov 4, 2025
edited
Loading

Codecov Report

❌ Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.18%. Comparing base (120d514) to head (7ca2b16).
⚠️ Report is 807 commits behind head on master.

Files with missing lines Patch % Lines
commitizen/commands/version.py 84.61% 2 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@
## master #1639 +/- ##
==========================================
+ Coverage 97.33% 98.18% +0.85% 
==========================================
 Files 42 58 +16 
 Lines 2104 2706 +602 
==========================================
+ Hits 2048 2657 +609 
+ Misses 56 49 -7 
Flag Coverage Δ
unittests 98.18% <84.61%> (+0.85%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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


try:
version_scheme = get_version_scheme(self.config.settings)
except VersionSchemeUnknown:
Copy link
Member Author

Choose a reason for hiding this comment

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

@Lee-W do you think I need this try/catch here? If get_version_scheme fails, then VersionSchemeUnknown would be propagated and properly displayed by commitizen_excepthook, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@Lee-W Lee-W Awaiting requested review from Lee-W Lee-W is a code owner

@noirbizarre noirbizarre Awaiting requested review from noirbizarre noirbizarre is a code owner

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

Projects

None yet

Milestone

4.10.0

Development

Successfully merging this pull request may close these issues.

Cannot install the project because of poetthepoet

3 participants

AltStyle によって変換されたページ (->オリジナル) /