Skip to content

Commit

Permalink
uv + Ruff (#234)
Browse files Browse the repository at this point in the history
* Replace Poetry with uv and the formatters with Ruff

* Replace Poetry with uv in CI

* Fix

* Revert "Fix"

This reverts commit 2440249.

* Fix

* Fix

* Fix

* Fix

* [TMP] Skip a step

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix
  • Loading branch information
whitphx authored Oct 24, 2024
1 parent 9821f1d commit b3a6ab1
Show file tree
Hide file tree
Showing 6 changed files with 1,127 additions and 1,595 deletions.
48 changes: 14 additions & 34 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,53 +50,33 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

# The following steps are based on https://github.com/python-poetry/poetry/blob/def1ee8f3ae00c307ca028da53d2347615c5c32b/.github/workflows/main.yml#L51-L84
- name: Get full Python version
id: full-python-version
run: echo version=$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") >> $GITHUB_OUTPUT

- name: Bootstrap poetry
run: |
curl -sL https://install.python-poetry.org | python - -y
- name: Update PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Configure poetry
run: poetry config virtualenvs.in-project true

- name: Set up cache
uses: actions/cache@v4
id: cache
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
version: "latest"
enable-cache: true

- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true'
run: timeout 10s pip --version || rm -rf .venv
- name: Install dependencies
run: uv sync

- name: Install a specific version of Streamlit
if: ${{ matrix.streamlit-version }}
run: |
poetry remove -D streamlit
poetry add -D streamlit=="${STREAMLIT_VERSION}"
uv remove streamlit
uv add streamlit=="${STREAMLIT_VERSION}"
env:
STREAMLIT_VERSION: ${{ matrix.streamlit-version }}
- name: Install dependencies
run: poetry install
- name: Show Python and Streamlit versions
run: |
python -V
poetry run streamlit version
- name: Lint with black, isort, and flake8
uv run python -c "import streamlit; print(streamlit.__version__)"
- name: Run Ruff
run: |
poetry run black . --check
poetry run isort . --check
poetry run flake8
uv run ruff check --output-format=github .
uv run ruff format . --check
- name: Type checking with mypy
run: |
poetry run mypy .
uv run mypy .
- name: Test with pytest
run: |
poetry run pytest
uv run pytest
Loading

0 comments on commit b3a6ab1

Please sign in to comment.