deepmodeling / DeePTB

DeePTB: A deep learning package for tight-binding approach with ab initio accuracy.
GNU Lesser General Public License v3.0
54 stars 16 forks source link

feat: update pyproject.toml and __init__.py to automatically get the version number. #160

Closed QG-phy closed 6 months ago

QG-phy commented 6 months ago

The version control is achieved by:

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

  1. in dptb.init.py:
    import importlib.metadata
    __version__ = importlib.metadata.version("dptb")

    to get the version number