Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--version points to git hash and date #755

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ readme = "README.md"
license = {file = "LICENSE"}
keywords = ["ramalama", "llama", "AI"]

[build-system]
requires = ["setuptools", "setuptools_scm"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]

[project.urls]
Homepage = "https://github.com/containers/ramalama"
Documentation = "https://github.com/containers/ramalama/tree/main/docs"
Expand Down
19 changes: 6 additions & 13 deletions ramalama/version.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
import importlib.metadata

"""Version of RamaLamaPy."""

import setuptools_scm

def version():
try:
return importlib.metadata.version("ramalama")
except importlib.metadata.PackageNotFoundError:
return "0"

return "0"

"""Returns the package version dynamically from Git."""
return setuptools_scm.get_version()

def print_version(args):
print("ramalama version %s" % version())
def print_version(args=None):
"""Prints the current version of the package."""
print(f"ramalama version {version()}")
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def find_package_modules(self, package, package_dir):

setuptools.setup(
name="ramalama",
version="0.5.5",
use_scm_version=True,
packages=find_packages(),
cmdclass={"build_py": build_py},
scripts=["bin/ramalama"],
Expand Down
Loading