Skip to content

Commit

Permalink
feat: update pyproject.toml and __init__.py to automatically get the …
Browse files Browse the repository at this point in the history
…version number. (#160)

* Refactor plotting code in dftb2nnsk.py

* refactor(nnsk): Refactor NNSK class in nnsk.py to fix push_decay method and update push options

* update saver.py to save ckpt with name of ovlp

* fix: update nnsk from reference and change the sign of ovp_thr

* update saver.py

* update mos2 example

* Update test_sktb.py with new model weights and fix init_model path in test_md

* docs: Update dftb.md with hBN model training steps and fix formatting

* Refactor main.py to add version flag and handle unknown version

* Update pyproject.toml to add toml dependency

* update pyproject.toml and add -v command

* update ut.sh

* update unit_test.yml and ut.sh

* ci: update unit_test.yml

* ci: update unit_test.yml

* ci: update unit_test.yml

* ci: update unit_test.yml

* ci: update unit_test.yml

* ci: update unit_test.yml

* build(deps): update 2 files and delete 1 file

* ci: update devcontainer.yml

* ci: update devcontainer.yml

* ci: update devcontainer.yml

* ci: update devcontainer.yml

* ci: update devcontainer.yml

* back to main

* Update devcontainer.yml and unit_test.yml workflows
  • Loading branch information
QG-phy authored May 1, 2024
1 parent 32e1f4d commit ecd65a5
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 102 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/devcontainer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ on:
- 'docs/**'
branches:
- main
pull_request:
branches:
- main
paths:
- '.github/workflows/devcontainer.yml'
- '.github/workflows/unit_test.yml'

jobs:
build_container_and_push:
Expand All @@ -28,14 +22,14 @@ jobs:
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Login to Aliyun Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: registry.dp.tech
username: ${{ secrets.DP_HARBOR_USERNAME }}
Expand All @@ -50,4 +44,4 @@ jobs:
file: Dockerfile.${{ matrix.dockerfile }}
cache-from: type=registry,ref=ghcr.io/deepmodeling/deeptb-${{ matrix.dockerfile }}:latest
cache-to: type=inline
push: true
push: true
4 changes: 3 additions & 1 deletion .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
pull_request:
paths-ignore:
- 'docs/**'
- '.github/workflows/devcontainer.yml'

jobs:
build:
Expand All @@ -21,6 +20,9 @@ jobs:
with:
fetch-depth: 0
ref: "refs/pull/${{ github.event.number }}/merge"
- name: Add safe directory
run: |
git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Install DeePTB & Run Test
id: s2
run: |
Expand Down
5 changes: 3 additions & 2 deletions dptb/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from dptb.version import get_version as _get_version
__version__ = _get_version()
import importlib.metadata

__version__ = importlib.metadata.version("dptb")
10 changes: 4 additions & 6 deletions dptb/entrypoints/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,9 @@
from dptb.utils.loggers import set_log_handles
from dptb.utils.config_check import check_config_train
from dptb.entrypoints.collectskf import skf2pth
from dptb.version import get_version
from dptb import __version__


try:
version = get_version()
except:
version = "unknown"

def get_ll(log_level: str) -> int:
"""Convert string to python logging level.
Expand Down Expand Up @@ -48,7 +45,8 @@ def main_parser() -> argparse.ArgumentParser:
)

parser.add_argument('-v', '--version',
action='version', version=f'%(prog)s {version}', help="show the DeepTB's version number and exit")
action='version', version=f'%(prog)s {__version__}', help="show the DeepTB's version number and exit")


subparsers = parser.add_subparsers(title="Valid subcommands", dest="command")

Expand Down
76 changes: 0 additions & 76 deletions dptb/version.py

This file was deleted.

16 changes: 8 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ torch_scatter = "2.1.2"
torch_geometric = ">=2.4.0"
opt-einsum = "3.3.0"
h5py = "3.7.0"
toml="*"


[tool.poetry.group.dev.dependencies]
Expand All @@ -51,7 +50,6 @@ torch_scatter = "2.1.2"
torch_geometric = ">=2.4.0"
opt-einsum = "3.3.0"
h5py = "3.7.0"
toml="*"


[tool.poetry.group.3Dfermi]
Expand All @@ -78,13 +76,15 @@ build-backend = "poetry_dynamic_versioning.backend"


[tool.poetry-dynamic-versioning]
enable = false
enable = true
vcs = "git"
strict = true
format-jinja = """
{%- if distance == 0 -%}
{{ serialize_pep440(base) }}
{%- else -%}
{{serialize_pep440(bump_version(base, index=1), dev=timestamp)}}
{%- endif -%}
{%- 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 -%}
"""

0 comments on commit ecd65a5

Please sign in to comment.