feat: enhance fastapi server.spec to conditionally include fastembed_cache and update pyproject.toml for package discovery

This commit is contained in:
sudipnext 2026-02-21 13:43:03 +05:45
parent b2011ab18e
commit 50570516cd
3 changed files with 10 additions and 3 deletions

View file

@ -1,4 +1,5 @@
# -*- mode: python ; coding: utf-8 -*-
import os
from PyInstaller.utils.hooks import collect_all
# Collect fastembed dependencies
@ -28,6 +29,9 @@ datas_docling_ibm, binaries_docling_ibm, hiddenimports_docling_ibm = collect_all
# collect_all returns empty lists if package not installed, so safe to call conditionally
datas_docx, binaries_docx, hiddenimports_docx = collect_all('docx')
# fastembed_cache is created at runtime when models are first used; include only if present (e.g. local dev)
datas_fastembed_cache = [('fastembed_cache', 'fastembed_cache')] if os.path.isdir('fastembed_cache') else []
excludes = []
a = Analysis(
@ -36,9 +40,8 @@ a = Analysis(
binaries=binaries_fastembed + binaries_fastembed_vs + binaries_onnx + binaries_pptx + binaries_docx2everything + binaries_greenlet + binaries_docling + binaries_docling_core + binaries_docling_parse + binaries_docling_ibm + binaries_docx,
datas=[
('assets', 'assets'),
('fastembed_cache', 'fastembed_cache'),
('static', 'static'),
] + datas_fastembed + datas_fastembed_vs + datas_onnx + datas_pptx + datas_docx2everything + datas_greenlet + datas_docling + datas_docling_core + datas_docling_parse + datas_docling_ibm + datas_docx,
] + datas_fastembed_cache + datas_fastembed + datas_fastembed_vs + datas_onnx + datas_pptx + datas_docx2everything + datas_greenlet + datas_docling + datas_docling_core + datas_docling_parse + datas_docling_ibm + datas_docx,
hiddenimports=[
'aiosqlite',
'sqlite3',

View file

@ -27,3 +27,7 @@ dependencies = [
[[tool.uv.index]]
url = "https://download.pytorch.org/whl/cpu"
[tool.setuptools.packages.find]
where = ["."]
include = ["api*", "enums*", "models*", "services*", "constants*", "utils*"]

View file

@ -3,7 +3,7 @@ import { usePathname } from "next/navigation";
import { trackEvent, MixpanelEvent } from "@/utils/mixpanel";
import { Button } from "@/components/ui/button";
import { LoadingState, Template } from "../types/index";
import { TemplateLayoutsWithSettings } from "@/app/presentation-templates";
import { TemplateLayoutsWithSettings } from "@/app/presentation-templates/utils";
interface GenerateButtonProps {
loadingState: LoadingState;