longguard 0.2.2__tar.gz → 0.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {longguard-0.2.2 → longguard-0.2.3}/.github/workflows/ci.yml +49 -32
- {longguard-0.2.2 → longguard-0.2.3}/.github/workflows/release.yml +3 -6
- {longguard-0.2.2 → longguard-0.2.3}/CHANGELOG.md +21 -0
- {longguard-0.2.2 → longguard-0.2.3}/PKG-INFO +6 -4
- {longguard-0.2.2 → longguard-0.2.3}/README.md +2 -1
- {longguard-0.2.2 → longguard-0.2.3}/pyproject.toml +8 -2
- {longguard-0.2.2 → longguard-0.2.3}/scripts/check_version.py +4 -4
- {longguard-0.2.2 → longguard-0.2.3}/scripts/prepare_merge_release.py +6 -6
- {longguard-0.2.2 → longguard-0.2.3}/scripts/release_notes.py +5 -4
- {longguard-0.2.2 → longguard-0.2.3}/scripts/verify_release.py +5 -3
- {longguard-0.2.2 → longguard-0.2.3}/src/longguard/__init__.py +1 -1
- {longguard-0.2.2 → longguard-0.2.3}/tests/benchmarks/run.py +1 -1
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_benchmark.py +2 -2
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_prepare_merge_release.py +7 -6
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_report_persistence.py +4 -4
- {longguard-0.2.2 → longguard-0.2.3}/uv.lock +183 -32
- longguard-0.2.2/.github/workflows/release-on-merge.yml +0 -102
- longguard-0.2.2/tests/test_merge_release_workflow.py +0 -99
- {longguard-0.2.2 → longguard-0.2.3}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/.github/PR_v0.2.0_DRAFT.md +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/.github/dependabot.yml +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/.github/release.yml +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/.github/workflows/docs.yml +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/.gitignore +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/CODE_OF_CONDUCT.md +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/CONTRIBUTING.md +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/LICENSE +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/SECURITY.md +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/SUPPORT.md +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/assets/LongGuard-Logo.png +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/assets/architecture.svg +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/assets/icon.svg +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/assets/linkedin_card.png +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/assets/linkedin_launch.jpg +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/assets/logo-dark.svg +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/assets/logo-light.svg +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/assets/logo.svg +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/docs/assets/LongGuard-Logo.png +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/docs/assets/architecture.svg +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/docs/assets/icon.svg +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/docs/assets/logo-dark.svg +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/docs/assets/logo-light.svg +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/docs/assets/logo.svg +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/docs/changelog.md +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/docs/concepts/detectors.md +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/docs/concepts/how-it-works.md +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/docs/concepts/reflect-and-pivot.md +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/docs/contributing.md +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/docs/getting-started.md +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/docs/guides/benchmarks.md +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/docs/guides/compatibility.md +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/docs/guides/configuration.md +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/docs/guides/decorator.md +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/docs/guides/development-evidence.md +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/docs/guides/model-pricing-sources.md +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/docs/guides/reporting.md +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/docs/index.md +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/docs/integrations/crewai.md +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/docs/integrations/langchain.md +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/docs/integrations/langgraph.md +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/docs/integrations/raw-client.md +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/examples/crewai_guarded.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/examples/custom_detector.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/examples/langchain_agent.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/examples/langgraph_basic.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/examples/langgraph_resume.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/examples/openai_raw_guard.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/mkdocs.yml +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/src/longguard/config.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/src/longguard/core/__init__.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/src/longguard/core/breaker.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/src/longguard/core/decorator.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/src/longguard/core/detectors/__init__.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/src/longguard/core/detectors/base.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/src/longguard/core/detectors/dead_end.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/src/longguard/core/detectors/semantic_osc.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/src/longguard/core/detectors/token_velocity.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/src/longguard/core/detectors/tool_repeat.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/src/longguard/core/pivot.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/src/longguard/core/reporter.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/src/longguard/core/step.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/src/longguard/integrations/__init__.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/src/longguard/integrations/crewai.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/src/longguard/integrations/graph_runner.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/src/longguard/integrations/langchain.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/src/longguard/integrations/langgraph.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/src/longguard/integrations/messages.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/src/longguard/integrations/strands.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/src/longguard/pricing.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/src/longguard/py.typed +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/__init__.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/benchmarks/LABEL_REVIEW.md +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/benchmarks/corpus.json +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/benchmarks/results/baseline-hash.json +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/benchmarks/results/current-hash.json +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/conftest.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/fixtures/report_v014.json +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_breaker.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_check_version.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_config.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_crewai_callback_contracts.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_crewai_execution.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_crewai_integration.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_dead_end.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_decorator.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_decorator_contracts.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_langchain_integration.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_langgraph_integration.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_langgraph_node_contracts.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_langgraph_resume.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_pivot.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_policy_edge_contracts.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_pricing.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_public_exports.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_release_notes.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_reporter.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_semantic_osc.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_step.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_step_adapters.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_strands_integration.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_terminal_state.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_token_velocity.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_tool_cleanup.py +0 -0
- {longguard-0.2.2 → longguard-0.2.3}/tests/test_tool_repeat.py +0 -0
|
@@ -7,15 +7,9 @@ on:
|
|
|
7
7
|
branches: [ main, master ]
|
|
8
8
|
|
|
9
9
|
jobs:
|
|
10
|
-
|
|
11
|
-
name:
|
|
12
|
-
runs-on:
|
|
13
|
-
strategy:
|
|
14
|
-
fail-fast: false
|
|
15
|
-
matrix:
|
|
16
|
-
os: [ubuntu-latest, macos-latest]
|
|
17
|
-
python-version: ["3.11", "3.12"]
|
|
18
|
-
|
|
10
|
+
checks:
|
|
11
|
+
name: Code Quality, Typing, Docs & Package Verification
|
|
12
|
+
runs-on: ubuntu-latest
|
|
19
13
|
steps:
|
|
20
14
|
- uses: actions/checkout@v7
|
|
21
15
|
|
|
@@ -24,45 +18,68 @@ jobs:
|
|
|
24
18
|
with:
|
|
25
19
|
version: "latest"
|
|
26
20
|
|
|
27
|
-
- name: Set up Python
|
|
28
|
-
run: uv python install
|
|
21
|
+
- name: Set up Python 3.11
|
|
22
|
+
run: uv python install 3.11
|
|
29
23
|
|
|
30
24
|
- name: Install dependencies
|
|
31
|
-
run:
|
|
32
|
-
uv sync --python ${{ matrix.python-version }} --extra dev
|
|
25
|
+
run: uv sync --python 3.11 --extra dev
|
|
33
26
|
|
|
34
27
|
- name: Run Ruff Linter & Formatter
|
|
35
28
|
run: |
|
|
36
|
-
uv run --python
|
|
29
|
+
uv run --python 3.11 ruff check src/ tests/ scripts/
|
|
30
|
+
|
|
31
|
+
- name: Run MyPy Type Checker
|
|
32
|
+
run: uv run --python 3.11 mypy src/
|
|
37
33
|
|
|
38
34
|
- name: Check Version Consistency
|
|
39
|
-
run:
|
|
40
|
-
uv run --python ${{ matrix.python-version }} python scripts/check_version.py
|
|
35
|
+
run: uv run --python 3.11 python scripts/check_version.py
|
|
41
36
|
|
|
42
37
|
- name: Strict Documentation Build Check
|
|
43
|
-
|
|
44
|
-
run: |
|
|
45
|
-
uv run --python ${{ matrix.python-version }} mkdocs build --strict
|
|
46
|
-
|
|
47
|
-
- name: Run MyPy Type Checker
|
|
48
|
-
run: |
|
|
49
|
-
uv run --python ${{ matrix.python-version }} mypy src/
|
|
50
|
-
|
|
51
|
-
- name: Run Pytest Suite with Coverage
|
|
52
|
-
run: |
|
|
53
|
-
uv run --python ${{ matrix.python-version }} pytest tests/ --cov=longguard --cov-report=xml --cov-report=term-missing
|
|
38
|
+
run: uv run --python 3.11 mkdocs build --strict
|
|
54
39
|
|
|
55
40
|
- name: Verify Package Build
|
|
56
|
-
run:
|
|
57
|
-
uv build
|
|
41
|
+
run: uv build
|
|
58
42
|
|
|
59
43
|
- name: Validate Built Distribution and Metadata
|
|
60
44
|
run: |
|
|
61
|
-
uv run --python
|
|
62
|
-
uv run --python
|
|
45
|
+
uv run --python 3.11 twine check --strict dist/*
|
|
46
|
+
uv run --python 3.11 python scripts/check_version.py --check-dist
|
|
47
|
+
|
|
48
|
+
test:
|
|
49
|
+
name: Test on Python ${{ matrix.python-version }} (${{ matrix.os }})
|
|
50
|
+
needs: [checks]
|
|
51
|
+
runs-on: ${{ matrix.os }}
|
|
52
|
+
strategy:
|
|
53
|
+
fail-fast: false
|
|
54
|
+
matrix:
|
|
55
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
56
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
57
|
+
|
|
58
|
+
steps:
|
|
59
|
+
- uses: actions/checkout@v7
|
|
60
|
+
|
|
61
|
+
- name: Install uv
|
|
62
|
+
uses: astral-sh/setup-uv@v7
|
|
63
|
+
with:
|
|
64
|
+
version: "latest"
|
|
65
|
+
|
|
66
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
67
|
+
run: uv python install ${{ matrix.python-version }}
|
|
68
|
+
|
|
69
|
+
- name: Install dependencies
|
|
70
|
+
run: uv sync --python ${{ matrix.python-version }} --extra dev
|
|
71
|
+
|
|
72
|
+
- name: Run Pytest Suite with Coverage
|
|
73
|
+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
|
|
74
|
+
run: uv run --python ${{ matrix.python-version }} pytest tests/ --cov=longguard --cov-report=xml --cov-report=term-missing
|
|
75
|
+
|
|
76
|
+
- name: Run Pytest Suite
|
|
77
|
+
if: "!(matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12')"
|
|
78
|
+
run: uv run --python ${{ matrix.python-version }} pytest tests/
|
|
63
79
|
|
|
64
80
|
frameworks:
|
|
65
81
|
name: Real frameworks (${{ matrix.dependencies }})
|
|
82
|
+
needs: [checks]
|
|
66
83
|
runs-on: ubuntu-latest
|
|
67
84
|
strategy:
|
|
68
85
|
fail-fast: false
|
|
@@ -76,7 +93,7 @@ jobs:
|
|
|
76
93
|
run: uv sync --locked --python 3.12 --extra dev --extra langgraph --extra langchain --extra crewai
|
|
77
94
|
- name: Exercise newest compatible frameworks without changing the lockfile
|
|
78
95
|
if: matrix.dependencies == 'newest'
|
|
79
|
-
run: uv pip install --upgrade 'langgraph>=1.0.0' 'langchain>=1.0.0' 'crewai>=
|
|
96
|
+
run: uv pip install --upgrade 'langgraph>=1.0.0' 'langchain>=1.0.0' 'crewai>=1.15.0,<1.15.29'
|
|
80
97
|
- name: Require framework presence
|
|
81
98
|
run: >-
|
|
82
99
|
uv run --no-sync python -c "from importlib.metadata import version; print({n: version(n) for n in ('langgraph', 'langchain', 'crewai')})"
|
|
@@ -12,8 +12,6 @@ on:
|
|
|
12
12
|
testpypi:
|
|
13
13
|
default: false
|
|
14
14
|
type: boolean
|
|
15
|
-
push:
|
|
16
|
-
tags: ["v*"]
|
|
17
15
|
workflow_dispatch:
|
|
18
16
|
inputs:
|
|
19
17
|
tag:
|
|
@@ -78,10 +76,9 @@ jobs:
|
|
|
78
76
|
- name: Determine publish flags
|
|
79
77
|
id: flags
|
|
80
78
|
run: |
|
|
81
|
-
IS_PUSH="${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}"
|
|
82
79
|
PUBLISH="${{ inputs.publish == true }}"
|
|
83
80
|
TESTPYPI="${{ inputs.testpypi == true }}"
|
|
84
|
-
if [ "$
|
|
81
|
+
if [ "$PUBLISH" = "true" ]; then
|
|
85
82
|
echo "publish=true" >> "$GITHUB_OUTPUT"
|
|
86
83
|
else
|
|
87
84
|
echo "publish=false" >> "$GITHUB_OUTPUT"
|
|
@@ -124,7 +121,7 @@ jobs:
|
|
|
124
121
|
id-token: write
|
|
125
122
|
steps:
|
|
126
123
|
- name: Download distribution packages
|
|
127
|
-
uses: actions/download-artifact@
|
|
124
|
+
uses: actions/download-artifact@v8
|
|
128
125
|
with:
|
|
129
126
|
name: dist-packages
|
|
130
127
|
path: dist
|
|
@@ -144,7 +141,7 @@ jobs:
|
|
|
144
141
|
id-token: write
|
|
145
142
|
steps:
|
|
146
143
|
- name: Download distribution packages
|
|
147
|
-
uses: actions/download-artifact@
|
|
144
|
+
uses: actions/download-artifact@v8
|
|
148
145
|
with:
|
|
149
146
|
name: dist-packages
|
|
150
147
|
path: dist
|
|
@@ -7,6 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## [0.2.3] - 2026-11-12
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- 9-cell continuous integration matrix across Ubuntu, macOS, and Windows on Python 3.11, 3.12, and 3.13 (`.github/workflows/ci.yml`).
|
|
15
|
+
- Added official `Programming Language :: Python :: 3.13` classifier to `pyproject.toml`.
|
|
16
|
+
- Configured explicit `asyncio_default_fixture_loop_scope = "function"` in pytest configuration for modern pytest-asyncio compatibility.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- CI efficiency optimization: separated code quality, strict typing (`mypy`), documentation builds (`mkdocs --strict`), and package validation (`twine check`) into a fast standalone quality gates job, eliminating redundant execution across matrix cells.
|
|
21
|
+
- Updated README badges and documentation with verified cross-platform compatibility across Linux, macOS, and Windows.
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
- Enforced explicit `utf-8` encoding across report persistence, version validation, benchmark execution, and test fixtures for Windows compatibility (preventing default ANSI/CP1252 decoding failures).
|
|
26
|
+
|
|
27
|
+
### Compatibility and limits
|
|
28
|
+
|
|
29
|
+
- No runtime change: detectors, circuit breaker state machine, defaults, budget boundaries, and report schemas are identical to 0.2.0.
|
|
30
|
+
|
|
10
31
|
## [0.2.2] - 2026-11-10
|
|
11
32
|
|
|
12
33
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: longguard
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: Circuit breaker middleware for LangGraph/LangChain agents — detect loops, inject Reflect & Pivot, prevent runaway costs
|
|
5
5
|
Project-URL: Homepage, https://github.com/ENDEVSOLS/LongGuard
|
|
6
6
|
Project-URL: Repository, https://github.com/ENDEVSOLS/LongGuard
|
|
@@ -19,6 +19,7 @@ Classifier: Operating System :: OS Independent
|
|
|
19
19
|
Classifier: Programming Language :: Python :: 3
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
23
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
23
24
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
25
|
Classifier: Topic :: System :: Monitoring
|
|
@@ -26,7 +27,7 @@ Classifier: Typing :: Typed
|
|
|
26
27
|
Requires-Python: >=3.11
|
|
27
28
|
Requires-Dist: numpy>=1.24.0
|
|
28
29
|
Provides-Extra: all
|
|
29
|
-
Requires-Dist: crewai<1.15.29,>=
|
|
30
|
+
Requires-Dist: crewai<1.15.29,>=1.15.0; extra == 'all'
|
|
30
31
|
Requires-Dist: langchain-core>=1.0.0; extra == 'all'
|
|
31
32
|
Requires-Dist: langchain>=1.0.0; extra == 'all'
|
|
32
33
|
Requires-Dist: langgraph>=1.0.0; extra == 'all'
|
|
@@ -35,7 +36,7 @@ Requires-Dist: mkdocs>=1.5.0; extra == 'all'
|
|
|
35
36
|
Requires-Dist: pymdown-extensions>=10.7; extra == 'all'
|
|
36
37
|
Requires-Dist: sentence-transformers>=2.7.0; extra == 'all'
|
|
37
38
|
Provides-Extra: crewai
|
|
38
|
-
Requires-Dist: crewai<1.15.29,>=
|
|
39
|
+
Requires-Dist: crewai<1.15.29,>=1.15.0; extra == 'crewai'
|
|
39
40
|
Provides-Extra: dev
|
|
40
41
|
Requires-Dist: mkdocs-material>=9.5.0; extra == 'dev'
|
|
41
42
|
Requires-Dist: mkdocs>=1.5.0; extra == 'dev'
|
|
@@ -70,6 +71,7 @@ Description-Content-Type: text/markdown
|
|
|
70
71
|
[](https://pypi.org/project/longguard/)
|
|
71
72
|
[](https://pypi.org/project/longguard/)
|
|
72
73
|
[](https://pypi.org/project/longguard/)
|
|
74
|
+
[](https://github.com/ENDEVSOLS/LongGuard)
|
|
73
75
|
[](https://github.com/ENDEVSOLS/LongGuard/actions/workflows/ci.yml)
|
|
74
76
|
[](https://endevsols.github.io/LongGuard/)
|
|
75
77
|
[](https://opensource.org/licenses/MIT)
|
|
@@ -155,7 +157,7 @@ pip install longguard[embeddings]
|
|
|
155
157
|
pip install longguard[all]
|
|
156
158
|
```
|
|
157
159
|
|
|
158
|
-
> **Python 3.11
|
|
160
|
+
> **Python 3.11 – 3.13 tested and supported** on Linux, macOS, and Windows.
|
|
159
161
|
|
|
160
162
|
### 1. LangGraph Integration (1 Line)
|
|
161
163
|
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
[](https://pypi.org/project/longguard/)
|
|
10
10
|
[](https://pypi.org/project/longguard/)
|
|
11
11
|
[](https://pypi.org/project/longguard/)
|
|
12
|
+
[](https://github.com/ENDEVSOLS/LongGuard)
|
|
12
13
|
[](https://github.com/ENDEVSOLS/LongGuard/actions/workflows/ci.yml)
|
|
13
14
|
[](https://endevsols.github.io/LongGuard/)
|
|
14
15
|
[](https://opensource.org/licenses/MIT)
|
|
@@ -94,7 +95,7 @@ pip install longguard[embeddings]
|
|
|
94
95
|
pip install longguard[all]
|
|
95
96
|
```
|
|
96
97
|
|
|
97
|
-
> **Python 3.11
|
|
98
|
+
> **Python 3.11 – 3.13 tested and supported** on Linux, macOS, and Windows.
|
|
98
99
|
|
|
99
100
|
### 1. LangGraph Integration (1 Line)
|
|
100
101
|
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "longguard"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.3"
|
|
8
8
|
description = "Circuit breaker middleware for LangGraph/LangChain agents — detect loops, inject Reflect & Pivot, prevent runaway costs"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
@@ -38,6 +38,7 @@ classifiers = [
|
|
|
38
38
|
"Programming Language :: Python :: 3",
|
|
39
39
|
"Programming Language :: Python :: 3.11",
|
|
40
40
|
"Programming Language :: Python :: 3.12",
|
|
41
|
+
"Programming Language :: Python :: 3.13",
|
|
41
42
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
42
43
|
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
43
44
|
"Topic :: System :: Monitoring",
|
|
@@ -65,7 +66,7 @@ langchain = [
|
|
|
65
66
|
"langchain-core>=1.0.0",
|
|
66
67
|
]
|
|
67
68
|
crewai = [
|
|
68
|
-
"crewai>=
|
|
69
|
+
"crewai>=1.15.0,<1.15.29",
|
|
69
70
|
]
|
|
70
71
|
embeddings = [
|
|
71
72
|
"sentence-transformers>=2.7.0",
|
|
@@ -120,9 +121,14 @@ module = [
|
|
|
120
121
|
]
|
|
121
122
|
ignore_missing_imports = true
|
|
122
123
|
|
|
124
|
+
[[tool.mypy.overrides]]
|
|
125
|
+
module = "tests.*"
|
|
126
|
+
ignore_errors = true
|
|
127
|
+
|
|
123
128
|
[tool.pytest.ini_options]
|
|
124
129
|
testpaths = ["tests"]
|
|
125
130
|
asyncio_mode = "auto"
|
|
131
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
126
132
|
markers = [
|
|
127
133
|
"integration: marks tests requiring optional dependencies",
|
|
128
134
|
]
|
|
@@ -12,12 +12,12 @@ from pathlib import Path
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
def get_project_version(root: Path) -> str:
|
|
15
|
-
pyproject = tomllib.loads((root / "pyproject.toml").read_text())
|
|
15
|
+
pyproject = tomllib.loads((root / "pyproject.toml").read_text(encoding="utf-8"))
|
|
16
16
|
return pyproject["project"]["version"]
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
def get_init_version(root: Path) -> str:
|
|
20
|
-
init_content = (root / "src" / "longguard" / "__init__.py").read_text()
|
|
20
|
+
init_content = (root / "src" / "longguard" / "__init__.py").read_text(encoding="utf-8")
|
|
21
21
|
match = re.search(r'^__version__\s*=\s*["\']([^"\']+)["\']', init_content, re.MULTILINE)
|
|
22
22
|
if not match:
|
|
23
23
|
raise ValueError("Could not find __version__ in src/longguard/__init__.py")
|
|
@@ -28,7 +28,7 @@ def get_lock_version(root: Path) -> str:
|
|
|
28
28
|
lock_file = root / "uv.lock"
|
|
29
29
|
if not lock_file.exists():
|
|
30
30
|
raise FileNotFoundError("uv.lock not found")
|
|
31
|
-
lock_data = tomllib.loads(lock_file.read_text())
|
|
31
|
+
lock_data = tomllib.loads(lock_file.read_text(encoding="utf-8"))
|
|
32
32
|
for pkg in lock_data.get("package", []):
|
|
33
33
|
if pkg.get("name") == "longguard":
|
|
34
34
|
return pkg.get("version", "")
|
|
@@ -64,7 +64,7 @@ def check_version_sync(root: Path, tag: str | None = None, require_changelog: bo
|
|
|
64
64
|
if not changelog_path.exists():
|
|
65
65
|
errors.append(f"CHANGELOG.md not found at {changelog_path}")
|
|
66
66
|
else:
|
|
67
|
-
changelog = changelog_path.read_text()
|
|
67
|
+
changelog = changelog_path.read_text(encoding="utf-8")
|
|
68
68
|
heading = f"## [{pyproject_ver}]"
|
|
69
69
|
if heading not in changelog:
|
|
70
70
|
errors.append(
|
|
@@ -28,7 +28,7 @@ def prepare(root: Path, pr: dict, *, stable: bool = False) -> str:
|
|
|
28
28
|
source = pr["merge_commit_sha"]
|
|
29
29
|
if git("rev-parse", "HEAD") != source:
|
|
30
30
|
raise ValueError("Checkout must match the merged pull request commit")
|
|
31
|
-
metadata = tomllib.loads((root / "pyproject.toml").read_text())
|
|
31
|
+
metadata = tomllib.loads((root / "pyproject.toml").read_text(encoding="utf-8"))
|
|
32
32
|
current = metadata["project"]["version"]
|
|
33
33
|
match = re.fullmatch(r"(\d+\.\d+\.\d+)\.dev\d+", current)
|
|
34
34
|
if match is None:
|
|
@@ -61,7 +61,7 @@ def prepare(root: Path, pr: dict, *, stable: bool = False) -> str:
|
|
|
61
61
|
}
|
|
62
62
|
updates = {}
|
|
63
63
|
for name, (old, new) in replacements.items():
|
|
64
|
-
content = (root / name).read_text()
|
|
64
|
+
content = (root / name).read_text(encoding="utf-8")
|
|
65
65
|
if content.count(old) != 1:
|
|
66
66
|
raise ValueError(f"Expected exactly one matching version in {name}")
|
|
67
67
|
updates[name] = content.replace(old, new, 1)
|
|
@@ -69,7 +69,7 @@ def prepare(root: Path, pr: dict, *, stable: bool = False) -> str:
|
|
|
69
69
|
if stable:
|
|
70
70
|
# For stable releases, the CHANGELOG already has the entry under [X.Y.Z].
|
|
71
71
|
# No new entry is added; the existing entry is used as-is.
|
|
72
|
-
changelog = (root / "CHANGELOG.md").read_text()
|
|
72
|
+
changelog = (root / "CHANGELOG.md").read_text(encoding="utf-8")
|
|
73
73
|
if f"## [{version}]" not in changelog:
|
|
74
74
|
raise ValueError(
|
|
75
75
|
f"Stable release requires an existing changelog entry for [{version}]"
|
|
@@ -77,7 +77,7 @@ def prepare(root: Path, pr: dict, *, stable: bool = False) -> str:
|
|
|
77
77
|
else:
|
|
78
78
|
title = " ".join(pr["title"].split())
|
|
79
79
|
entry = f"## [{version}]\n\n### Merged\n\n- {title} (#{number})\n\n"
|
|
80
|
-
changelog = (root / "CHANGELOG.md").read_text()
|
|
80
|
+
changelog = (root / "CHANGELOG.md").read_text(encoding="utf-8")
|
|
81
81
|
first_entry = re.search(r"^## \[", changelog, re.MULTILINE)
|
|
82
82
|
if first_entry is None:
|
|
83
83
|
raise ValueError("Changelog must contain a version heading")
|
|
@@ -86,7 +86,7 @@ def prepare(root: Path, pr: dict, *, stable: bool = False) -> str:
|
|
|
86
86
|
)
|
|
87
87
|
|
|
88
88
|
for name, content in updates.items():
|
|
89
|
-
(root / name).write_text(content)
|
|
89
|
+
(root / name).write_text(content, encoding="utf-8")
|
|
90
90
|
git("add", "--", *updates)
|
|
91
91
|
commit_type = "release" if stable else "chore"
|
|
92
92
|
git(
|
|
@@ -103,7 +103,7 @@ def prepare(root: Path, pr: dict, *, stable: bool = False) -> str:
|
|
|
103
103
|
|
|
104
104
|
|
|
105
105
|
def main() -> None:
|
|
106
|
-
event = json.loads(Path(os.environ["GITHUB_EVENT_PATH"]).read_text())
|
|
106
|
+
event = json.loads(Path(os.environ["GITHUB_EVENT_PATH"]).read_text(encoding="utf-8"))
|
|
107
107
|
stable = os.environ.get("RELEASE_STABLE", "").lower() in ("1", "true", "yes")
|
|
108
108
|
tag = prepare(Path(__file__).resolve().parents[1], event["pull_request"], stable=stable)
|
|
109
109
|
with Path(os.environ["GITHUB_OUTPUT"]).open("a") as stream:
|
|
@@ -16,7 +16,7 @@ def generate(root: Path, tag: str, evidence: dict) -> tuple[str, bool]:
|
|
|
16
16
|
if not re.fullmatch(r"v[0-9]+\.[0-9]+\.[0-9]+(?:rc[0-9]+|\.dev[0-9]+)?", tag):
|
|
17
17
|
raise ValueError("Use a version tag such as v0.2.0rc1")
|
|
18
18
|
version = Version(tag[1:])
|
|
19
|
-
metadata = tomllib.loads((root / "pyproject.toml").read_text())
|
|
19
|
+
metadata = tomllib.loads((root / "pyproject.toml").read_text(encoding="utf-8"))
|
|
20
20
|
if str(version) != metadata["project"]["version"]:
|
|
21
21
|
raise ValueError("Release tag does not match package version")
|
|
22
22
|
commit = subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=root, text=True).strip()
|
|
@@ -26,7 +26,7 @@ def generate(root: Path, tag: str, evidence: dict) -> tuple[str, bool]:
|
|
|
26
26
|
checks = evidence.get("checks", {})
|
|
27
27
|
if not required.issubset(checks) or any(checks[k]["exit_code"] != 0 for k in required):
|
|
28
28
|
raise ValueError("Release checks are missing or failed")
|
|
29
|
-
changelog = (root / "CHANGELOG.md").read_text()
|
|
29
|
+
changelog = (root / "CHANGELOG.md").read_text(encoding="utf-8")
|
|
30
30
|
match = re.search(
|
|
31
31
|
rf"^## \[{re.escape(str(version))}\][^\n]*\n(.*?)(?=^## |\Z)",
|
|
32
32
|
changelog,
|
|
@@ -55,8 +55,9 @@ def main() -> None:
|
|
|
55
55
|
parser.add_argument("--github-output", type=Path)
|
|
56
56
|
args = parser.parse_args()
|
|
57
57
|
root = Path(__file__).resolve().parents[1]
|
|
58
|
-
|
|
59
|
-
args.
|
|
58
|
+
evidence = json.loads(args.evidence.read_text(encoding="utf-8"))
|
|
59
|
+
body, candidate = generate(root, args.tag, evidence)
|
|
60
|
+
args.output.write_text(body, encoding="utf-8")
|
|
60
61
|
if args.github_output:
|
|
61
62
|
with args.github_output.open("a") as stream:
|
|
62
63
|
stream.write(f"tag={args.tag}\nprerelease={str(candidate).lower()}\n")
|
|
@@ -84,14 +84,16 @@ def main() -> None:
|
|
|
84
84
|
record["checks"][name]["exit_code"] = 1
|
|
85
85
|
record["checks"][name]["stderr"] += f"Required real tests skipped: {module}"
|
|
86
86
|
print(name, record["checks"][name]["exit_code"], flush=True)
|
|
87
|
-
|
|
87
|
+
evidence_json = json.dumps(record, indent=2) + "\n"
|
|
88
|
+
(root / "release-evidence.json").write_text(evidence_json, encoding="utf-8")
|
|
88
89
|
coverage_path = root / "release-coverage.json"
|
|
89
90
|
if record["checks"]["pytest"]["exit_code"] == 0 and coverage_path.exists():
|
|
90
|
-
record["coverage"] = json.loads(coverage_path.read_text())["totals"]
|
|
91
|
+
record["coverage"] = json.loads(coverage_path.read_text(encoding="utf-8"))["totals"]
|
|
91
92
|
for path in (root / "dist").glob("*"):
|
|
92
93
|
if path.is_file() and (path.name.endswith(".whl") or path.name.endswith(".tar.gz")):
|
|
93
94
|
record["artifacts_sha256"][path.name] = hashlib.sha256(path.read_bytes()).hexdigest()
|
|
94
|
-
|
|
95
|
+
evidence_json = json.dumps(record, indent=2) + "\n"
|
|
96
|
+
(root / "release-evidence.json").write_text(evidence_json, encoding="utf-8")
|
|
95
97
|
if any(result["exit_code"] for result in record["checks"].values()):
|
|
96
98
|
raise SystemExit("Release checks failed; inspect release-evidence.json")
|
|
97
99
|
|
|
@@ -37,7 +37,7 @@ def source_digest(root: Path) -> str:
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
def evaluate(args: argparse.Namespace) -> dict[str, Any]:
|
|
40
|
-
corpus = json.loads(args.corpus.read_text())
|
|
40
|
+
corpus = json.loads(args.corpus.read_text(encoding="utf-8"))
|
|
41
41
|
if args.backend == "sentence-transformers" and not (args.model_path and args.model_revision):
|
|
42
42
|
raise ValueError("Provide a local model snapshot and its pinned model revision")
|
|
43
43
|
start = time.perf_counter_ns()
|
|
@@ -56,7 +56,7 @@ def test_cli_reports_counts_and_undefined_denominators(tmp_path):
|
|
|
56
56
|
capture_output=True,
|
|
57
57
|
text=True,
|
|
58
58
|
)
|
|
59
|
-
results = json.loads(output.read_text())
|
|
59
|
+
results = json.loads(output.read_text(encoding="utf-8"))
|
|
60
60
|
assert results["detectors"]["tool_repeat"]["counts"] == {"tp": 1, "fp": 0, "tn": 1, "fn": 0}
|
|
61
61
|
assert results["detectors"]["tool_repeat"]["precision"] == 1.0
|
|
62
62
|
assert results["detectors"]["semantic_oscillation"]["precision"] is None
|
|
@@ -73,6 +73,6 @@ def test_cli_uses_bundled_corpus_by_default(tmp_path):
|
|
|
73
73
|
capture_output=True,
|
|
74
74
|
text=True,
|
|
75
75
|
)
|
|
76
|
-
results = json.loads(output.read_text())
|
|
76
|
+
results = json.loads(output.read_text(encoding="utf-8"))
|
|
77
77
|
assert len(results["traces"]) == 32
|
|
78
78
|
assert all(not result["errors"] for result in results["detectors"].values())
|
|
@@ -43,12 +43,13 @@ def test_versioned_tag_preserves_source_and_can_be_retried(source):
|
|
|
43
43
|
tag = prepare_merge_release.prepare(root, pr)
|
|
44
44
|
assert tag == "v0.2.0.dev42"
|
|
45
45
|
assert git("rev-parse", f"{tag}^") == pr["merge_commit_sha"]
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
)
|
|
49
|
-
assert '__version__ = "0.2.0.dev42"' in
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
pyproject_text = (root / "pyproject.toml").read_text(encoding="utf-8")
|
|
47
|
+
assert tomllib.loads(pyproject_text)["project"]["version"] == "0.2.0.dev42"
|
|
48
|
+
init_text = (root / "src/longguard/__init__.py").read_text(encoding="utf-8")
|
|
49
|
+
assert '__version__ = "0.2.0.dev42"' in init_text
|
|
50
|
+
lock_text = (root / "uv.lock").read_text(encoding="utf-8")
|
|
51
|
+
assert tomllib.loads(lock_text)["package"][0]["version"] == "0.2.0.dev42"
|
|
52
|
+
changelog = (root / "CHANGELOG.md").read_text(encoding="utf-8")
|
|
52
53
|
assert changelog.index("## [0.2.0.dev42]") < changelog.index("## [0.1.0]")
|
|
53
54
|
assert pr["title"] in changelog
|
|
54
55
|
assert not (root / "unwanted-file").exists()
|
|
@@ -132,14 +132,14 @@ class TestSaveJSON:
|
|
|
132
132
|
report = _build_report()
|
|
133
133
|
out = tmp_path / "report.json"
|
|
134
134
|
report.save(out)
|
|
135
|
-
data = json.loads(out.read_text())
|
|
135
|
+
data = json.loads(out.read_text(encoding="utf-8"))
|
|
136
136
|
assert data["total_steps"] == 3
|
|
137
137
|
|
|
138
138
|
def test_save_explicit_fmt_json(self, tmp_path: Path) -> None:
|
|
139
139
|
report = _build_report()
|
|
140
140
|
out = tmp_path / "myreport.txt" # unusual extension
|
|
141
141
|
report.save(out, fmt="json")
|
|
142
|
-
data = json.loads(out.read_text())
|
|
142
|
+
data = json.loads(out.read_text(encoding="utf-8"))
|
|
143
143
|
assert "total_tokens" in data
|
|
144
144
|
|
|
145
145
|
def test_save_json_roundtrip(self, tmp_path: Path) -> None:
|
|
@@ -179,7 +179,7 @@ class TestSaveYAML:
|
|
|
179
179
|
# Should have fallen back to a .json file
|
|
180
180
|
json_out = out.with_suffix(".json")
|
|
181
181
|
assert json_out.exists()
|
|
182
|
-
data = json.loads(json_out.read_text())
|
|
182
|
+
data = json.loads(json_out.read_text(encoding="utf-8"))
|
|
183
183
|
assert data["total_steps"] == 3
|
|
184
184
|
|
|
185
185
|
@pytest.mark.skipif(
|
|
@@ -193,7 +193,7 @@ class TestSaveYAML:
|
|
|
193
193
|
out = tmp_path / "report.yaml"
|
|
194
194
|
report.save(out)
|
|
195
195
|
assert out.exists()
|
|
196
|
-
data = yaml.safe_load(out.read_text())
|
|
196
|
+
data = yaml.safe_load(out.read_text(encoding="utf-8"))
|
|
197
197
|
assert data["total_steps"] == 3
|
|
198
198
|
|
|
199
199
|
@pytest.mark.skipif(
|