Skip to content

Releases: openfga/python-sdk

v0.9.0

19 Dec 09:09
v0.9.0
6145ea6
Compare
Choose a tag to compare

0.9.0 (2024-12-19)

Added:

  • feat: add support for start_time parameter in ReadChanges endpoint (#156) - Note, this feature requires v1.8.0 of OpenFGA or newer
  • feat!: add support for BatchCheck API (#154) - Note, this feature requires v1.8.2 of OpenFGA or newer

Changed:

Warning

Usage of the existing batch_check should now use client_batch_check instead, additionally the existing
BatchCheckResponse has been renamed to ClientBatchCheckClientResponse.

Please see below for how to migrate your code, and #154 for more details on this change.

Migration

"I want to continue using client side batch check"

Given that this necessitates an upgrade of OpenFGA, it might not be feasible for everyone to switch to the new server based method, if you wish to delay the migration, rename the existing usage to the new method name as shown below.

- client.batch_check()
+ client.client_batch_check()

"I want to migrate to the new server based batch check"

If you wish to migrate to the new method, whilst the method name remains the same. You will need to alter the way you construct the checks passed.

  • Previously a list of ClientCheckRequest was constructed and passed directly to batch_check, now you should construct a list of ClientBatchCheckItem and pass a ClientBatchCheckRequest to batch_check with that list as the checks property
    • The correlation_id on a ClientBatchCheckItem is set for you if you do not provide it.
  • The result now contains a correlation_id property in addition to the error and request types and has removed the response property. Additionally, the error property is now of a CheckError type, rather than an Exception type.
checks = [
-  ClientCheckRequest(
+  ClientBatchCheckItem(
        user="user:1",
        relation="owner",
        object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
        contextual_tuples=[
            ClientTuple(
                user="user:1",
                relation="owner",
                object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
            )
        ]
    ),
-  ClientCheckRequest(
+  ClientBatchCheckItem(
        user="use:2",
        relation="owner",
        object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a"
    )
]

- result = fga_client.client_batch_check(checks)
+ result = fga_client.batch_check(ClientBatchCheckRequest(checks=checks))

# response.result = [{
#   allowed: true,
#   correlation_id: "de3630c2-f9be-4ee5-9441-cb1fbd82ce75", # generated by the SDK
#   tuple: {
#     user: "user:1",
#     relation: "viewer",
#     object: "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
#     contextual_tuples: [{
#       user: "user:1",
#       relation: "editor",
#       object: "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a"
#     }]
#   }
# }, {
#   allowed: false,
#   correlation_id: "6d7c7129-9607-480e-bfd0-17c16e46b9ec",
#   tuple: {
#     user="user:2",
#     relation="own",
#     object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a"
#   },
#   error: {
#     input_error: "validation_error",
#     message: "type 'doc' not found"
#   }
# }] 

v0.8.1

27 Nov 12:48
v0.8.1
1c690e8
Compare
Choose a tag to compare

0.8.1 (2024-11-26)

Added:

  • feat: allow specifying a request timeout (#151) - thanks @Oscmage

v0.8.0

15 Nov 17:38
v0.8.0
5e61ff0
Compare
Choose a tag to compare

0.8.0 (2024-11-15)

Added:

  • feat: allow configuring the token endpoint (#137) - thanks @Divan009!
  • feat: add per-HTTP request counter metric (#135)

Changed:

  • refactor: remove SDK version for OpenTelemetry meter name (#134)

Fixed:

  • fix: only send SDK method header from SDK wrapper methods (#142)
  • fix: unable to pass retry_params (#144)
  • fix: list users should send contextual tuples as a list (#147)
  • fix: handle no models existing in read_latest_authorization_model (#147)

v0.7.2

23 Sep 14:26
v0.7.2
a00f039
Compare
Choose a tag to compare

0.7.2 (2024-09-22)

This release includes improvements to the OpenTelemetry configuration API introduced in the previous releases

  • refactor: improve OpenTelemetry configuration (#127)

This release also includes fixes for several bugs identified in previous releases:

  • fix: ensure max_parallel_requests is an int value in batch_check (#132)
  • fix: inconsistency in 429 handling between sync/async client (#131)
  • fix: ensure telemetry is reported when API exceptions are raised (#127)

v0.7.1

17 Sep 02:52
v0.7.1
9e36918
Compare
Choose a tag to compare

0.7.1 (2024-09-16)

This release includes fixes for several bugs identified in the previous release related to OpenTelemetry metrics reporting: (#124)

  • fix: attribute values are now correctly exported as their intended types (previously, these were all sent as string values)
  • fix: http_client_request_duration being reported in seconds rather than the intended milliseconds
  • fix: sync client mistakenly passing the entire configuration (rather than just the OpenTelemetry configuration as intended) to queryDuration() and requestDuration()
  • fix: some attributes may not have been exported as expected under some conditions
  • fix: queryDuration() and requestDuration() may not have updated their histograms reliably when attr_http_client_request_duration or attr_http_server_request_duration (respectively) were not enabled (which is the default)

Please note that if you use third-party OpenTelemetry tooling to visualize the attributes mentioned above, you may need to update your queries to account for these changes.

v0.7.0

30 Aug 22:16
v0.7.0
fd37b12
Compare
Choose a tag to compare

0.7.0 (2024-08-30)

  • feat: enhancements to OpenTelemetry support (#120)

Breaking Changes

Note this introduces some breaking changes to our metrics:

  1. fga-client.request.method is now in TitleCase to match the naming conventions in the Protos, e.g., Check, ListObjects, etc.
  2. Due to possible high costs for attributes with high cardinality, we are no longer including the following attributes by default:
    • fga-client.user
    • http.client.request.duration
    • http.server.request.duration
      We added configuration options to allow you to set which specific metrics and attributes you care about in case the defaults don't work for your use case.

v0.6.1

31 Jul 17:02
v0.6.1
e82545e
Compare
Choose a tag to compare

0.6.1 (2024-07-31)

  • feat: add support for specifying consistency when evaluating or reading (#113)
    Note: To use this feature, you need to be running OpenFGA v1.5.7+ with the experimental flag enable-consistency-params enabled.
    See the OpenFGA v1.5.7 release notes for details.

v0.6.0

28 Jun 16:47
v0.6.0
9065ff1
Compare
Choose a tag to compare

0.6.0 (2024-06-28)

  • feat: add OpenTelemetry metrics reporting (#107)

v0.5.0

17 Jun 14:49
v0.5.0
6a540f3
Compare
Choose a tag to compare

0.5.0 (2024-06-17)

  • fix: ClientTuple condition property type
  • fix: list_users should accept FgaObject type
  • fix: remove ReadAuthorizationModel calls from BatchCheck and writes
  • chore!: remove excluded users from ListUsers response

v0.4.3

10 Jun 16:31
v0.4.3
664b0b9
Compare
Choose a tag to compare

0.4.3 (2024-06-07)

  • feat: support for list users