-
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 10 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 |
---|---|---|
|
@@ -7,6 +7,10 @@ on: | |
|
||
name: pages | ||
|
||
env: | ||
PYTHONUNBUFFERED: "1" | ||
UV_SYSTEM_PYTHON: 1 | ||
|
||
jobs: | ||
build-sphinx-site: | ||
runs-on: ubuntu-latest | ||
|
@@ -17,18 +21,24 @@ jobs: | |
- name: Configure pages | ||
uses: actions/configure-pages@v5 | ||
|
||
- name: Setup python | ||
- name: Install uv | ||
uses: astral-sh/setup-uv@v3 | ||
with: | ||
enable-cache: true | ||
cache-dependency-glob: pyproject.toml | ||
cache-suffix: docs | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.x" | ||
cache: "pip" | ||
python-version-file: pyproject.toml | ||
|
||
- name: Install dependencies | ||
run: pip install .[docs] | ||
- name: Install Python dependencies | ||
run: uv pip install .[docs] | ||
|
||
- name: Generate HTML | ||
run: | | ||
sphinx-build -d _build/doctrees docs/source _build/html | ||
uv run sphinx-build -d _build/doctrees docs/source _build/html | ||
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. [Question, non-blocking] If we're installing packages into the global environment by setting 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. You're right, totally unneeded! I removed it in acafd68. |
||
|
||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
|
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 |
---|---|---|
|
@@ -6,6 +6,10 @@ on: | |
|
||
name: test-coverage | ||
|
||
env: | ||
PYTHONUNBUFFERED: "1" | ||
UV_SYSTEM_PYTHON: 1 | ||
|
||
jobs: | ||
test-coverage: | ||
runs-on: ubuntu-latest | ||
|
@@ -18,18 +22,24 @@ jobs: | |
- name: Checkout | ||
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 | ||
cache-suffix: test | ||
|
||
- name: Setup Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: "pip" | ||
|
||
- name: Install dependencies | ||
run: pip install .[test] | ||
run: uv pip install .[test] | ||
|
||
- name: Run pytest | ||
run: | | ||
pytest --doctest-modules \ | ||
uv run pytest --doctest-modules \ | ||
--junitxml=junit/test-results-${{ matrix.python-version }}.xml | ||
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. [Question, non-blocking] Same question here about using the 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. Fixed in acafd68! |
||
|
||
- name: Upload artifacts | ||
|
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.