From 9607486b06b5b2b4338d441fe9c0b4714449d2f3 Mon Sep 17 00:00:00 2001 From: Pawel Kozik Date: Tue, 28 Jul 2026 11:45:01 +0200 Subject: [PATCH 1/3] [PLT-4135] Expose User.last_login_at in the Python SDK Map GraphQL lastLoginAt onto the User model so customers can read last session time via the SDK. --- libs/labelbox/CHANGELOG.md | 4 ++++ libs/labelbox/src/labelbox/schema/issue.py | 3 ++- libs/labelbox/src/labelbox/schema/user.py | 4 ++++ libs/labelbox/tests/integration/test_user_and_org.py | 3 +++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/libs/labelbox/CHANGELOG.md b/libs/labelbox/CHANGELOG.md index 1e9f562f2..451efc93f 100644 --- a/libs/labelbox/CHANGELOG.md +++ b/libs/labelbox/CHANGELOG.md @@ -1,4 +1,8 @@ # Changelog +# Version 7.11.0 (Unreleased) +## Added +* Add `User.last_login_at` to expose GraphQL `lastLoginAt` (nullable datetime of last session in the organization) ([#TBD](https://github.com/Labelbox/labelbox-python/pull/TBD)) + # Version 7.10.0 (2026-07-22) ## Added * Add `Tool.Type.MARKER` for video marker tool ontologies — fetching an ontology containing a marker tool no longer raises `ValueError` ([#2067](https://github.com/Labelbox/labelbox-python/pull/2067)) diff --git a/libs/labelbox/src/labelbox/schema/issue.py b/libs/labelbox/src/labelbox/schema/issue.py index af5da716d..8e246364c 100644 --- a/libs/labelbox/src/labelbox/schema/issue.py +++ b/libs/labelbox/src/labelbox/schema/issue.py @@ -37,7 +37,8 @@ class IssueStatus(str, Enum): # --------------------------------------------------------------------------- _USER_FIELDS = ( - "id email nickname name picture isViewer isExternalUser createdAt updatedAt" + "id email nickname name picture isViewer isExternalUser " + "createdAt updatedAt lastLoginAt" ) _COMMENT_FIELDS = ( diff --git a/libs/labelbox/src/labelbox/schema/user.py b/libs/labelbox/src/labelbox/schema/user.py index 4a3b27e18..dc490a2d5 100644 --- a/libs/labelbox/src/labelbox/schema/user.py +++ b/libs/labelbox/src/labelbox/schema/user.py @@ -14,6 +14,9 @@ class User(DbObject): Attributes: updated_at (datetime) created_at (datetime) + last_login_at (datetime or None): When this user last established a + session (login or workspace switch) in this organization. ``None`` + until the user logs in after last-login tracking was enabled. email (str) name (str) nickname (str) @@ -28,6 +31,7 @@ class User(DbObject): updated_at = Field.DateTime("updated_at") created_at = Field.DateTime("created_at") + last_login_at = Field.DateTime("last_login_at") email = Field.String("email") name = Field.String("nickname") nickname = Field.String("name") diff --git a/libs/labelbox/tests/integration/test_user_and_org.py b/libs/labelbox/tests/integration/test_user_and_org.py index 7bb72051f..e30426412 100644 --- a/libs/labelbox/tests/integration/test_user_and_org.py +++ b/libs/labelbox/tests/integration/test_user_and_org.py @@ -5,6 +5,9 @@ def test_user(client): user = client.get_user() assert user.uid is not None assert user.organization() == client.get_organization() + assert hasattr(user, "last_login_at") + # Nullable: None until the user has logged in after tracking was enabled. + assert user.last_login_at is None or hasattr(user.last_login_at, "year") def test_organization(client): From 19d82453aba5d13adb5240f182ba4f088f595e95 Mon Sep 17 00:00:00 2001 From: Pawel Kozik Date: Tue, 28 Jul 2026 11:50:10 +0200 Subject: [PATCH 2/3] [PLT-4135] Remove CHANGELOG entry from feature PR Changelog updates belong in the release Prep PR per the Python SDK release runbook. --- libs/labelbox/CHANGELOG.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libs/labelbox/CHANGELOG.md b/libs/labelbox/CHANGELOG.md index 451efc93f..1e9f562f2 100644 --- a/libs/labelbox/CHANGELOG.md +++ b/libs/labelbox/CHANGELOG.md @@ -1,8 +1,4 @@ # Changelog -# Version 7.11.0 (Unreleased) -## Added -* Add `User.last_login_at` to expose GraphQL `lastLoginAt` (nullable datetime of last session in the organization) ([#TBD](https://github.com/Labelbox/labelbox-python/pull/TBD)) - # Version 7.10.0 (2026-07-22) ## Added * Add `Tool.Type.MARKER` for video marker tool ontologies — fetching an ontology containing a marker tool no longer raises `ValueError` ([#2067](https://github.com/Labelbox/labelbox-python/pull/2067)) From 9237b4f99d0c2fac03428786cc7f80ab06082935 Mon Sep 17 00:00:00 2001 From: Pawel Kozik Date: Tue, 28 Jul 2026 11:58:46 +0200 Subject: [PATCH 3/3] [PLT-4135] Add lastLoginAt to unit test user fixtures DbObject requires every declared field in the response payload, so the issue fixtures need the new field to hydrate a User. --- libs/labelbox/tests/unit/schema/test_issue.py | 1 + libs/labelbox/tests/unit/schema/test_project_issues.py | 1 + 2 files changed, 2 insertions(+) diff --git a/libs/labelbox/tests/unit/schema/test_issue.py b/libs/labelbox/tests/unit/schema/test_issue.py index 47cdc772f..6e2360b1d 100644 --- a/libs/labelbox/tests/unit/schema/test_issue.py +++ b/libs/labelbox/tests/unit/schema/test_issue.py @@ -23,6 +23,7 @@ "isExternalUser": False, "createdAt": _NOW, "updatedAt": _NOW, + "lastLoginAt": _NOW, } _COMMENT_RAW = { diff --git a/libs/labelbox/tests/unit/schema/test_project_issues.py b/libs/labelbox/tests/unit/schema/test_project_issues.py index 2d814a0ff..01a88abf0 100644 --- a/libs/labelbox/tests/unit/schema/test_project_issues.py +++ b/libs/labelbox/tests/unit/schema/test_project_issues.py @@ -31,6 +31,7 @@ "isExternalUser": False, "createdAt": _NOW, "updatedAt": _NOW, + "lastLoginAt": _NOW, } _ISSUE_RAW = {