-
Notifications
You must be signed in to change notification settings - Fork 0
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
Configure ruff and UV #23
Changes from all commits
f478d7a
e69f895
574b892
46cdfb8
b7ef4eb
81ee8a7
e6ec6ba
a60fc5a
2a7f7c1
f5c0d9f
27d828c
acafd68
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 |
---|---|---|
|
@@ -6,21 +6,30 @@ on: | |
|
||
name: lint | ||
|
||
env: | ||
PYTHONUNBUFFERED: "1" | ||
UV_SYSTEM_PYTHON: 1 | ||
|
||
jobs: | ||
lint-ruff: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup python | ||
- name: Install uv | ||
uses: astral-sh/setup-uv@v3 | ||
with: | ||
enable-cache: true | ||
cache-dependency-glob: pyproject.toml | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.x" | ||
cache: "pip" | ||
python-version-file: pyproject.toml | ||
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. This just install the min version specified in our |
||
|
||
- name: Install dependencies | ||
run: pip install . ruff | ||
run: uv pip install . ruff | ||
|
||
- name: Lint with ruff | ||
run: ruff check --output-format=github . |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,14 +18,24 @@ jobs: | |
- name: Checkout | ||
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. Note that usually we want to install Python packages into the system library with |
||
uses: actions/checkout@v4 | ||
|
||
- name: Setup python ${{ matrix.python-version }} | ||
- name: Install uv | ||
uses: astral-sh/setup-uv@v3 | ||
with: | ||
enable-cache: true | ||
cache-dependency-glob: pyproject.toml | ||
|
||
- name: Setup Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: "pip" | ||
|
||
- name: Install tox | ||
run: pip install tox-gh>=1.3.0 | ||
shell: bash | ||
run: | | ||
uv tool install tox --with tox-uv | ||
tox --version | ||
Comment on lines
+35
to
+36
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. The |
||
|
||
- name: Test install with tox | ||
run: tox -v --notest | ||
run: | | ||
env=$(echo ${{ matrix.python-version }} | tr -d '.' | sed 's/^/py/') | ||
tox r -v --notest -e "$env" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
repos: | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.5.5 | ||
rev: v0.7.2 | ||
hooks: | ||
- id: ruff | ||
args: | ||
- --fix | ||
- id: ruff-format |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import os | ||
import sys | ||
|
||
from sphinx_pyproject import SphinxConfig | ||
|
||
sys.path.append(os.path.abspath("../..")) | ||
|
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.
[Question, non-blocking] Should we be setting this more widely across our workflows? I've never noticed a buffering problem with Python scripts in GitHub workflow logs (except on our network, which blocks websockets and so prevents all real-time logs from displaying) but maybe I just haven't been watching out for the right issue.
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.
It's purely defensive. I've run into a few cases over the past couple months where Python won't output full logs due to its buffered output.