-
Notifications
You must be signed in to change notification settings - Fork 328
feat(python): uv cooldown, CI uv audit, and Pyrefly for the SDK #3257
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,6 +87,20 @@ repos: | |
| files: ^(foreign|bdd|examples)/python/(pyproject\.toml|uv\.lock)$ | ||
| pass_filenames: false | ||
|
|
||
| - id: uv-audit | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| 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 | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,6 +78,10 @@ include = [ | |
| ] }, | ||
| ] | ||
|
|
||
| [tool.uv] | ||
| exclude-newer = "7 days" | ||
| exclude-newer-package = { urllib3 = false, pyrefly = false } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| [project.optional-dependencies] | ||
| # Core testing dependencies | ||
| testing = [ | ||
|
|
@@ -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", | ||
| ] | ||
|
|
||
|
|
@@ -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" | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| 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 |
| 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 |
There was a problem hiding this comment.
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.