From f8f97d2c00f96e459c4bcdc466bd4d21befcb58a Mon Sep 17 00:00:00 2001 From: Huu Le <39040748+leehuwuj@users.noreply.github.com> Date: Wed, 20 Nov 2024 09:58:39 +0700 Subject: [PATCH] Add support for Python 3.13 (#436) --- .changeset/tricky-beers-bow.md | 5 +++++ helpers/python.ts | 19 +++++++++++++++++-- helpers/tools.ts | 2 +- .../types/streaming/fastapi/pyproject.toml | 2 +- 4 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 .changeset/tricky-beers-bow.md diff --git a/.changeset/tricky-beers-bow.md b/.changeset/tricky-beers-bow.md new file mode 100644 index 00000000..d4eb5a8f --- /dev/null +++ b/.changeset/tricky-beers-bow.md @@ -0,0 +1,5 @@ +--- +"create-llama": patch +--- + +Add support for python 3.13 diff --git a/helpers/python.ts b/helpers/python.ts index 9dd686d8..f57f6e97 100644 --- a/helpers/python.ts +++ b/helpers/python.ts @@ -20,6 +20,7 @@ interface Dependency { name: string; version?: string; extras?: string[]; + constraints?: Record<string, string>; } const getAdditionalDependencies = ( @@ -51,6 +52,9 @@ const getAdditionalDependencies = ( dependencies.push({ name: "llama-index-vector-stores-pinecone", version: "^0.2.1", + constraints: { + python: ">=3.11,<3.13", + }, }); break; } @@ -76,6 +80,9 @@ const getAdditionalDependencies = ( dependencies.push({ name: "llama-index-vector-stores-qdrant", version: "^0.3.0", + constraints: { + python: ">=3.11,<3.13", + }, }); break; } @@ -279,14 +286,19 @@ const mergePoetryDependencies = ( value.version = dependency.version ?? value.version; value.extras = dependency.extras ?? value.extras; + // Merge constraints if they exist + if (dependency.constraints) { + value = { ...value, ...dependency.constraints }; + } + if (value.version === undefined) { throw new Error( `Dependency "${dependency.name}" is missing attribute "version"!`, ); } - // Serialize separately only if extras are provided - if (value.extras && value.extras.length > 0) { + // Serialize as object if there are any additional properties + if (Object.keys(value).length > 1) { existingDependencies[dependency.name] = value; } else { // Otherwise, serialize just the version string @@ -513,6 +525,9 @@ export const installPythonTemplate = async ({ addOnDependencies.push({ name: "llama-index-callbacks-arize-phoenix", version: "^0.2.1", + constraints: { + python: ">=3.11,<3.13", + }, }); } diff --git a/helpers/tools.ts b/helpers/tools.ts index 27ea1e45..2be92636 100644 --- a/helpers/tools.ts +++ b/helpers/tools.ts @@ -62,7 +62,7 @@ export const supportedTools: Tool[] = [ dependencies: [ { name: "duckduckgo-search", - version: "6.1.7", + version: "^6.3.5", }, ], supportedFrameworks: ["fastapi", "nextjs", "express"], diff --git a/templates/types/streaming/fastapi/pyproject.toml b/templates/types/streaming/fastapi/pyproject.toml index 400991c5..ed543358 100644 --- a/templates/types/streaming/fastapi/pyproject.toml +++ b/templates/types/streaming/fastapi/pyproject.toml @@ -9,7 +9,7 @@ readme = "README.md" generate = "app.engine.generate:generate_datasource" [tool.poetry.dependencies] -python = ">=3.11,<3.13" +python = ">=3.11,<3.14" fastapi = "^0.109.1" uvicorn = { extras = ["standard"], version = "^0.23.2" } python-dotenv = "^1.0.0" -- GitLab