2525from inspect import isclass
2626from warnings import warn
2727
28+ from ._codec .packstream import RUST_AVAILABLE
29+
2830
2931if t .TYPE_CHECKING :
3032 _FuncT = t .TypeVar ("_FuncT" , bound = t .Callable )
@@ -40,13 +42,17 @@ def _compute_bolt_agent() -> t.Dict[str, str]:
4042 def format_version_info (version_info ):
4143 return "{}.{}.{}-{}-{}" .format (* version_info )
4244
45+ language = "Python"
46+ if RUST_AVAILABLE :
47+ language += "-Rust"
48+
4349 return {
4450 "product" : f"neo4j-python/{ version } " ,
4551 "platform" :
4652 f"{ platform .system () or 'Unknown' } "
4753 f"{ platform .release () or 'unknown' } ; "
4854 f"{ platform .machine () or 'unknown' } " ,
49- "language" : f"Python /{ format_version_info (sys .version_info )} " ,
55+ "language" : f"{ language } /{ format_version_info (sys .version_info )} " ,
5056 "language_details" :
5157 f"{ platform .python_implementation ()} ; "
5258 f"{ format_version_info (sys .implementation .version )} "
@@ -59,9 +65,9 @@ def format_version_info(version_info):
5965
6066
6167def _compute_user_agent () -> str :
62- template = "neo4j-python/{} Python/{}.{}.{}-{}-{} ({})"
63- fields = ( version ,) + tuple ( sys . version_info ) + ( sys . platform ,)
64- return template . format ( * fields )
68+ return ( f' { BOLT_AGENT_DICT [ "product" ] } '
69+ f' { BOLT_AGENT_DICT [ "language" ] } '
70+ f'( { sys . platform } )' )
6571
6672
6773USER_AGENT = _compute_user_agent ()
0 commit comments