Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
persist-credentials: false

- name: Setup uv and Python
uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
cache-dependency-glob: uv.lock
python-version: ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
persist-credentials: false

- name: Setup uv and Python
uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
cache-dependency-glob: uv.lock
python-version: "3.12"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
persist-credentials: false

- name: Setup Python and uv
uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3

- id: verify
name: Verify tag matches pyproject.toml and main
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
persist-credentials: false

- name: Setup Python and uv
uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3

- name: Install just
uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4
Expand Down Expand Up @@ -139,7 +139,7 @@ jobs:
path: dist

- name: Publish package distributions to TestPyPI
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # release/v1
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
Expand All @@ -165,7 +165,7 @@ jobs:
path: dist

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # release/v1
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3

- name: Publish GitHub draft release
uses: ncipollo/release-action@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd # v1.21.0
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
persist-credentials: false

- name: Setup uv and Python
uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -38,7 +38,7 @@ jobs:

- name: Upload test reports
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: test-reports-${{ matrix.python-version }}
path: reports/
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ dependencies = [
'gevent>=26.9.0',
'h11>=0.16.0',
'httpx>=0.28.1',
'pydantic_settings>=2.15.0',
'pydantic>=2.14.1',
'pydantic_settings>=2.16.2',
'pydantic>=2.14.2',
'pyyaml>=6.0.3',
'requests>=2.34.2',
'socksio>=1.0.0',
Expand All @@ -30,12 +30,12 @@ homepage = 'https://github.com/langgenius/dify-plugin-sdks'
issues = 'https://github.com/langgenius/dify-plugin-sdks/issues'

[build-system]
requires = ['uv_build~=0.13.0']
requires = ['uv_build~=0.13.6']
build-backend = 'uv_build'

[dependency-groups]
dev = [
"hypothesis>=6.169.0",
"hypothesis>=6.170.14",
'prek',
'pytest',
'pytest-cov',
Expand Down Expand Up @@ -77,7 +77,7 @@ source = ['src/dify_plugin', '*/site-packages/dify_plugin']

[tool.ruff]
preview = true
required-version = '>=0.15.22'
required-version = '>=0.17.3'

[tool.ruff.lint]
select = ['ALL']
Expand Down
5 changes: 3 additions & 2 deletions tests/interfaces/model/test_ai_model_timing_context.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from collections.abc import Mapping
from concurrent.futures import ThreadPoolExecutor
from threading import Barrier, Event
from types import SimpleNamespace

import pytest

Expand Down Expand Up @@ -57,8 +58,8 @@ def test_ai_model_timing_context_multiple_sequential_uses(
) -> None:
timestamps = iter([10.0, 25.0])
monkeypatch.setattr(
"dify_plugin.interfaces.model.ai_model.time.perf_counter",
lambda: next(timestamps),
"dify_plugin.interfaces.model.ai_model.time",
SimpleNamespace(perf_counter=lambda: next(timestamps)),
)
model = MockAIModel([])

Expand Down
8 changes: 4 additions & 4 deletions tests/interfaces/model/test_llm_timing_context.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from collections.abc import Generator, Mapping
from concurrent.futures import ThreadPoolExecutor
from threading import Barrier
from types import SimpleNamespace

import pytest

Expand Down Expand Up @@ -65,10 +66,9 @@ def test_llm_timing_context(
monkeypatch: pytest.MonkeyPatch,
) -> None:
timestamps = iter([10.0, 12.5])
monkeypatch.setattr(
"dify_plugin.interfaces.model.ai_model.time.perf_counter",
lambda: next(timestamps),
)
clock = SimpleNamespace(perf_counter=lambda: next(timestamps))
monkeypatch.setattr("dify_plugin.interfaces.model.ai_model.time", clock)
monkeypatch.setattr("dify_plugin.interfaces.model.large_language_model.time", clock)
model = MockLLM([])
chunks = list(model.invoke(model="test", credentials={}, prompt_messages=[]))

Expand Down
8 changes: 4 additions & 4 deletions tests/interfaces/model/test_model_pricing.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from decimal import Decimal
from types import SimpleNamespace

import pytest

Expand Down Expand Up @@ -70,10 +71,9 @@ def test_llm_usage_preserves_each_cost_and_combines_totals(
monkeypatch: pytest.MonkeyPatch,
) -> None:
timestamps = iter([10.0, 12.5])
monkeypatch.setattr(
"dify_plugin.interfaces.model.ai_model.time.perf_counter",
lambda: next(timestamps),
)
clock = SimpleNamespace(perf_counter=lambda: next(timestamps))
monkeypatch.setattr("dify_plugin.interfaces.model.ai_model.time", clock)
monkeypatch.setattr("dify_plugin.interfaces.model.large_language_model.time", clock)

with priced_model.timing_context():
usage = priced_model._calc_response_usage("model", {}, 17, 19)
Expand Down
5 changes: 4 additions & 1 deletion tests/servers/test_tcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import json
import signal
from collections.abc import Generator
from types import SimpleNamespace
from unittest.mock import Mock

import gevent
Expand Down Expand Up @@ -352,7 +353,9 @@ def test_tcp_close_during_reconnect_delay_stops_retry(
) -> None:
reader, peer = connected
peer.close()
monkeypatch.setattr(tcp_module.time, "sleep", lambda _delay: reader.close())
monkeypatch.setattr(
tcp_module, "time", SimpleNamespace(sleep=lambda _delay: reader.close())
)

assert list(reader._read_stream()) == []

Expand Down
Loading
Loading