Skip to content

ci(format): update isort, pyink for use within uv #1477

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
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
9 changes: 4 additions & 5 deletions .github/workflows/isort.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ jobs:
with:
python-version: '3.x'

- name: Install isort
run: |
pip install isort
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- name: Run isort on changed files
id: run_isort
Expand All @@ -52,15 +51,15 @@ jobs:

# Run isort --check
set +e
isort --check $CHANGED_FILES
uv run isort --check $CHANGED_FILES
RESULT=$?
set -e
if [ $RESULT -ne 0 ]; then
echo ""
echo "❌ isort check failed!"
echo "👉 To fix import order, run locally:"
echo ""
echo " isort $FORMATTED_FILES"
echo " uv run isort $FORMATTED_FILES"
echo ""
exit $RESULT
fi
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/pyink.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ jobs:
with:
python-version: '3.x'

- name: Install pyink
run: |
pip install pyink
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- name: Run pyink on changed files
id: run_pyink
Expand All @@ -52,15 +51,15 @@ jobs:

# Run pyink --check
set +e
pyink --check --diff --config pyproject.toml $CHANGED_FILES
uv run pyink --check --diff --config pyproject.toml $CHANGED_FILES
RESULT=$?
set -e
if [ $RESULT -ne 0 ]; then
echo ""
echo "❌ Pyink formatting check failed!"
echo "👉 To fix formatting, run locally:"
echo ""
echo " pyink --config pyproject.toml $FORMATTED_FILES"
echo " uv run pyink --config pyproject.toml $FORMATTED_FILES"
echo ""
exit $RESULT
fi
Expand Down
24 changes: 6 additions & 18 deletions autoformat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,53 +15,41 @@

# Autoformat ADK codebase.

if ! command -v isort &> /dev/null
then
echo "isort not found, refer to CONTRIBUTING.md to set up dev environment first."
exit
fi

if ! command -v pyink &> /dev/null
then
echo "pyink not found, refer to CONTRIBUTING.md to set up dev environment first."
exit
fi

echo '---------------------------------------'
echo '| Organizing imports for src/...'
echo '---------------------------------------'

isort src/
uv run isort src/
echo 'All done! ✨ 🍰 ✨'

echo '---------------------------------------'
echo '| Organizing imports for tests/...'
echo '---------------------------------------'

isort tests/
uv run isort tests/
echo 'All done! ✨ 🍰 ✨'

echo '---------------------------------------'
echo '| Organizing imports for contributing/...'
echo '---------------------------------------'

isort contributing/
uv run isort contributing/
echo 'All done! ✨ 🍰 ✨'

echo '---------------------------------------'
echo '| Auto-formatting src/...'
echo '---------------------------------------'

find -L src/ -type f -name "*.py" -exec pyink --config pyproject.toml {} +
find -L src/ -type f -name "*.py" -exec uv run pyink --config pyproject.toml {} +

echo '---------------------------------------'
echo '| Auto-formatting tests/...'
echo '---------------------------------------'

find -L tests/ -type f -name "*.py" -exec pyink --config pyproject.toml {} +
find -L tests/ -type f -name "*.py" -exec uv run pyink --config pyproject.toml {} +

echo '---------------------------------------'
echo '| Auto-formatting contributing/...'
echo '---------------------------------------'

find -L contributing/ -type f -name "*.py" -exec pyink --config pyproject.toml {} +
find -L contributing/ -type f -name "*.py" -exec uv run pyink --config pyproject.toml {} +
Loading
Loading