File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22from pydantic_ai import Agent
33
44agent = 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
Original file line number Diff line number Diff 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
1414result = agent .run_sync ("Tell me about Tokyo" )
1515print (result .output )
Original file line number Diff line number Diff line change 11from pydantic_ai import Agent
22
33agent = 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
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ class UserSummary(BaseModel):
2121
2222
2323agent = Agent (
24- "google-gla :gemini-2.5-flash" ,
24+ "google:gemini-2.5-flash" ,
2525 output_type = UserSummary ,
2626 deps_type = UserDatabase ,
2727 instructions = (
Original file line number Diff line number Diff line change 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/ )
Original file line number Diff line number Diff line change 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 ()
You can’t perform that action at this time.
0 commit comments