fix version check

This commit is contained in:
LUIS NOVO 2024-10-29 07:49:31 -03:00
parent df3efdecd8
commit 3ed82e2d80
2 changed files with 14 additions and 6 deletions

View file

@ -13,16 +13,12 @@ WORKDIR /app
RUN pip install poetry --no-cache-dir
RUN poetry self add poetry-plugin-dotenv
RUN poetry config virtualenvs.create false
COPY pyproject.toml poetry.lock* /app/
RUN poetry install --only main
#--no-root
COPY . /app
WORKDIR /app
RUN poetry install --only main
EXPOSE 8502
RUN mkdir -p /app/data
CMD ["poetry", "run", "streamlit", "run", "app_home.py"]

View file

@ -10,7 +10,18 @@ from open_notebook.utils import (
def version_sidebar():
with st.sidebar:
current_version = get_installed_version("open_notebook")
try:
current_version = get_installed_version(
"open-notebook"
) # Note the hyphen instead of underscore
except Exception:
# Fallback to reading directly from pyproject.toml
import tomli
with open("pyproject.toml", "rb") as f:
pyproject = tomli.load(f)
current_version = pyproject["tool"]["poetry"]["version"]
latest_version = get_version_from_github(
"https://www.github.com/lfnovo/open-notebook", "main"
)
@ -34,3 +45,4 @@ def setup_stream_state(session_id) -> None:
else:
st.session_state[session_id] = existing_state
st.session_state["active_session"] = session_id
st.session_state["active_session"] = session_id