Skip to content

Commit

Permalink
Switch to uv
Browse files Browse the repository at this point in the history
  • Loading branch information
orf committed Aug 30, 2024
1 parent c46e467 commit e1db03c
Show file tree
Hide file tree
Showing 7 changed files with 526 additions and 1,005 deletions.
44 changes: 19 additions & 25 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,33 @@ on:

#concurrency: data


name: Generate Documentation Samples
jobs:
generate_samples:
timeout-minutes: 120
runs-on: ubuntu-latest
env:
UV_CACHE_DIR: /tmp/.uv-cache
steps:
- name: checkout
uses: actions/checkout@v4

- name: Set up python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Set up uv
# Install latest uv version using the installer
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- name: Load cached venv
id: cached-poetry-dependencies
- name: Restore uv cache
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
path: /tmp/.uv-cache
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
uv-${{ runner.os }}
- name: Install root
run: poetry install --only-root
- name: Install the project
run: uv sync --all-extras --dev

- name: Download links
run: |
Expand All @@ -52,8 +43,8 @@ jobs:
- name: Generate sample
run: |
poetry run pypi-data run-sql ${{ github.workspace }}/sql/random.prql stats/random_sample.json --output=json dataset/*.parquet
poetry run pypi-data run-sql ${{ github.workspace }}/sql/random_unique.prql stats/random_sample_python_only.json --output=json dataset_python_only/*.parquet
uv run pypi-data run-sql ${{ github.workspace }}/sql/random.prql stats/random_sample.json --output=json dataset/*.parquet
uv run pypi-data run-sql ${{ github.workspace }}/sql/random_unique.prql stats/random_sample_python_only.json --output=json dataset_python_only/*.parquet
- run: |
cp stats/random_sample.json t
Expand All @@ -76,3 +67,6 @@ jobs:
push: true
fetch: true
pull: '--rebase --autostash'

- name: Minimize uv cache
run: uv cache prune --ci
103 changes: 0 additions & 103 deletions .github/workflows/r2.yml

This file was deleted.

44 changes: 17 additions & 27 deletions .github/workflows/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,24 @@ name: Build data
jobs:
generate-matrix:
runs-on: ubuntu-latest
env:
UV_CACHE_DIR: /tmp/.uv-cache
steps:
- name: checkout
uses: actions/checkout@v4

- name: Set up python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Set up uv
# Install latest uv version using the installer
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- name: Load cached venv
id: cached-poetry-dependencies
- name: Restore uv cache
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

- name: Install root
run: poetry install --only-root
path: /tmp/.uv-cache
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
uv-${{ runner.os }}
- name: Generate token
id: generate_token
Expand All @@ -52,8 +39,8 @@ jobs:
- env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
run: |
poetry run pypi-data print-git-urls > links/repositories.txt
poetry run pypi-data print-git-urls --ssh-urls > links/repositories_ssh.txt
uv run pypi-data print-git-urls > links/repositories.txt
uv run pypi-data print-git-urls --ssh-urls > links/repositories_ssh.txt
- uses: EndBug/add-and-commit@v9
with:
Expand All @@ -72,7 +59,7 @@ jobs:
id: groups
run: |
mkdir output/
poetry run pypi-data group-index-urls output/
uv run pypi-data group-index-urls output/
echo "matrix=$(cat output/groups.json)" >> "$GITHUB_OUTPUT"
- uses: actions/upload-artifact@v4
Expand All @@ -98,6 +85,9 @@ jobs:
- name: Release URL
run: echo ${{ steps.create-release.html_url }}

- name: Minimize uv cache
run: uv cache prune --ci

outputs:
matrix: ${{ steps.groups.outputs.matrix }}
upload_url: ${{ steps.create-release.outputs.upload_url }}
Expand Down
44 changes: 19 additions & 25 deletions .github/workflows/stats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ jobs:
generate_stats:
timeout-minutes: 120
runs-on: ubuntu-latest
env:
UV_CACHE_DIR: /tmp/.uv-cache

steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
Expand All @@ -24,33 +27,21 @@ jobs:
- name: checkout
uses: actions/checkout@v4

- name: Set up python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Set up uv
# Install latest uv version using the installer
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- name: Load cached venv
id: cached-poetry-dependencies
- name: Restore uv cache
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
path: /tmp/.uv-cache
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
uv-${{ runner.os }}
- name: Install root
run: poetry install --only-root
- name: Install the project
run: uv sync --all-extras --dev

- name: Download links
run: |
Expand All @@ -59,10 +50,10 @@ jobs:
- name: Generate stats
run: |
poetry run pypi-data run-sql ${{ github.workspace }}/sql/stats.prql stats/totals.json --output=json --threads=8 dataset/*.parquet
uv run pypi-data run-sql ${{ github.workspace }}/sql/stats.prql stats/totals.json --output=json --threads=8 dataset/*.parquet
- run: |
poetry run pypi-data sort-json-stats ${{ github.workspace }}/stats/totals.json
uv run pypi-data sort-json-stats ${{ github.workspace }}/stats/totals.json
head stats/totals.json
- uses: EndBug/add-and-commit@v9
Expand All @@ -74,3 +65,6 @@ jobs:
push: true
fetch: true
pull: '--rebase --autostash'

- name: Minimize uv cache
run: uv cache prune --ci
Loading

0 comments on commit e1db03c

Please sign in to comment.