Skip to content

Instantly share code, notes, and snippets.

View zzstoatzz's full-sized avatar
🌴
On vacation

nate nowack zzstoatzz

🌴
On vacation
View GitHub Profile
did:plc:o53crari67ge7bvbv273lxln
#!/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
@zzstoatzz
zzstoatzz / output
Created June 9, 2025 16:42
» uvx --with django pretty-mod tree django --depth 5 | pbcopy
📦 django
├── ⚡ functions: setup
├── 📌 constants: VERSION
├── 📦 apps
│ ├── 📜 __all__: AppConfig, apps
│ ├── 📦 config
│ │ ├── 🔷 classes: AppConfig
│ │ └── 📌 constants: APPS_MODULE_NAME, MODELS_MODULE_NAME
│ └── 📦 registry
│ └── 🔷 classes: Apps
import asyncio
from prefect import flow, task
@task
async def sleepy_task() -> None:
await asyncio.sleep(15)
from time import sleep
from prefect import flow
@flow
def sleepy(n: int = 3600):
sleep(n)
# /// script
# dependencies = ["prefect"]
# ///
import webbrowser
from dataclasses import dataclass, field
from datetime import datetime
from pathlib import Path
from typing import Any
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"))
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",
# /// 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
# /// 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