Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,23 +98,26 @@ jobs:
steps:
- name: Checkout current repo
uses: actions/checkout@v3
# Install python 3.10.17
- name: Install python 3.10.17
# Install python 3.11
- name: Install python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.10.17
python-version: "3.11"
- name: Install uv
run: |
python -m pip install --upgrade pip
python -m pip install uv
# Install dependencies
- uses: actions/cache@v3
id: cache
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
path: ~/.cache/uv
key: ${{ runner.os }}-uv-${{ hashFiles('requirements.txt','uv.lock') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-uv-
- name: Install requirements
run: |
pip install --upgrade pip
pip install -r requirements.txt
uv pip install --system -r requirements.txt
- name: Print workspace structure
run: |
echo "Current directory: $(pwd)"
Expand Down
44 changes: 27 additions & 17 deletions .github/workflows/test-all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,23 +86,26 @@ jobs:
# Source
- name: Checkout current repo
uses: actions/checkout@v4
# Install python 3.10.17
- name: Install python 3.10.17
# Install python 3.11
- name: Install python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.10.17
python-version: "3.11"
- name: Install uv
run: |
python -m pip install --upgrade pip
python -m pip install uv
# Install dependencies
- uses: actions/cache@v3
id: cache
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
path: ~/.cache/uv
key: ${{ runner.os }}-uv-${{ hashFiles('requirements.txt','uv.lock') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-uv-
- name: Install requirements
run: |
pip install --upgrade pip
pip install -r requirements.txt
uv pip install --system -r requirements.txt

- name: Run py tests
run: python -m cli.cli run-tests -r ${{ matrix.package }} -s py -fn $(basename "${{ matrix.package }}")
Expand All @@ -124,14 +127,17 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install python 3.10.17
- name: Install python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.10.17
python-version: "3.11"
- name: Install uv
run: |
python -m pip install --upgrade pip
python -m pip install uv
- name: Install requirements
run: |
pip install --upgrade pip
pip install -r requirements.txt
uv pip install --system -r requirements.txt
- name: Regenerate README tables
env:
CHANNEL: ${{ steps.branch.outputs.branch }}
Expand Down Expand Up @@ -170,14 +176,17 @@ jobs:
with:
repository: mlrun/marketplace
path: marketplace
- name: Install python 3.10.17
- name: Install python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.10.17
python-version: "3.11"
- name: Install uv
run: |
python -m pip install --upgrade pip
python -m pip install uv
- name: Install requirements
run: |
pip install --upgrade pip
pip install -r requirements.txt
uv pip install --system -r requirements.txt
- name: Build marketplace docs
env:
CHANNEL: ${{ steps.branch.outputs.branch }}
Expand Down Expand Up @@ -249,4 +258,5 @@ jobs:
echo "Pushing [$BRANCH_NAME] to remote [$REMOTE]"
git push -f $REMOTE $BRANCH_NAME
echo "Submiting pull request..."
gh pr create --title "Marketplace update from $BRANCH_NAME" --body "github-workflow" --base $BASE_BRANCH --head $BRANCH_NAME --repo $BASE_REPO/$REPO_PATH
gh pr create --title "Marketplace update from $BRANCH_NAME" --body "github-workflow" --base $BASE_BRANCH --head $BRANCH_NAME --repo $BASE_REPO/$REPO_PATH

8 changes: 5 additions & 3 deletions cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,19 @@
#
import click

from cli.common.generate_item_yaml import generate_item_yaml
from cli.common.test_suite import test_suite
from cli.common.update_readme import update_readme
from cli.functions.function_to_item import function_to_item_cli
from cli.functions.item_to_function import item_to_function_cli
from cli.marketplace.build import build_marketplace_cli
from cli.common.test_suite import test_suite
from cli.common.update_readme import update_readme
from cli.common.generate_item_yaml import generate_item_yaml


@click.group()
def cli():
pass


cli.add_command(generate_item_yaml, name="generate-item-yaml")
cli.add_command(item_to_function_cli, name="item-to-function")
cli.add_command(function_to_item_cli, name="function-to-item")
Expand Down
21 changes: 13 additions & 8 deletions cli/common/generate_item_yaml.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import sys
from datetime import UTC, datetime
from pathlib import Path
from datetime import datetime, timezone

import click
from jinja2 import Environment, FileSystemLoader

Expand All @@ -14,14 +15,18 @@
@click.command()
@click.argument("type", type=click.Choice(list(TEMPLATES.keys())))
@click.argument("name")
@click.option("--overwrite", is_flag=True, help="Replace existing file instead of raising an error.")
@click.option(
"--overwrite",
is_flag=True,
help="Replace existing file instead of raising an error.",
)
def generate_item_yaml(type: str, name: str, overwrite: bool = False):
"""
Generate an item.yaml file from a template.
Generate an item.yaml file from a template.

type: one of the supported types (currently only `function` or `module`)
name: the function/module name (also used as the directory name)
overwrite: whether to overwrite existing item.yaml file
type: one of the supported types (currently only `function` or `module`)
name: the function/module name (also used as the directory name)
overwrite: whether to overwrite existing item.yaml file
"""
# Construct the target path
path = Path(f"{type}s/src/{name}").resolve()
Expand All @@ -38,7 +43,7 @@ def generate_item_yaml(type: str, name: str, overwrite: bool = False):
# Render parameters
params = {
"example": f"{name}.ipynb",
"generationDate": datetime.now(timezone.utc).strftime("%Y-%m-%d:%H-%M"),
"generationDate": datetime.now(UTC).strftime("%Y-%m-%d:%H-%M"),
"name": name,
"filename": f"{name}.py",
}
Expand All @@ -53,4 +58,4 @@ def generate_item_yaml(type: str, name: str, overwrite: bool = False):


if __name__ == "__main__":
generate_item_yaml()
generate_item_yaml()
Loading
Loading