Skip to content

Commit

Permalink
Merge pull request #540 from OpenCOMPES/move_to_uv
Browse files Browse the repository at this point in the history
Move to uv
  • Loading branch information
rettigl authored Jan 5, 2025
2 parents 2b162ad + 64b07c1 commit 178c6ea
Show file tree
Hide file tree
Showing 31 changed files with 292 additions and 5,710 deletions.
28 changes: 16 additions & 12 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
paths-ignore:
pyproject.toml

env:
UV_SYSTEM_PYTHON: true

jobs:
benchmark:
runs-on: ubuntu-latest
Expand All @@ -16,31 +19,32 @@ jobs:
- name: Check out the repository
uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 0

- uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}

# Use cached python and dependencies, install poetry
- name: "Setup Python, Poetry and Dependencies"
uses: packetcoders/action-setup-cache-python-poetry@main
# Setup python
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: 3.9
poetry-version: 1.8.3
python-version: "3.10"

- name: Install project dependencies
run: poetry install
- name: Install dependencies
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install project dependencies
run: poetry install
- name: Install package
run: |
uv pip install ".[dev]"
# Run benchmarks
- name: Run benchmarks on python 3.8
- name: Run benchmarks on python 3.10
run: |
poetry run pytest --full-trace --show-capture=no -sv benchmarks/benchmark_*.py
pytest --full-trace --show-capture=no -sv benchmarks/benchmark_*.py
- name: Obtain git status
id: status
Expand Down
58 changes: 21 additions & 37 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
UV_SYSTEM_PYTHON: true

jobs:
build:
Expand All @@ -26,21 +28,24 @@ jobs:
remove-android: 'true'
remove-docker-images: 'true'

# Check out repo and set up Python
- name: Check out the repository
uses: actions/checkout@v4
# Check out repo and set up Python
- uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 0

# Use cached python and dependencies, install poetry
- name: "Setup Python, Poetry and Dependencies"
uses: packetcoders/action-setup-cache-python-poetry@main
# Setup python
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: 3.9
poetry-version: 1.8.3
python-version: "3.10"

- name: Install dependencies
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install notebook dependencies
run: poetry install -E notebook --with docs
- name: Install package
run: |
uv pip install ".[docs,notebook]"
- name: Install pandoc
run: |
Expand All @@ -57,32 +62,16 @@ jobs:
# if: steps.cache-primes.outputs.cache-hit != 'true'
run: |
cd $GITHUB_WORKSPACE/docs
poetry run python scripts/download_data.py
python scripts/download_data.py
- name: build parquet files
run: |
cd $GITHUB_WORKSPACE/docs
poetry run python scripts/build_flash_parquets.py
poetry run python scripts/build_sxp_parquets.py
- name: Change version for develop build
if: startsWith(github.ref, 'refs/heads/') && github.ref != 'refs/heads/main'
run: |
VERSION=`sed -n 's/^version = "\(.*\)".*/\1/p' $GITHUB_WORKSPACE/pyproject.toml`
MOD_VERSION=$VERSION".dev0"
echo $MOD_VERSION
sed -i "s/^version = \"$VERSION\"/version = \"$MOD_VERSION\"/" $GITHUB_WORKSPACE/pyproject.toml
- name: Change version for release build
if: startsWith(github.ref, 'refs/tags/')
run: |
OLD_VERSION=`sed -n 's/^version = "\(.*\)".*/\1/p' $GITHUB_WORKSPACE/pyproject.toml`
NEW_VERSION=`echo ${GITHUB_REF#refs/tags/} | sed -n 's/^v\(.*\)/\1/p'`
echo $NEW_VERSION
sed -i "s/^version = \"$OLD_VERSION\"/version = \"$NEW_VERSION\"/" $GITHUB_WORKSPACE/pyproject.toml
python scripts/build_flash_parquets.py
python scripts/build_sxp_parquets.py
- name: build Sphinx docs
run: poetry run sphinx-build -b html $GITHUB_WORKSPACE/docs $GITHUB_WORKSPACE/_build
run: sphinx-build -b html $GITHUB_WORKSPACE/docs $GITHUB_WORKSPACE/_build

- name: Upload artifact
uses: actions/upload-artifact@v4
Expand All @@ -96,17 +85,12 @@ jobs:
needs: build
steps:
- name: Checkout docs repo
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/docs
token: ${{ secrets.GITHUB_TOKEN }}
path: 'docs-repo'

- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Setup SSH
uses: webfactory/[email protected]
with:
Expand Down
28 changes: 19 additions & 9 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,44 @@ on:
paths-ignore:
pyproject.toml

env:
UV_SYSTEM_PYTHON: true

jobs:
lint:
runs-on: ubuntu-latest
steps:
# Check out repo and set up Python
- uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 0

# Use cached python and dependencies, install poetry
- name: "Setup Python, Poetry and Dependencies"
uses: packetcoders/action-setup-cache-python-poetry@main
# Setup python
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: 3.9
poetry-version: 1.8.3
python-version: "3.10"

- name: Install dependencies
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install package
run: |
uv pip install ".[dev]"
# Linting steps, execute all linters even if one fails
- name: ruff
run:
poetry run ruff src/sed tests
ruff src/sed tests
- name: ruff formatting
if: ${{ always() }}
run:
poetry run ruff format --check src/sed tests
ruff format --check src/sed tests
- name: mypy
if: ${{ always() }}
run:
poetry run mypy src/sed tests
mypy src/sed tests
- name: spellcheck
if: ${{ always() }}
uses: streetsidesoftware/cspell-action@v6
Expand Down
Loading

0 comments on commit 178c6ea

Please sign in to comment.