Skip to content

Commit 6ff1525

Browse files
authored
Merge branch 'master' into how-to-use-github
2 parents a6caef7 + a568540 commit 6ff1525

6 files changed

Lines changed: 42 additions & 4 deletions

File tree

pydantic-ai/cats.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from pydantic_ai import Agent
33

44
agent = Agent(
5-
"google-gla:gemini-2.5-flash",
5+
"google:gemini-2.5-flash",
66
instructions="Help users with cat breeds. Be concise.",
77
)
88

pydantic-ai/city.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class CityInfo(BaseModel):
99
fun_fact: str
1010

1111

12-
agent = Agent("google-gla:gemini-2.5-flash", output_type=CityInfo)
12+
agent = Agent("google:gemini-2.5-flash", output_type=CityInfo)
1313

1414
result = agent.run_sync("Tell me about Tokyo")
1515
print(result.output)

pydantic-ai/first_agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from pydantic_ai import Agent
22

33
agent = Agent(
4-
"google-gla:gemini-2.5-flash",
4+
"google:gemini-2.5-flash",
55
instructions="You're a Python Expert. Reply in one sentence.",
66
)
77

pydantic-ai/users.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class UserSummary(BaseModel):
2121

2222

2323
agent = Agent(
24-
"google-gla:gemini-2.5-flash",
24+
"google:gemini-2.5-flash",
2525
output_type=UserSummary,
2626
deps_type=UserDatabase,
2727
instructions=(

python315-jit-compiler/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Python 3.15 Preview: Upgraded JIT Compiler
2+
3+
This folder provides the code examples for the Real Python tutorial [Python 3.15 Preview: Upgraded JIT Compiler](https://realpython.com/python315-jit-compiler/)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"""Quick benchmark: compare CPython 3.15 with the JIT off vs on.
2+
3+
Run twice against the same 3.15 build and compare the two timings:
4+
5+
PYTHON_JIT=0 python quick_bench.py
6+
PYTHON_JIT=1 python quick_bench.py
7+
"""
8+
9+
import sys
10+
from timeit import timeit
11+
12+
ITERATIONS = 20_000_000
13+
REPEATS = 5
14+
15+
16+
def workload():
17+
x = 1.0
18+
for _ in range(ITERATIONS):
19+
x = x * 1.0001
20+
return x
21+
22+
23+
def jit_enabled():
24+
jit = getattr(sys, "_jit", None)
25+
return bool(jit and jit.is_enabled())
26+
27+
28+
def main():
29+
seconds = timeit(workload, number=REPEATS) / REPEATS
30+
label = "JIT on" if jit_enabled() else "JIT off"
31+
print(f"{label}: {seconds:.2f} s")
32+
33+
34+
if __name__ == "__main__":
35+
main()

0 commit comments

Comments
 (0)