Entry Points
Both forms below return an xplain.XplainSession — the
recommended client. Pick whichever reads better in your code:
from xplain import create_session
# 1. Top-level helper (uses default profile from ~/.xplainpyrc)
xp = create_session()
# …or pick a named profile
xp = create_session(profile='production')
from xplain import XplainSession
# 2. Classmethod form — equivalent to the call above
xp = XplainSession.from_profile('production')
Both ultimately wrap the same underlying Xsession with the same
credential resolution rules (see Authentication & Credential Management). The result is
an XplainSession with the 8 namespaces ready to use:
xp.startup('TestSet1')
df = xp.query.attribute('Patients', 'Gender', 'Gender')
xp.select.values('Patients', 'Gender', ['Male'])
Attaching to an existing server session by ID:
xp = XplainSession.from_session_id(
url='https://xoe.example.com',
session_id='CED14155E7A90C9376749487A6B52C24',
)
Note
xplain.config.create_session() previously returned the legacy
xplain.Xsession. It now returns XplainSession.
Existing code that calls Xsession methods on the result
(session.startup, session.execute_query, session.run …)
continues to work — XplainSession delegates all public
Xsession methods. Only isinstance(session, Xsession) checks need
updating.