This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Am I active</title> | |
</head> | |
<body> | |
<input name="testing"/> | |
<div class="context" style="margin-bottom: 100px"> |
This file contains 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
PointPydanticBaseModel v2.10.4: 538ns | |
PointPydanticTypedDict v2.10.4: 247ns | |
attrs v24.3.0: 551ns |
This file contains 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 json | |
from dataclasses import dataclass | |
from typing import Annotated, Any, Callable, Union | |
import pydantic_core | |
import pytest | |
from inline_snapshot import snapshot | |
from pydantic import BaseModel, Field | |
from pydantic_core import PydanticSerializationError |
This file contains 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
[ | |
{ | |
"id": 0, | |
"parent": null, | |
"path": "roadmap.md", | |
"level": 1, | |
"title": "Roadmap", | |
"content": "Here is the roadmap for **Pydantic Logfire**. This is a living document, and it will be updated as we progress.\n\nIf you have any questions, or a feature request, **please join our [Slack][slack]**." | |
}, | |
{ |
This file contains 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
""" | |
To run install: | |
logfire[fastapi] | |
fastapi | |
uvicorn | |
""" | |
import time | |
import logfire | |
import uvicorn | |
from fastapi import FastAPI |
This file contains 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 python3 | |
import os | |
import subprocess | |
import sys | |
from pathlib import Path | |
import tinify | |
# TODO find a way to check if files have already been tinified before processing | |
tinify.key = os.getenv('TINIFY_KEY') | |
if not tinify.key: |
This file contains 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 __future__ import annotations | |
import asyncio | |
import csv | |
import sys | |
from dataclasses import dataclass, asdict, fields | |
from pathlib import Path | |
from typing import Literal | |
import toml | |
from httpx import AsyncClient |
This file contains 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
<h1>Web worker demo</h1> | |
<h3>Write Code:</h3> | |
<textarea id="code" rows="10" cols="80">return "hello world";</textarea> | |
<button id="run">Run</button> | |
<h3>Output:</h3> | |
<pre id="output"></pre> | |
This file contains 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 time | |
from datetime import datetime, timedelta, timezone | |
from httpx import Client, Response, HTTPError | |
ACCOUNT_ID = '...' | |
PROJECT_NAME = '...' | |
ENDPOINT = f'https://api.cloudflare.com/client/v4/accounts/{ACCOUNT_ID}/pages/projects/{PROJECT_NAME}/deployments' | |
CF_API_TOKEN = '...' | |
EXPIRATION_BEFORE = datetime.now(timezone.utc) - timedelta(days=7) |
This file contains 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 timeit | |
from pathlib import Path | |
import orjson | |
import pydantic_core | |
import ujson | |
import json | |
cases = [ | |
('medium_response', Path('../jiter/benches/medium_response.json').read_bytes()), |
NewerOlder