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.

peotry version doesn't bump the value in __version__

See original GitHub issue
$ poetry version 0.1.1
Bumping version from 0.1.0 to 0.1.1
$ grep version pyproject.toml 
version = "0.1.1"
$ grep version */__init__.py
src/__init__.py:__version__ = '0.1.0'
$ poetry --version
Poetry 0.9.0

I don’t know if it’s intended or not. A way to do that safely is to parse the root __init__.py, detect __version__, back it up, extract the ast, bump the version string and replace it, then extract the new ast and compare the result. If both ast are the same, except for the version, the file semantics have been preserved. Otherwise, rollback the change and display an error message stating we can’t bump the version safely.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:46
  • Comments:72 (18 by maintainers)

github_iconTop GitHub Comments

76reactions
Victor-Savucommented, May 27, 2018

I really wish that the version field in the .toml ended up superseding the __version__ string in __init__.py. This would reduce the burden of having to keep multiple places in the code in sync.

53reactions
jgirardetcommented, May 27, 2018

you may use that

import toml
from pathlib import Path

def get_version():
   path = Path(__file__).resolve().parents[1] / 'pyproject.toml'
   pyproject = toml.loads(open(str(path)).read())
   return pyproject['tool']['poetry']['version']

__version__ = get_version()
Read more comments on GitHub >

github_iconTop Results From Across the Web

Commands | Documentation | Poetry - Python dependency ...
--no-update : Do not update locked versions, only refresh lock file. version #. This command shows the current version of the project or...
Read more >
Bump up version in Github workflow won't change the code
For bump up the patch version, I simply run poetry version patch . I moved this function to workflow and it won't change...
Read more >
bumpversion - PyPI
General configuration is grouped in a [bumpversion] section. current_version = no default value (required). The current version of the software package ...
Read more >
Python Semantic Release - Read the Docs
We rely on commit messages to detect when a version bump is needed. By default, Python Semantic Release uses the Angular style. You...
Read more >
Working on a project - Copier Poetry - pawamoy's website
You can run multiple tasks at once: poetry run duty TASK1 ARG=VALUE TASK2 . ... The chosen Python versions are defined in both...
Read more >

github_iconTop Related Medium Post

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