modify format jinja: format-jinja = """
{%- if distance == 0 -%}
{{ serialize_pep440(base, stage, revision) }}
{%- elif revision is not none -%}
{{ serialize_pep440(base, stage, revision + 1, dev=distance, metadata=[commit]) }}
{%- else -%}
{{ serialize_pep440(bump_version(base), stage, revision, dev=distance, metadata=[commit]) }}
{%- endif -%}
"""
Which have 3 cases: 1. if the commit version is consistent with the tag, then use the tag 2. If the revision (小版本) is not 0, and commit have some history, then new version will be x.x.x+1+devxxxxxxxx. 3. if the revision is 0, them the stage 中版本,will increase by 1 and the dev string will be added.
add [tool.poetry-dynamic-versioning.files.] tool to write out files _version.py
[tool.poetry-dynamic-versioning.files."dptb/_version.py"]
persistent-substitution = true
initial-content = """
These version placeholders will be replaced later during substitution.
version = "0.0.0"
__version_tuple__ = (0, 0, 0)
"""
This is achieved by the following method:
modify format jinja: format-jinja = """ {%- if distance == 0 -%} {{ serialize_pep440(base, stage, revision) }} {%- elif revision is not none -%} {{ serialize_pep440(base, stage, revision + 1, dev=distance, metadata=[commit]) }} {%- else -%} {{ serialize_pep440(bump_version(base), stage, revision, dev=distance, metadata=[commit]) }} {%- endif -%} """ Which have 3 cases: 1. if the commit version is consistent with the tag, then use the tag 2. If the revision (小版本) is not 0, and commit have some history, then new version will be x.x.x+1+devxxxxxxxx. 3. if the revision is 0, them the stage 中版本,will increase by 1 and the dev string will be added.
add [tool.poetry-dynamic-versioning.files.] tool to write out files _version.py [tool.poetry-dynamic-versioning.files."dptb/_version.py"] persistent-substitution = true initial-content = """
These version placeholders will be replaced later during substitution.
version = "0.0.0" __version_tuple__ = (0, 0, 0) """