This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env -S uv run --quiet --script | |
# /// script | |
# dependencies = ["prefect"] | |
# /// | |
""" | |
Asset management script for Prefect Cloud. | |
This script provides CRUD operations for managing assets in Prefect Cloud workspaces. | |
Assets are created automatically by Prefect when events are emitted, but this script |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
📦 django | |
├── ⚡ functions: setup | |
├── 📌 constants: VERSION | |
├── 📦 apps | |
│ ├── 📜 __all__: AppConfig, apps | |
│ ├── 📦 config | |
│ │ ├── 🔷 classes: AppConfig | |
│ │ └── 📌 constants: APPS_MODULE_NAME, MODELS_MODULE_NAME | |
│ └── 📦 registry | |
│ └── 🔷 classes: Apps |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
from prefect import flow, task | |
@task | |
async def sleepy_task() -> None: | |
await asyncio.sleep(15) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import sleep | |
from prefect import flow | |
@flow | |
def sleepy(n: int = 3600): | |
sleep(n) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /// script | |
# dependencies = ["prefect"] | |
# /// | |
import webbrowser | |
from dataclasses import dataclass, field | |
from datetime import datetime | |
from pathlib import Path | |
from typing import Any |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from prefect import task | |
def some_fn(x: int, y: str) -> int: | |
return x + len(y) | |
some_task = task(some_fn) | |
print(some_task(x=1, y="hello")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Annotated | |
from pydantic import Field | |
from pydantic_ai import Agent | |
# the Field description is respected by the LLM as it produces a list[HistoricEvent] | |
HistoricEvent = Annotated[str, Field(description="what, where, when, how, why - very concise")] | |
historic_event_brainstormer = Agent[None, list[HistoricEvent]]( | |
"openai:gpt-4o", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /// script | |
# dependencies = ["marvin@git+https://github.com/PrefectHQ/marvin.git@marvin-3"] | |
# /// | |
from typing import Annotated, Any, TypedDict | |
from pydantic import ConfigDict, Field, create_model | |
from pydantic_core import to_json | |
import marvin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /// script | |
# dependencies = ["httpx", "pydantic-settings"] | |
# /// | |
from pathlib import Path | |
from typing import Any | |
import httpx | |
from pydantic import Field | |
from pydantic_settings import BaseSettings, SettingsConfigDict |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body style="margin:0;overflow:hidden;background:#000;"> | |
<canvas id="c"></canvas> | |
<div style="position:fixed;top:1em;right:1em;background:rgba(0,0,0,0.85);color:#fff;padding:1.5em;border-radius:8px;min-width:200px;box-shadow:0 2px 10px rgba(0,0,0,0.5);"> | |
<h3 style="margin:0 0 1em 0;font-family:system-ui;font-weight:400;">Particle Controls</h3> | |
<label style="display:block;margin-bottom:0.5em;font-family:system-ui;">Count: <span id="v" style="color:#8FBC8F;"></span></label> | |
<input id="count" type="range" min="10" max="2000" value="500" step="10" style="width:100%;margin-bottom:1em;"> | |
<label style="display:block;margin-bottom:0.5em;font-family:system-ui;">Attraction: <span id="fv" style="color:#87CEEB;"></span></label> | |
<input id="force" type="range" min="-10000" max="10000" value="0" step="10" style="width:100%;"> | |
</div> |
NewerOlder