Skip to content

Commit

Permalink
Add version option to cli and dynamic versioning (linkml#144)
Browse files Browse the repository at this point in the history
* Add version option to cli and dynamic versioning

* Set same auto-versioning style as in LinkML
  • Loading branch information
dalito authored Aug 19, 2024
1 parent 168936d commit 2ae9ba2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,13 @@ lxml = ">=4.9.1"
llm = ">=0.12"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
build-backend = "poetry_dynamic_versioning.backend"

[tool.poetry-dynamic-versioning]
enable = true
vcs = "git"
style = "pep440"

[tool.poetry.scripts]
schemauto = "schema_automator.cli:main"
Expand Down
8 changes: 8 additions & 0 deletions schema_automator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
from importlib import metadata

from schema_automator.annotators import *
from schema_automator.importers import *
from schema_automator.generalizers import *

try:
__version__ = metadata.version(__package__)
except metadata.PackageNotFoundError:
# package is not installed
__version__ = "0.0.0" # pragma: no cover
2 changes: 2 additions & 0 deletions schema_automator/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from schema_automator.importers.sql_import_engine import SqlImportEngine
from schema_automator.importers.tabular_import_engine import TableImportEngine
from schema_automator.utils.schemautils import write_schema
from schema_automator import __version__

input_option = click.option(
"-i",
Expand Down Expand Up @@ -80,6 +81,7 @@
help="Set the level of verbosity")
@click.option("-q", "--quiet",
help="Silence all diagnostics")
@click.version_option(__version__, "-V", "--version")
def main(verbose: int, quiet: bool):
"""Run the LinkML Schema Automator Command Line.
Expand Down

0 comments on commit 2ae9ba2

Please sign in to comment.