question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"semantic-release version" not updating pyproject.toml or git tag

See original GitHub issue

The problem

I’m using PSR (v7.29.2) with poetry and when running semantic-release version I receive the following output:

Creating new version
Current version: 0.1.0, Current release version: 0.2.0

However, the pyproject.toml file still has version = "0.1.0" and no new tags are generated. Per the docs, this should “Figure out the new version number, update and commit it, and create a tag.”, but seemingly nothing is happening except the new version determination. No warnings or errors are observed using -v WARNING or -v ERROR, respectively.

Expected behavior

I expected the version number to be updated to 0.2.0 in pyproject.toml, a new tag to be generated, and the change to be committed.

Also, per https://py-pkgs.org/07-releasing-versioning I expected to the following output:

Creating new version
Current version: 0.1.0
Bumping with a minor version to 0.2.0

Maybe that is no longer expected output, but at least expecting notification of bump.

Additional context

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:5
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
aborsucommented, Jul 7, 2022

Hello, we’re having issues when adding new projects that already have a non 0.0.0 version but didn’t create commits with the version number. get_current_release_version_by_commits returns 0.0.0

We get this in the logs:

debug: get_current_release_version_by_commits -> 0.0.0
Current version: 1.0.0, Current release version: 0.0.0
...
debug: evaluate_version_bump('0.0.0', None)
debug: Reference v0.0.0 does not exist, considering entire history
...
debug: Commits found since last release: 136
debug: evaluate_version_bump -> patch
debug: get_new_version('1.0.0', '0.0.0', 'patch', False)
error: Error: Current version 1.0.0 and current release version 0.0.0 do not match!

I don’t have time to debug further so we’re rolling back to 7.28.1 for now.

2reactions
kieruncommented, Jul 22, 2022

@bheijden Your explanation seems correct. I have a commit with pip: bump types-requests from 2.28.0 to 2.28.2 (#23) from dependabot. It is indeed the 2.28.0 that semantic-release publish -v debug --noop picks up:

debug: get_current_version_by_config_file()
debug: Regex matched version: 0.0.1
debug: get_current_version_by_config_file -> 0.0.1
debug: get_current_release_version_by_commits()
[…]
debug: Commits found since last release: 31
debug: evaluate_version_bump -> minor
debug: get_new_version(0.0.1, '2.28.0', 'minor', False)
error: Error: Current version 0.0.1 and current release version 2.28.0 do not match!

I am using python-semantic-release 7.29.6.

Downgrading to 7.28.0 allows the operation to proceed as expected.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"semantic-release version" not updating pyproject.toml or git tag
However, the pyproject.toml file still has version = "0.1.0" and no new tags are generated. Per the docs, this should "Figure out the...
Read more >
Configuration — python-semantic-release 7.32.2 documentation
pyproject.toml file in a [tool.semantic_release] section ... If set to tag , will get the current version from the latest tag matching vX.Y.Z...
Read more >
Semantic Release example to Pypi with GitHub Actions
I used version_variable , version_toml , and version_pattern to define all the places either in Python, toml, or md that I wanted to...
Read more >
Troubleshooting - semantic-release
release not found release branch after git push --force · 1. Delete the tag(s) for the release(s) that have been lost from the...
Read more >
Semantic release with Python, Poetry & GitHub Actions
TL;DR · Set the same version number in pyproject.toml and __init__.py . For example: ./pyproject.toml · Add Semantic Release section to pyproject.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found