Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

next
yml 140 lines 5.06 KB
Raw
1 name: Audit Python SDK
2
3 # Python counterpart of ts.audit.yml. Every tracked uv lockfile is exported to
4 # a pinned requirements list and scanned with pip-audit against the PyPI
5 # advisory database and OSV. Runtime dependencies only, matching the
6 # `pnpm audit --prod` gate: the exports pass `--no-dev`, and workspace members
7 # themselves are skipped since they are not published on PyPI.
8 #
9 # Keep `--strict` so audit errors fail the check.
10
11 on:
12 push:
13 branches: [master, next]
14 paths:
15 - 'pyproject.toml'
16 - 'uv.lock'
17 - 'python/pyproject.toml'
18 - 'python/providers/*/pyproject.toml'
19 - 'python/providers/*/uv.lock'
20 - '.github/actions/setup-python-uv/action.yml'
21 - '.github/workflows/py.audit.yml'
22 - 'mise.toml'
23 - 'mise.lock'
24 pull_request:
25 branches: [master, next]
26 paths:
27 - 'pyproject.toml'
28 - 'uv.lock'
29 - 'python/pyproject.toml'
30 - 'python/providers/*/pyproject.toml'
31 - 'python/providers/*/uv.lock'
32 - '.github/actions/setup-python-uv/action.yml'
33 - '.github/workflows/py.audit.yml'
34 - 'mise.toml'
35 - 'mise.lock'
36 schedule:
37 # Advisories land without a commit; re-check the default branch weekly.
38 - cron: '30 6 * * 5'
39
40 concurrency:
41 group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
42 cancel-in-progress: ${{ github.event_name == 'pull_request' }}
43
44 permissions:
45 contents: read
46
47 env:
48 PIP_AUDIT_VERSION: 2.10.1
49
50 jobs:
51 audit:
52 name: Audit ${{ matrix.lock.name }}
53 runs-on: ubuntu-latest
54 strategy:
55 fail-fast: false
56 matrix:
57 lock:
58 # The uv workspace at the repository root: the composio package and
59 # every provider listed in [tool.uv.workspace].
60 - name: workspace
61 directory: '.'
62 export-flags: '--all-packages'
63 standalone: false
64 # Provider projects with their own lockfiles, which pin the published
65 # `composio` from PyPI rather than the workspace checkout. uv resolves
66 # them on their own even though python/providers/openai is listed as
67 # a workspace member: discovery walks up from the provider, hits
68 # python/pyproject.toml first, and stops there because that project
69 # declares no workspace. The "Check lockfile origin" step below
70 # asserts this so a change to that layout cannot silently turn these
71 # jobs into a re-scan of the workspace export.
72 - name: composio-openai
73 directory: 'python/providers/openai'
74 export-flags: ''
75 standalone: true
76 - name: composio-claude-agent-sdk
77 directory: 'python/providers/claude_agent_sdk'
78 export-flags: ''
79 standalone: true
80 # CrewAI is resolved independently in its standalone provider lockfile.
81 - name: composio-crewai
82 directory: 'python/providers/crewai'
83 export-flags: ''
84 standalone: true
85
86 steps:
87 - name: Checkout Code
88 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
89
90 - name: Setup Python with UV
91 uses: ./.github/actions/setup-python-uv
92 with:
93 enable-caching: 'false'
94
95 - name: Export locked runtime requirements
96 env:
97 LOCK_DIRECTORY: ${{ matrix.lock.directory }}
98 EXPORT_FLAGS: ${{ matrix.lock.export-flags }}
99 run: |
100 # shellcheck disable=SC2086 # EXPORT_FLAGS is intentionally word-split.
101 uv export \
102 --frozen \
103 --no-dev \
104 --no-hashes \
105 --no-emit-workspace \
106 --directory "$LOCK_DIRECTORY" \
107 --output-file "$RUNNER_TEMP/requirements.txt" \
108 $EXPORT_FLAGS
109 echo "Exported $(grep -c '==' "$RUNNER_TEMP/requirements.txt") pinned packages"
110
111 - name: Check lockfile origin
112 env:
113 LOCK_DIRECTORY: ${{ matrix.lock.directory }}
114 STANDALONE: ${{ matrix.lock.standalone }}
115 run: |
116 # A standalone provider lock pins composio from PyPI, so its export
117 # carries a `composio==` line. A workspace export never does, because
118 # `--no-emit-workspace` drops workspace members.
119 if grep -q '^composio==' "$RUNNER_TEMP/requirements.txt"; then
120 origin=standalone
121 else
122 origin=workspace
123 fi
124 if [[ "$STANDALONE" == "true" && "$origin" != "standalone" ]]; then
125 echo "::error::expected $LOCK_DIRECTORY/uv.lock to resolve on its own, but uv exported the workspace lock"
126 exit 1
127 fi
128 if [[ "$STANDALONE" != "true" && "$origin" != "workspace" ]]; then
129 echo "::error::expected the workspace lock, but uv exported a standalone project lock"
130 exit 1
131 fi
132 echo "Audited the $origin lockfile"
133
134 - name: Run pip-audit
135 run: |
136 uvx --from "pip-audit==$PIP_AUDIT_VERSION" pip-audit \
137 --requirement "$RUNNER_TEMP/requirements.txt" \
138 --no-deps \
139 --strict \
140 --progress-spinner off