Skip to content

Commit

Permalink
173-feature-setup-uv-lock (#174)
Browse files Browse the repository at this point in the history
* Replaced pip-compile with uv.lock

Signed-off-by: Ali Abbas Jaffri <[email protected]>

* Removed requirements files

Signed-off-by: Ali Abbas Jaffri <[email protected]>

* Updated uv dependencies

Signed-off-by: Ali Abbas Jaffri <[email protected]>

* Added uv lock

Signed-off-by: Ali Abbas Jaffri <[email protected]>

* Updated uv in actions

Signed-off-by: Ali Abbas Jaffri <[email protected]>

* Updated ci

Signed-off-by: Ali Abbas Jaffri <[email protected]>

* Update

Signed-off-by: Ali Abbas Jaffri <[email protected]>

* Updated

Signed-off-by: Ali Abbas Jaffri <[email protected]>

* Updated pre-commit ci

Signed-off-by: Ali Abbas Jaffri <[email protected]>

* Updated release notes

Signed-off-by: Ali Abbas Jaffri <[email protected]>

* Updated workflows

Signed-off-by: Ali Abbas Jaffri <[email protected]>

* Updated lock file

Signed-off-by: Ali Abbas Jaffri <[email protected]>

* Updated

Signed-off-by: Ali Abbas Jaffri <[email protected]>

* Updated

Signed-off-by: Ali Abbas Jaffri <[email protected]>

* Updated

Signed-off-by: Ali Abbas Jaffri <[email protected]>

* Updated

Signed-off-by: Ali Abbas Jaffri <[email protected]>

* Updated

Signed-off-by: Ali Abbas Jaffri <[email protected]>

* Updated

Signed-off-by: Ali Abbas Jaffri <[email protected]>

* Updated

Signed-off-by: Ali Abbas Jaffri <[email protected]>

* Updated

Signed-off-by: Ali Abbas Jaffri <[email protected]>

* Updated

Signed-off-by: Ali Abbas Jaffri <[email protected]>

* Updated ci

Signed-off-by: Ali Abbas Jaffri <[email protected]>

* Updated ci

Signed-off-by: Ali Abbas Jaffri <[email protected]>

* Updated ci

Signed-off-by: Ali Abbas Jaffri <[email protected]>

* Updated ci

Signed-off-by: Ali Abbas Jaffri <[email protected]>

* Updated project dependencies

Signed-off-by: Ali Abbas Jaffri <[email protected]>

---------

Signed-off-by: Ali Abbas Jaffri <[email protected]>
  • Loading branch information
aliabbasjaffri authored Nov 29, 2024
1 parent c7a2fa5 commit 39407d0
Show file tree
Hide file tree
Showing 10 changed files with 1,170 additions and 322 deletions.
2 changes: 1 addition & 1 deletion .github/actions/mike-docs/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ runs:
if [ "true" = "${{ inputs.push }}" ]; then
MIKE_OPTIONS+=( "--push" )
fi
mike deploy "${MIKE_OPTIONS[@]}" ${{ inputs.version }} ${{ inputs.alias }}
uv run mike deploy "${MIKE_OPTIONS[@]}" ${{ inputs.version }} ${{ inputs.alias }}
if [ "true" = "${{ inputs.push }}" ]; then
mike set-default --push latest
fi
Expand Down
36 changes: 10 additions & 26 deletions .github/actions/setup-python/action.yaml
Original file line number Diff line number Diff line change
@@ -1,38 +1,22 @@
name: Install Python dependencies
description: Install all core and optional Python dependencies
inputs:
pythonVersion:
description: Python version to set up (see actions/setup-python@v4)
required: true
dependencyType:
description: The type of dependencies to install (dev or docs)
required: true
default: "dev"
runs:
using: "composite"
steps:
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
# Install a specific version of uv.
version: "0.4.30"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.pythonVersion }}
python-version-file: ".python-version"
cache: "pip"
cache-dependency-path: |
requirements-dev.txt
requirements-docs.txt
pyproject.toml
- name: Install uv
run: |
pip install uv && uv venv venv && source venv/bin/activate
shell: bash
- run: echo "VIRTUAL_ENV=venv" >> $GITHUB_ENV
uv.lock
- run: echo "VIRTUAL_ENV=.venv" >> $GITHUB_ENV
shell: bash
- name: Install dependencies
run: |
uv pip install --upgrade --system pip && uv pip install --system pip-tools
if [[ "${{ inputs.dependencyType }}" == "dev" ]]; then
uv pip install --system -r requirements-dev.txt
elif [[ "${{ inputs.dependencyType }}" == "docs" ]]; then
uv pip install --system -r requirements-docs.txt
fi
uv pip install --system -e . --no-deps
- name: Install the project
run: uv sync --all-extras
shell: bash
16 changes: 3 additions & 13 deletions .github/workflows/on_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,16 @@ jobs:
fetch-depth: 0 # for documentation builds
- name: Set up Python and dependencies
uses: ./.github/actions/setup-python
with:
pythonVersion: "3.11"
dependencyType: "dev"
- name: Cache pre-commit tools
uses: actions/cache@v4
with:
path: |
${{ env.MYPY_CACHE_DIR }}
${{ env.RUFF_CACHE_DIR }}
${{ env.PRE_COMMIT_HOME }}
key: ${{ runner.os }}-${{ hashFiles('requirements-dev.txt', '.pre-commit-config.yaml') }}-linter-cache
key: ${{ runner.os }}-${{ hashFiles('uv.lock', '.pre-commit-config.yaml') }}-linter-cache
- name: Run pre-commit checks
run: pre-commit run --all-files --verbose --show-diff-on-failure
uses: pre-commit/[email protected]
test:
name: Test mlinfra on ubuntu-latest
runs-on: ubuntu-latest
Expand All @@ -46,13 +43,9 @@ jobs:
fetch-depth: 0
- name: Set up Python and dependencies
uses: ./.github/actions/setup-python
with:
pythonVersion: "3.11"
dependencyType: "dev"
- name: Run Tests
run: |
pytest
uv run pytest
docs:
name: Build documentation for mlinfra
runs-on: ubuntu-latest
Expand All @@ -62,9 +55,6 @@ jobs:
fetch-depth: 0
- name: Set up Python and dependencies
uses: ./.github/actions/setup-python
with:
pythonVersion: "3.11"
dependencyType: "docs"
- name: Build documentation using mike
uses: ./.github/actions/mike-docs
with:
Expand Down
10 changes: 1 addition & 9 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,8 @@ jobs:
fetch-depth: 0 # for documentation builds
- name: Set up Python and dependencies
uses: ./.github/actions/setup-python
with:
pythonVersion: "3.11"
dependencyType: "dev"
- name: Install build tools
run: |
pip install build
python -m build
run: uv build
- name: Upload build artifacts
uses: actions/[email protected]
with:
Expand All @@ -50,9 +45,6 @@ jobs:
ssh-key: ${{ secrets.DEPLOY_KEY }}
- name: Set up Python and dependencies
uses: ./.github/actions/setup-python
with:
pythonVersion: "3.11"
dependencyType: "docs"
- name: Append release notes to RELEASE_NOTES.md # automatically update release notes on new release
run: |
git config --local user.email "[email protected]"
Expand Down
24 changes: 6 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,6 @@ repos:
hooks:
- id: terraform_fmt
- id: terraform_validate
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.4.18
hooks:
- id: pip-compile
name: pip-compile requirements-dev.txt
args:
- --extra=dev
- --python-version=3.11
- --output-file=requirements-dev.txt
- pyproject.toml
files: ^(pyproject\.toml|requirements-dev\.txt)$
- id: pip-compile
name: pip-compile requirements-docs.txt
args:
- --extra=docs
- --output-file=requirements-docs.txt
- pyproject.toml
files: ^(pyproject\.toml|requirements-docs\.txt)$
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.5
hooks:
Expand All @@ -79,3 +61,9 @@ repos:
- LICENSE_HEADER.txt
- --use-current-year
- --no-extra-eol
- repo: https://github.com/astral-sh/uv-pre-commit
# uv version.
rev: 0.4.30
hooks:
# Update the uv lockfile
- id: uv-lock
8 changes: 4 additions & 4 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Release Notes

## 2024-11-04 - version 0.0.24

* fix: updated-cli-for-utils by @aliabbasjaffri in [#157](https://github.com/mlinfra-io/mlinfra/pull/157)



* fix: updated-cli-for-utils by @aliabbasjaffri in [#157](https://github.com/mlinfra-io/mlinfra/pull/157)


[**Full Changelog**](https://github.com/mlinfra-io/mlinfra/compare/0.0.23...0.0.24)

---
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Documentation = "https://mlinfra.io/"

[project.optional-dependencies]
dev = [
"pre-commit>=3.3.3",
"pre-commit",
"pytest",
"pytest-mock",
"zipp>=3.20.2"
Expand Down
96 changes: 0 additions & 96 deletions requirements-dev.txt

This file was deleted.

Loading

0 comments on commit 39407d0

Please sign in to comment.