Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python: experimental py3.13 support #10276

Merged
merged 20 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/python-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
version: "0.5.x"
enable-cache: true
cache-suffix: ${{ runner.os }}-${{ matrix.python-version }}
cache-dependency-glob: "**/uv.lock"
- name: Check version
run: |
echo "Building and uploading Python package version: ${{ github.event.release.tag_name }}"
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/python-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ jobs:
version: "0.5.x"
enable-cache: true
cache-suffix: ${{ runner.os }}-${{ matrix.python-version }}
cache-dependency-glob: "**/uv.lock"
- name: Install dependencies
run: |
uv sync --all-extras --dev
Expand Down Expand Up @@ -257,6 +258,7 @@ jobs:
version: "0.5.x"
enable-cache: true
cache-suffix: ${{ runner.os }}-${{ matrix.python-version }}
cache-dependency-glob: "**/uv.lock"
- name: Install dependencies
run: |
uv sync --all-extras --dev
Expand Down Expand Up @@ -321,6 +323,7 @@ jobs:
version: "0.5.x"
enable-cache: true
cache-suffix: ${{ runner.os }}-${{ matrix.python-version }}
cache-dependency-glob: "**/uv.lock"
- name: Install dependencies
run: |
uv sync --all-extras --dev
Expand Down Expand Up @@ -379,6 +382,7 @@ jobs:
version: "0.5.x"
enable-cache: true
cache-suffix: ${{ runner.os }}-${{ matrix.python-version }}
cache-dependency-glob: "**/uv.lock"
- name: Install dependencies
run: |
uv sync --all-extras --dev
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/python-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
version: "0.5.x"
enable-cache: true
cache-suffix: ${{ runner.os }}-${{ matrix.python-version }}
cache-dependency-glob: "**/uv.lock"
- name: Install the project
run: uv sync --all-extras --dev
- uses: pre-commit/[email protected]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/python-test-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
version: "0.5.x"
enable-cache: true
cache-suffix: ${{ runner.os }}-${{ env.UV_PYTHON }}
cache-dependency-glob: "**/uv.lock"
- name: Install the project
run: uv sync --all-extras --dev
- name: Test with pytest
Expand Down
17 changes: 5 additions & 12 deletions .github/workflows/python-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,10 @@ jobs:
python-version: ["3.10", "3.11", "3.12"]
os: [ubuntu-latest, windows-latest, macos-latest]
experimental: [false]
# include:
# - python-version: "3.13"
# os: "ubuntu-latest"
# experimental: true
# - python-version: "3.13t"
# os: "ubuntu-latest"
# experimental: true
# gil: 0
# - python-version: "3.13t"
# os: "ubuntu-latest"
# experimental: true
# gil: 1
include:
- python-version: "3.13"
os: "ubuntu-latest"
experimental: true
env:
UV_PYTHON: ${{ matrix.python-version }}
permissions:
Expand All @@ -47,6 +39,7 @@ jobs:
version: "0.5.x"
enable-cache: true
cache-suffix: ${{ runner.os }}-${{ matrix.python-version }}
cache-dependency-glob: "**/uv.lock"
- name: Install the project
run: uv sync --all-extras --dev -U --prerelease=if-necessary-or-explicit
- name: Test with pytest
Expand Down
4 changes: 2 additions & 2 deletions python/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ repos:
- id: pyupgrade
args: [--py310-plus]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.4
rev: v0.9.6
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]
- id: ruff-format
- repo: https://github.com/astral-sh/uv-pre-commit
# uv version.
rev: 0.5.21
rev: 0.5.30
hooks:
# Update the uv lockfile
- id: uv-lock
Expand Down
8 changes: 4 additions & 4 deletions python/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ help:
echo ""
echo -e "\033[1mVARIABLES:\033[0m"
echo " PYTHON_VERSION - Python version to use. Default is 3.10"
echo " By default, 3.10, 3.11, and 3.12 are installed as well."
echo " By default, 3.10, 3.11, 3.12 and 3.13 are installed as well."

##############################
# INSTALL
Expand Down Expand Up @@ -68,8 +68,8 @@ endif
##############################
.ONESHELL:
install-python:
echo "Installing python 3.10, 3.11, 3.12"
uv python install 3.10 3.11 3.12
echo "Installing python versions"
uv python install 3.10 3.11 3.12 3.13

##############################
# INSTALL-PRE-COMMIT
Expand All @@ -87,7 +87,7 @@ install-sk:
echo "Creating and activating venv for python $(PYTHON_VERSION)"
uv venv --python $(PYTHON_VERSION)
echo "Installing Semantic Kernel and all dependencies"
uv sync --all-extras --dev
uv sync --all-extras --dev --prerelease=if-necessary-or-explicit

##############################
# CLEAN
Expand Down
12 changes: 7 additions & 5 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ dependencies = [
"pybars4 ~= 0.9",
"jinja2 ~= 3.1",
"nest-asyncio ~= 1.6",
"scipy>=1.15.1",
]

### Optional dependencies
Expand All @@ -62,7 +63,7 @@ chroma = [
]
google = [
"google-cloud-aiplatform == 1.79.0",
"google-generativeai == 0.7"
"google-generativeai ~= 0.8"
]
hugging_face = [
"transformers[torch] ~= 4.28",
Expand All @@ -87,7 +88,7 @@ ollama = [
"ollama ~= 0.4"
]
onnx = [
"onnxruntime-genai ~= 0.5"
"onnxruntime-genai ~= 0.5; python_version < '3.13'"
]
anthropic = [
"anthropic ~= 0.32"
Expand All @@ -107,11 +108,11 @@ redis = [
"redisvl >= 0.3.6",
]
usearch = [
"usearch ~= 2.9",
"usearch ~= 2.16",
"pyarrow >= 12.0,< 20.0"
]
weaviate = [
"weaviate-client>=4.7,<5.0",
"weaviate-client>=4.10,<5.0",
]
pandas = [
"pandas ~= 2.2"
Expand Down Expand Up @@ -139,7 +140,8 @@ dev-dependencies = [
"snoop ~= 0.4",
"mypy >= 1.10",
"types-PyYAML ~= 6.0.12.20240311",
"ruff ~= 0.7",
"ruff ~= 0.9",
"pyright>=1.1.392.post0",
]
environments = [
"sys_platform == 'darwin'",
Expand Down
27 changes: 27 additions & 0 deletions python/pyrightconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"reportMissingImports": false,
"include": [
"semantic_kernel/**/*.py"
],
"pythonVersion": "3.10",
"exclude": [
"semantic_kernel/memory/*",
eavanvalkenburg marked this conversation as resolved.
Show resolved Hide resolved
"semantic_kernel/planners/*",
"semantic_kernel/connectors/memory/astradb/*",
"semantic_kernel/connectors/memory/azure_ai_search/*",
"semantic_kernel/connectors/memory/azure_cognitive_search/*",
"semantic_kernel/connectors/memory/azure_cosmosdb/*",
"semantic_kernel/connectors/memory/azure_cosmosdb_no_sql/*",
"semantic_kernel/connectors/memory/chroma/*",
"semantic_kernel/connectors/memory/milvus/*",
"semantic_kernel/connectors/memory/mongodb_atlas/*",
"semantic_kernel/connectors/memory/pinecone/*",
"semantic_kernel/connectors/memory/postgres/*",
"semantic_kernel/connectors/memory/qdrant/*",
"semantic_kernel/connectors/memory/redis/*",
"semantic_kernel/connectors/memory/usearch/*",
"semantic_kernel/connectors/memory/weaviate/*"
],
"venvPath": ".",
"venv": ".venv"
}
6 changes: 0 additions & 6 deletions python/samples/concepts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,6 @@
- [Azure Chat GPT with Data API Function Calling](./on_your_data/azure_chat_gpt_with_data_api_function_calling.py)
- [Azure Chat GPT with Data API Vector Search](./on_your_data/azure_chat_gpt_with_data_api_vector_search.py)

### Planners - Showing the uses of [`Planners`](https://github.com/microsoft/semantic-kernel/tree/main/python/semantic_kernel/planners)

- [Sequential Planner](./planners/sequential_planner.py)
- [OpenAI Function Calling Stepwise Planner](./planners/openai_function_calling_stepwise_planner.py)
- [Azure OpenAI Function Calling Stepwise Planner](./planners/azure_openai_function_calling_stepwise_planner.py)

### Plugins - Different ways of creating and using [`Plugins`](https://github.com/microsoft/semantic-kernel/blob/main/python/semantic_kernel/functions/kernel_plugin.py)

- [Azure Key Vault Settings](./plugins/azure_key_vault_settings.py)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

# Configure the function choice behavior. Here, we set it to Auto, where auto_invoke=True by default.
# With `auto_invoke=True`, the model will automatically choose and call functions as needed.
request_settings.function_choice_behavior = FunctionChoiceBehavior.Auto()
request_settings.function_choice_behavior = FunctionChoiceBehavior.Auto(filters={"excluded_plugins": ["ChatBot"]})

kernel.add_service(chat_completion_service)

Expand Down

This file was deleted.

This file was deleted.

42 changes: 0 additions & 42 deletions python/samples/concepts/planners/sequential_planner.py

This file was deleted.

Loading
Loading