diff --git a/.gitignore b/.gitignore index b9cff1a..c6741ae 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,9 @@ src/.streamlit/secrets.toml # uv .venv/ .python-version + +# setuptools +*.egg-info/ __pycache__/ *.py[cod] *$py.class diff --git a/Dockerfile b/Dockerfile index d72f92a..d0b222e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,6 +7,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libpq-dev \ gcc \ curl \ + git \ && apt-get clean && rm -rf /var/lib/apt/lists/* # Install uv @@ -18,6 +19,7 @@ WORKDIR /app # Copy pyproject.toml and README.md for dependency installation COPY pyproject.toml ./ COPY README.md ./ +COPY .git .git # Install dependencies using uv (generate lock file during build) RUN uv sync diff --git a/pyproject.toml b/pyproject.toml index 25ef385..f840523 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,10 @@ [build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" +requires = ["setuptools>=61", "setuptools-scm>=8.0"] +build-backend = "setuptools.build_meta" [project] name = "analysis-dashboard" -version = "0.1.0" +dynamic = ["version"] description = "Analysis dashboard for OCF forecasting systems" readme = {file = "README.md", content-type = "text/markdown"} requires-python = ">=3.12.0,<3.13" @@ -72,3 +72,6 @@ python_files = ["test_*.py"] python_classes = ["Test*"] python_functions = ["test_*"] pythonpath = ["src"] + +[tool.setuptools_scm] +local_scheme = "no-local-version" diff --git a/src/main.py b/src/main.py index c4cec02..dac6d65 100644 --- a/src/main.py +++ b/src/main.py @@ -37,6 +37,13 @@ from adjuster import adjuster_page from batch_page import batch_page +from importlib.metadata import PackageNotFoundError, version + +try: + __version__ = version("analysis-dashboard") +except PackageNotFoundError: + __version__ = "v?" + st.get_option("theme.primaryColor") st.set_page_config(layout="wide", page_title="OCF Dashboard") @@ -252,7 +259,7 @@ def metric_page(): def main_page(): - st.text('This is the Analysis Dashboard UK. Please select the page you want from the menu at the top of this page') + st.text(f'This is the Analysis Dashboard UK v{__version__}. Please select the page you want from the menu at the top of this page') if check_password(): diff --git a/src/main_india.py b/src/main_india.py index 782247d..fffa17e 100644 --- a/src/main_india.py +++ b/src/main_india.py @@ -16,11 +16,18 @@ from weather_graph import weather_graph_page from batch_page import batch_page +from importlib.metadata import PackageNotFoundError, version + +try: + __version__ = version("analysis-dashboard") +except PackageNotFoundError: + __version__ = "v?" + st.get_option("theme.primaryColor") st.set_page_config(layout="wide", page_title="OCF Dashboard") def main_page(): - st.text('This is the Analysis Dashboard India. Please select the page you want on the left hand side') + st.text(f'This is the Analysis Dashboard India v{__version__}. Please select the page you want on the left hand side') if check_password():