Skip to content
Open
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
4 changes: 4 additions & 0 deletions .github/actions/python-maturin/pre-merge/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ runs:
echo "Running mypy on SDK..."
uv run mypy --explicit-package-bases "$DIR_SDK"
echo "mypy version: $(uv run mypy --version)"
echo "Running pyrefly on SDK..."
uv run pyrefly check
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pyrefly gets wired into ci here, but uv audit - the actual ask in #3246 - gets no ci entry anywhere. so the unrequested scope-creep check is enforced on prs while the security check it was paired with is not. either both belong in ci, or split this pr: the cooldown is what the issue asked for, pyrefly + audit tooling is separate scope and separate review.

echo "pyrefly version: $(uv run pyrefly --version)"
shell: bash

- name: Build Python wheel with coverage instrumentation
Expand Down
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,20 @@ repos:
files: ^(foreign|bdd|examples)/python/(pyproject\.toml|uv\.lock)$
pass_filenames: false

- id: uv-audit
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uv-audit is added as a pre-commit hook only. iggy ci does not run pre-commit - .github/workflows/_common.yml mirrors every gating hook as an explicit job. without a matching job in _common.yml, uv audit never runs on prs. it only fires on a contributor machine that has pre-commit installed and touches a matching pyproject.toml/uv.lock. that's the opposite of the threat model in #3246 - a malicious or careless dependency bump arriving in a pr stays unguarded. if the audit is meant to gate prs, add it as a job in _common.yml.

name: uv audit (python dependencies)
entry: ./scripts/ci/uv-audit.sh
language: system
files: ^(foreign|bdd|examples)/python/(pyproject\.toml|uv\.lock)$
pass_filenames: false

- id: pyrefly
name: pyrefly (python sdk)
entry: ./scripts/ci/pyrefly-check.sh
language: system
files: ^foreign/python/(tests/.*\.py|apache_iggy\.pyi|pyproject\.toml)$
pass_filenames: false

- id: version-consistency
name: version consistency
entry: ./scripts/extract-version.sh
Expand Down
2 changes: 2 additions & 0 deletions bdd/python/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions examples/python/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions foreign/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ include = [
] },
]

[tool.uv]
exclude-newer = "7 days"
exclude-newer-package = { urllib3 = false, pyrefly = false }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exclude-newer-package = { urllib3 = false, pyrefly = false } opts these two packages out of the 7-day cooldown. pyrefly has a reason - 1.0.0 was uploaded 2026-05-12, two days before this pr, so the cooldown would block the version being added. urllib3 has none - it isn't otherwise touched by this pr, and it's one of the highest-value supply-chain targets in the python ecosystem. exempting it from the freshness window, in a pr whose stated purpose is supply-chain hardening, defeats the protection for exactly the package an attacker would most want to push a fresh malicious release of. drop the urllib3 entry. same exemption is mirrored in foreign/python/uv.lock under [options.exclude-newer-package].


[project.optional-dependencies]
# Core testing dependencies
testing = [
Expand All @@ -97,6 +101,7 @@ dev = [
"black>=23.0,<27.0",
"isort>=5.12.0,<6.0",
"mypy>=1.5.0,<2.0",
"pyrefly>=1.0.0,<2.0",
"ruff>=0.1.0,<1.0",
]

Expand All @@ -113,9 +118,17 @@ all = [
"black>=23.0,<27.0",
"isort>=5.12.0,<6.0",
"mypy>=1.5.0,<2.0",
"pyrefly>=1.0.0,<2.0",
"ruff>=0.1.0,<1.0",
]

[tool.pyrefly]
python-version = "3.10.0"
preset = "legacy"
project-includes = ["tests", "apache_iggy.pyi"]
disable-search-path-heuristics = true
search-path = ["."]

[tool.pytest.ini_options]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "session"
Expand Down
29 changes: 29 additions & 0 deletions foreign/python/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions scripts/ci/pyrefly-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

set -euo pipefail

RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m'

REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"

if ! command -v uv >/dev/null 2>&1; then
echo -e "${RED}Error: uv is required but not installed${NC}"
echo -e "${YELLOW}Install with: curl -LsSf https://astral.sh/uv/install.sh | sh${NC}"
echo -e "${YELLOW}Or use: brew install uv${NC}"
exit 127
fi

cd "$REPO_ROOT/foreign/python"
uv run pyrefly check
59 changes: 59 additions & 0 deletions scripts/ci/uv-audit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

set -euo pipefail

RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'

REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
cd "$REPO_ROOT"

if ! command -v uv >/dev/null 2>&1; then
echo -e "${RED}Error: uv is required but not installed${NC}"
echo -e "${YELLOW}Install with: curl -LsSf https://astral.sh/uv/install.sh | sh${NC}"
echo -e "${YELLOW}Or use: brew install uv${NC}"
exit 127
fi

PYTHON_DIRS=(
"foreign/python"
"bdd/python"
"examples/python"
)

FAILED=0

for dir in "${PYTHON_DIRS[@]}"; do
if [ ! -f "$dir/uv.lock" ]; then
continue
fi

echo -e "${GREEN}uv audit: $dir${NC}"
if ! (cd "$dir" && uv audit --frozen --preview-features audit); then
FAILED=1
fi
done

if [ "$FAILED" -ne 0 ]; then
echo ""
echo -e "${RED}uv audit reported vulnerabilities (see output above)${NC}"
exit 1
fi
Loading