Merge pull request #40 from lfnovo/uv
Change from poetry to uv and fix elevenlabs bug
This commit is contained in:
commit
d731153a0a
15 changed files with 4443 additions and 6526 deletions
21
Dockerfile
21
Dockerfile
|
|
@ -1,9 +1,13 @@
|
|||
# Use an official Python runtime as a base image
|
||||
FROM python:3.11.7-slim-bullseye
|
||||
# Use Python 3.11 slim image as base
|
||||
FROM python:3.11-slim-bookworm
|
||||
|
||||
# Install uv using the official method
|
||||
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
||||
|
||||
|
||||
# Install system dependencies required for building certain Python packages
|
||||
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
|
||||
gcc \
|
||||
gcc git \
|
||||
libmagic-dev \
|
||||
ffmpeg \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
|
@ -11,16 +15,11 @@ RUN apt-get update && apt-get upgrade -y && apt-get install -y \
|
|||
# Set the working directory in the container to /app
|
||||
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
|
||||
|
||||
COPY . /app
|
||||
|
||||
RUN uv sync
|
||||
EXPOSE 8502
|
||||
|
||||
RUN mkdir -p /app/data
|
||||
|
||||
CMD ["poetry", "run", "streamlit", "run", "app_home.py"]
|
||||
CMD ["uv", "run", "streamlit", "run", "app_home.py"]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
# Use an official Python runtime as a base image
|
||||
FROM python:3.11.7-slim-bullseye
|
||||
# Use Python 3.11 slim image as base
|
||||
FROM python:3.11-slim-bookworm
|
||||
|
||||
# Install uv using the official method
|
||||
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
||||
|
||||
|
||||
# Install system dependencies required for building certain Python packages
|
||||
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
|
||||
|
|
@ -13,14 +17,8 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://install.surrealdb.com | sh
|
|||
# Set the working directory in the container to /app
|
||||
WORKDIR /app
|
||||
|
||||
COPY pyproject.toml poetry.lock /app/
|
||||
RUN pip install poetry --no-cache-dir
|
||||
RUN poetry self add poetry-plugin-dotenv
|
||||
RUN poetry config virtualenvs.create false
|
||||
|
||||
RUN poetry install --only main
|
||||
|
||||
COPY . /app
|
||||
RUN uv sync
|
||||
|
||||
# Create supervisor configuration directory
|
||||
RUN mkdir -p /etc/supervisor/conf.d
|
||||
|
|
|
|||
4
Makefile
4
Makefile
|
|
@ -10,10 +10,10 @@ database:
|
|||
docker compose --profile db_only up
|
||||
|
||||
run:
|
||||
poetry run streamlit run app_home.py
|
||||
uv run streamlit run app_home.py
|
||||
|
||||
lint:
|
||||
poetry run python -m mypy .
|
||||
uv run python -m mypy .
|
||||
|
||||
ruff:
|
||||
ruff check . --fix
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import streamlit as st
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from open_notebook.domain.base import ObjectModel
|
||||
from open_notebook.exceptions import NotFoundError
|
||||
|
|
@ -10,6 +11,7 @@ from pages.components import (
|
|||
)
|
||||
from pages.stream_app.utils import setup_page
|
||||
|
||||
load_dotenv()
|
||||
setup_page("📒 Open Notebook", sidebar_state="collapsed")
|
||||
|
||||
if "object_id" not in st.query_params:
|
||||
|
|
|
|||
|
|
@ -253,19 +253,19 @@ class RecordModel(BaseModel):
|
|||
# Load data from DB first
|
||||
result = repo_query(f"SELECT * FROM {self.record_id};")
|
||||
|
||||
# Initialize empty object with None for all non-ClassVar fields
|
||||
db_data = {
|
||||
field_name: None
|
||||
for field_name, field_info in self.model_fields.items()
|
||||
if not str(field_info.annotation).startswith("typing.ClassVar")
|
||||
}
|
||||
|
||||
# Update with DB data if it exists
|
||||
if result:
|
||||
db_data.update(result[0])
|
||||
|
||||
# Initialize with DB data and any overrides
|
||||
super().__init__(**{**db_data, **kwargs})
|
||||
init_data = {}
|
||||
if result and result[0]:
|
||||
init_data.update(result[0])
|
||||
|
||||
# Override with any provided kwargs
|
||||
if kwargs:
|
||||
init_data.update(kwargs)
|
||||
|
||||
# Initialize base model first
|
||||
super().__init__(**init_data)
|
||||
|
||||
# Mark as initialized
|
||||
object.__setattr__(self, "_initialized", True)
|
||||
|
||||
@classmethod
|
||||
|
|
|
|||
|
|
@ -28,14 +28,14 @@ class Model(ObjectModel):
|
|||
|
||||
class DefaultModels(RecordModel):
|
||||
record_id: ClassVar[str] = "open_notebook:default_models"
|
||||
default_chat_model: Optional[str]
|
||||
default_transformation_model: Optional[str]
|
||||
large_context_model: Optional[str]
|
||||
default_text_to_speech_model: Optional[str]
|
||||
default_speech_to_text_model: Optional[str]
|
||||
default_chat_model: Optional[str] = None
|
||||
default_transformation_model: Optional[str] = None
|
||||
large_context_model: Optional[str] = None
|
||||
default_text_to_speech_model: Optional[str] = None
|
||||
default_speech_to_text_model: Optional[str] = None
|
||||
# default_vision_model: Optional[str]
|
||||
default_embedding_model: Optional[str]
|
||||
default_tools_model: Optional[str]
|
||||
default_embedding_model: Optional[str] = None
|
||||
default_tools_model: Optional[str] = None
|
||||
|
||||
|
||||
class ModelManager:
|
||||
|
|
|
|||
|
|
@ -117,6 +117,8 @@ class PodcastConfig(ObjectModel):
|
|||
tts_model = "openai"
|
||||
elif self.provider == "anthropic":
|
||||
tts_model = "anthropic"
|
||||
elif self.provider == "elevenlabs":
|
||||
tts_model = "elevenlabs"
|
||||
|
||||
logger.debug(
|
||||
f"Generating episode {episode_name} with config {conversation_config} and using model {llm_model_name}, tts model {tts_model}"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
|
|
@ -26,7 +26,7 @@ def version_sidebar():
|
|||
|
||||
with open("pyproject.toml", "rb") as f:
|
||||
pyproject = tomli.load(f)
|
||||
current_version = pyproject["tool"]["poetry"]["version"]
|
||||
current_version = pyproject["project"]["version"]
|
||||
|
||||
latest_version = get_version_from_github(
|
||||
"https://www.github.com/lfnovo/open-notebook", "main"
|
||||
|
|
@ -98,6 +98,7 @@ def setup_stream_state(current_notebook: Notebook) -> ChatSession:
|
|||
|
||||
|
||||
def check_migration():
|
||||
logger.critical("Running migration check")
|
||||
mm = MigrationManager()
|
||||
if mm.needs_migration:
|
||||
st.warning("The Open Notebook database needs a migration to run properly.")
|
||||
|
|
|
|||
6430
poetry.lock
generated
6430
poetry.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -1,3 +0,0 @@
|
|||
[virtualenvs]
|
||||
in-project = true
|
||||
path = "."
|
||||
109
pyproject.toml
109
pyproject.toml
|
|
@ -1,65 +1,72 @@
|
|||
[tool.poetry]
|
||||
[project]
|
||||
name = "open-notebook"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
description = "An open source implementation of a research assistant, inspired by Google Notebook LM"
|
||||
authors = ["Luis Novo <lfnovo@gmail.com>"]
|
||||
license = "MIT"
|
||||
authors = [
|
||||
{name = "Luis Novo", email = "lfnovo@gmail.com"}
|
||||
]
|
||||
readme = "README.md"
|
||||
classifiers = [
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
]
|
||||
requires-python = ">=3.11"
|
||||
dependencies = [
|
||||
"streamlit>=1.39.0",
|
||||
"watchdog>=5.0.3",
|
||||
"pydantic>=2.9.2",
|
||||
"loguru>=0.7.2",
|
||||
"langchain>=0.3.3",
|
||||
"langgraph>=0.2.38",
|
||||
"humanize>=4.11.0",
|
||||
"streamlit-tags>=1.2.8",
|
||||
"streamlit-scrollable-textbox>=0.0.3",
|
||||
"tiktoken>=0.8.0",
|
||||
"streamlit-monaco>=0.1.3",
|
||||
"langgraph-checkpoint-sqlite>=2.0.0",
|
||||
"pymupdf==1.24.11",
|
||||
"python-magic>=0.4.27",
|
||||
"langdetect>=1.0.9",
|
||||
"youtube-transcript-api>=0.6.2",
|
||||
"openai>=1.52.0",
|
||||
"pre-commit>=4.0.1",
|
||||
"langchain-community>=0.3.3",
|
||||
"litellm>=1.50.1",
|
||||
"langchain-openai>=0.2.3",
|
||||
"langchain-anthropic>=0.2.3",
|
||||
"langchain-ollama>=0.2.0",
|
||||
"langchain-google-vertexai>=2.0.5",
|
||||
"langchain-google-genai>=2.0.1",
|
||||
"podcastfy>=0.4",
|
||||
"tomli>=2.0.2",
|
||||
"bs4>=0.0.2",
|
||||
"python-docx>=1.1.2",
|
||||
"python-pptx>=1.0.2",
|
||||
"openpyxl>=3.1.5",
|
||||
"google-generativeai>=0.8.3",
|
||||
"langchain-groq>=0.2.1",
|
||||
"groq>=0.12.0",
|
||||
"python-dotenv>=1.0.1",
|
||||
"sdblpy",
|
||||
]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.11"
|
||||
streamlit = "^1.39.0"
|
||||
watchdog = "^5.0.3"
|
||||
pydantic = "^2.9.2"
|
||||
loguru = "^0.7.2"
|
||||
langchain = "^0.3.3"
|
||||
langgraph = "^0.2.38"
|
||||
humanize = "^4.11.0"
|
||||
streamlit-tags = "^1.2.8"
|
||||
streamlit-scrollable-textbox = "^0.0.3"
|
||||
tiktoken = "^0.8.0"
|
||||
streamlit-monaco = "^0.1.3"
|
||||
langgraph-checkpoint-sqlite = "^2.0.0"
|
||||
pymupdf = "1.24.11"
|
||||
python-magic = "^0.4.27"
|
||||
langdetect = "^1.0.9"
|
||||
youtube-transcript-api = "^0.6.2"
|
||||
openai = "^1.52.0"
|
||||
pre-commit = "^4.0.1"
|
||||
langchain-community = "^0.3.3"
|
||||
litellm = "^1.50.1"
|
||||
langchain-openai = "^0.2.3"
|
||||
langchain-anthropic = "^0.2.3"
|
||||
langchain-ollama = "^0.2.0"
|
||||
langchain-google-vertexai = "^2.0.5"
|
||||
sdblpy = {git = "https://github.com/lfnovo/surreal-lite-py.git"}
|
||||
langchain-google-genai = "^2.0.1"
|
||||
podcastfy = "^0.4"
|
||||
tomli = "^2.0.2"
|
||||
bs4 = "^0.0.2"
|
||||
python-docx = "^1.1.2"
|
||||
python-pptx = "^1.0.2"
|
||||
openpyxl = "^3.1.5"
|
||||
google-generativeai = "^0.8.3"
|
||||
langchain-groq = "^0.2.1"
|
||||
groq = "^0.12.0"
|
||||
[tool.setuptools]
|
||||
package-dir = {"jota_ai" = "src/open_notebook"}
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
ipykernel = "^6.29.5"
|
||||
ruff = "^0.5.5"
|
||||
mypy = "^1.11.1"
|
||||
types-requests = "^2.32.0.20241016"
|
||||
ipywidgets = "^8.1.5"
|
||||
|
||||
[project.optional-dependencies]
|
||||
dev = [
|
||||
"ipykernel>=6.29.5",
|
||||
"ruff>=0.5.5",
|
||||
"mypy>=1.11.1",
|
||||
"types-requests>=2.32.0.20241016",
|
||||
"ipywidgets>=8.1.5",
|
||||
]
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
|
||||
requires = ["setuptools>=61.0"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[tool.isort]
|
||||
profile = "black"
|
||||
|
|
@ -72,3 +79,5 @@ line-length = 88
|
|||
select = ["E", "F", "I"]
|
||||
ignore = ["E501"]
|
||||
|
||||
[tool.uv.sources]
|
||||
sdblpy = { git = "https://github.com/lfnovo/surreal-lite-py" }
|
||||
|
|
|
|||
3
src/open_notebook/__init__.py
Normal file
3
src/open_notebook/__init__.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
|
|
@ -13,7 +13,7 @@ stderr_logfile_maxbytes=0
|
|||
autorestart=true
|
||||
|
||||
[program:streamlit]
|
||||
command=poetry run streamlit run app_home.py
|
||||
command=uv run streamlit run app_home.py
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
|
|
|
|||
Loading…
Reference in a new issue