Skip to content

Commit

Permalink
use setuptools-git-versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelchin committed Aug 26, 2024
1 parent 110a09b commit 205872c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
22 changes: 16 additions & 6 deletions gplately/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,17 @@
"""

__version__ = "1.3.0"

def get_distribution_version():
from importlib.metadata import PackageNotFoundError, version

try:
return version(__name__)
except PackageNotFoundError:
return "UNKNOWN VERSION"


__version__ = get_distribution_version()
REQUIRED_PMM_VERSION = "1.2.0"
USING_DEV_VERSION = True ## change this to False before official release

Expand All @@ -214,16 +224,16 @@
print()
print("##########################################################################")
print(
"""
f"""
WARNING:
You are using a DEV version GPlately. Some functionalities have not been tested thoroughly.
The DEV version may break your code or produce wrong results due to its unstable nature(DEV in progress).
You are using a DEV version 👉({__version__})👈 GPlately. Some functionalities have not been tested thoroughly.
The DEV version may break your code or produce wrong results due to its unstable nature (DEV in progress).
You might also need to install the DEV version plate_model_manager
from https://github.com/michaelchin/plate-model-manager to use this DEV version GPlately.
To disable this warning, set USING_DEV_VERSION to False in __init__.py or
🚫 To disable this warning, set USING_DEV_VERSION to False in __init__.py or
set DISABLE_GPLATELY_DEV_WARNING environment variable to true.
`export DISABLE_GPLATELY_DEV_WARNING=true`
👉`export DISABLE_GPLATELY_DEV_WARNING=true`👈
"""
)
print("##########################################################################")
Expand Down
9 changes: 6 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
[build-system]
requires = ["setuptools>=61.0.0", "wheel"]
requires = ["setuptools>=61.0.0", "wheel", "setuptools-git-versioning"]
build-backend = "setuptools.build_meta"

[tool.setuptools-git-versioning]
enabled = true

[project]
name = "gplately"
dynamic = ["version"]
Expand Down Expand Up @@ -42,8 +45,8 @@ where = ["."]
exclude = ['*.examples*','*.notebooks*','tests-dir*','Notebooks*', 'scripts*']
namespaces = true

[tool.setuptools.dynamic]
version = {attr = "gplately.__version__"}
#[tool.setuptools.dynamic]
#version = {attr = "gplately.__version__"}

[project.optional-dependencies]
dev = ["black", "bumpver", "isort", "pip-tools", "pytest"]
Expand Down
5 changes: 5 additions & 0 deletions tests-dir/unittest/test_plate_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
from common import MODEL_REPO_DIR
from plate_model_manager import PlateModelManager

import gplately

print(gplately.__version__)
print(gplately.__file__)


def main():
pm_manger = PlateModelManager()
Expand Down

0 comments on commit 205872c

Please sign in to comment.