postkit 0.1.0__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. {postkit-0.1.0 → postkit-0.3.0}/PKG-INFO +14 -7
  2. {postkit-0.1.0 → postkit-0.3.0}/README.md +4 -3
  3. {postkit-0.1.0 → postkit-0.3.0}/pyproject.toml +24 -8
  4. {postkit-0.1.0 → postkit-0.3.0}/src/postkit/__init__.py +0 -2
  5. {postkit-0.1.0 → postkit-0.3.0}/src/postkit/authn/__init__.py +2 -0
  6. postkit-0.3.0/src/postkit/authn/client.py +1376 -0
  7. {postkit-0.1.0 → postkit-0.3.0}/src/postkit/authz/__init__.py +2 -0
  8. postkit-0.3.0/src/postkit/authz/client.py +1313 -0
  9. postkit-0.3.0/src/postkit/base.py +521 -0
  10. postkit-0.3.0/src/postkit/config/__init__.py +17 -0
  11. postkit-0.3.0/src/postkit/config/client.py +596 -0
  12. postkit-0.3.0/src/postkit/errors.py +280 -0
  13. postkit-0.3.0/src/postkit/lease/__init__.py +17 -0
  14. postkit-0.3.0/src/postkit/lease/client.py +319 -0
  15. postkit-0.3.0/src/postkit/meter/__init__.py +6 -0
  16. postkit-0.3.0/src/postkit/meter/client.py +662 -0
  17. postkit-0.3.0/src/postkit/outbox/__init__.py +17 -0
  18. postkit-0.3.0/src/postkit/outbox/client.py +343 -0
  19. postkit-0.3.0/src/postkit/queue/__init__.py +6 -0
  20. postkit-0.3.0/src/postkit/queue/client.py +843 -0
  21. {postkit-0.1.0 → postkit-0.3.0}/tests/authn/conftest.py +44 -48
  22. postkit-0.3.0/tests/authn/helpers.py +208 -0
  23. postkit-0.3.0/tests/authn/test_audit.py +471 -0
  24. postkit-0.3.0/tests/authn/test_base.py +90 -0
  25. postkit-0.3.0/tests/authn/test_credentials.py +476 -0
  26. postkit-0.3.0/tests/authn/test_disabled_user.py +503 -0
  27. postkit-0.3.0/tests/authn/test_e2e_demo.py +305 -0
  28. postkit-0.3.0/tests/authn/test_impersonation.py +799 -0
  29. {postkit-0.1.0 → postkit-0.3.0}/tests/authn/test_lockout.py +20 -6
  30. postkit-0.3.0/tests/authn/test_maintenance.py +266 -0
  31. postkit-0.3.0/tests/authn/test_operator_impersonation.py +1137 -0
  32. postkit-0.3.0/tests/authn/test_refresh_tokens.py +372 -0
  33. postkit-0.3.0/tests/authn/test_rls.py +247 -0
  34. {postkit-0.1.0 → postkit-0.3.0}/tests/authn/test_sessions.py +148 -9
  35. {postkit-0.1.0 → postkit-0.3.0}/tests/authn/test_tokens.py +8 -12
  36. postkit-0.3.0/tests/authn/test_users.py +508 -0
  37. {postkit-0.1.0 → postkit-0.3.0}/tests/authn/test_validation.py +102 -30
  38. postkit-0.3.0/tests/authz/__init__.py +0 -0
  39. {postkit-0.1.0 → postkit-0.3.0}/tests/authz/conftest.py +24 -46
  40. {postkit-0.1.0 → postkit-0.3.0}/tests/authz/helpers.py +13 -0
  41. {postkit-0.1.0 → postkit-0.3.0}/tests/authz/test_access_patterns.py +94 -126
  42. {postkit-0.1.0 → postkit-0.3.0}/tests/authz/test_audit.py +187 -77
  43. {postkit-0.1.0 → postkit-0.3.0}/tests/authz/test_concurrency.py +138 -36
  44. {postkit-0.1.0 → postkit-0.3.0}/tests/authz/test_consistency.py +39 -48
  45. {postkit-0.1.0 → postkit-0.3.0}/tests/authz/test_e2e_demo.py +47 -73
  46. {postkit-0.1.0 → postkit-0.3.0}/tests/authz/test_expiration.py +101 -29
  47. {postkit-0.1.0 → postkit-0.3.0}/tests/authz/test_groups.py +32 -39
  48. postkit-0.3.0/tests/authz/test_hierarchy.py +355 -0
  49. postkit-0.3.0/tests/authz/test_listing.py +201 -0
  50. postkit-0.3.0/tests/authz/test_maintenance.py +165 -0
  51. {postkit-0.1.0 → postkit-0.3.0}/tests/authz/test_namespaces.py +9 -26
  52. {postkit-0.1.0 → postkit-0.3.0}/tests/authz/test_nested_teams.py +56 -48
  53. {postkit-0.1.0 → postkit-0.3.0}/tests/authz/test_resource_hierarchy.py +42 -42
  54. postkit-0.3.0/tests/authz/test_rls.py +431 -0
  55. postkit-0.3.0/tests/authz/test_sdk.py +602 -0
  56. {postkit-0.1.0 → postkit-0.3.0}/tests/authz/test_stress.py +37 -53
  57. postkit-0.3.0/tests/authz/test_transactions.py +63 -0
  58. {postkit-0.1.0 → postkit-0.3.0}/tests/authz/test_validation.py +138 -45
  59. postkit-0.3.0/tests/config/__init__.py +0 -0
  60. postkit-0.3.0/tests/config/conftest.py +86 -0
  61. postkit-0.3.0/tests/config/helpers.py +83 -0
  62. postkit-0.3.0/tests/config/test_audit.py +404 -0
  63. postkit-0.3.0/tests/config/test_entries.py +664 -0
  64. postkit-0.3.0/tests/config/test_rls.py +235 -0
  65. postkit-0.3.0/tests/config/test_schemas.py +314 -0
  66. postkit-0.3.0/tests/config/test_tenancy.py +85 -0
  67. postkit-0.3.0/tests/config/test_validation.py +35 -0
  68. postkit-0.3.0/tests/conftest.py +32 -0
  69. postkit-0.3.0/tests/helpers.py +207 -0
  70. postkit-0.3.0/tests/integration/conftest.py +147 -0
  71. postkit-0.3.0/tests/integration/test_api_keys.py +150 -0
  72. postkit-0.3.0/tests/lease/__init__.py +0 -0
  73. postkit-0.3.0/tests/lease/conftest.py +102 -0
  74. postkit-0.3.0/tests/lease/helpers.py +113 -0
  75. postkit-0.3.0/tests/lease/test_acquire.py +162 -0
  76. postkit-0.3.0/tests/lease/test_events.py +93 -0
  77. postkit-0.3.0/tests/lease/test_invariants.py +149 -0
  78. postkit-0.3.0/tests/lease/test_maintenance.py +104 -0
  79. postkit-0.3.0/tests/lease/test_renew_release.py +73 -0
  80. postkit-0.3.0/tests/lease/test_tenancy.py +175 -0
  81. postkit-0.3.0/tests/lease/test_validation.py +85 -0
  82. postkit-0.3.0/tests/lease/test_verify_fencing.py +280 -0
  83. postkit-0.3.0/tests/meter/conftest.py +84 -0
  84. postkit-0.3.0/tests/meter/helpers.py +128 -0
  85. postkit-0.3.0/tests/meter/test_periods.py +701 -0
  86. postkit-0.3.0/tests/meter/test_reservation_expiry_race.py +255 -0
  87. postkit-0.3.0/tests/meter/test_rls.py +179 -0
  88. postkit-0.3.0/tests/meter/test_sdk.py +872 -0
  89. postkit-0.3.0/tests/meter/test_validation.py +101 -0
  90. postkit-0.3.0/tests/outbox/__init__.py +0 -0
  91. postkit-0.3.0/tests/outbox/conftest.py +81 -0
  92. postkit-0.3.0/tests/outbox/helpers.py +141 -0
  93. postkit-0.3.0/tests/outbox/test_emit.py +86 -0
  94. postkit-0.3.0/tests/outbox/test_horizon.py +208 -0
  95. postkit-0.3.0/tests/outbox/test_lost_cursor.py +111 -0
  96. postkit-0.3.0/tests/outbox/test_maintenance.py +242 -0
  97. postkit-0.3.0/tests/outbox/test_subscribe_poll_ack.py +173 -0
  98. postkit-0.3.0/tests/outbox/test_tenancy.py +120 -0
  99. postkit-0.3.0/tests/outbox/test_validation.py +131 -0
  100. postkit-0.3.0/tests/queue/__init__.py +1 -0
  101. postkit-0.3.0/tests/queue/conftest.py +100 -0
  102. postkit-0.3.0/tests/queue/helpers.py +130 -0
  103. postkit-0.3.0/tests/queue/test_ack.py +344 -0
  104. postkit-0.3.0/tests/queue/test_cron.py +192 -0
  105. postkit-0.3.0/tests/queue/test_dead_letters.py +316 -0
  106. postkit-0.3.0/tests/queue/test_e2e_demo.py +375 -0
  107. postkit-0.3.0/tests/queue/test_nack_ack_race.py +240 -0
  108. postkit-0.3.0/tests/queue/test_pull.py +204 -0
  109. postkit-0.3.0/tests/queue/test_purge.py +46 -0
  110. postkit-0.3.0/tests/queue/test_push.py +175 -0
  111. postkit-0.3.0/tests/queue/test_release_jobs.py +102 -0
  112. postkit-0.3.0/tests/queue/test_rls.py +235 -0
  113. postkit-0.3.0/tests/queue/test_schedules.py +351 -0
  114. postkit-0.3.0/tests/queue/test_stats.py +134 -0
  115. postkit-0.3.0/tests/queue/test_tenancy.py +170 -0
  116. postkit-0.3.0/tests/queue/test_tick.py +220 -0
  117. postkit-0.3.0/tests/queue/test_tick_timeouts.py +150 -0
  118. postkit-0.3.0/tests/queue/test_validation.py +62 -0
  119. postkit-0.3.0/tests/test_error_codes.py +86 -0
  120. postkit-0.3.0/uv.lock +375 -0
  121. postkit-0.1.0/src/postkit/authn/client.py +0 -567
  122. postkit-0.1.0/src/postkit/authz/client.py +0 -913
  123. postkit-0.1.0/tests/authn/helpers.py +0 -108
  124. postkit-0.1.0/tests/authn/test_audit.py +0 -212
  125. postkit-0.1.0/tests/authn/test_credentials.py +0 -78
  126. postkit-0.1.0/tests/authn/test_maintenance.py +0 -96
  127. postkit-0.1.0/tests/authn/test_mfa.py +0 -135
  128. postkit-0.1.0/tests/authn/test_rls.py +0 -79
  129. postkit-0.1.0/tests/authn/test_users.py +0 -244
  130. postkit-0.1.0/tests/authz/test_hierarchy.py +0 -170
  131. postkit-0.1.0/tests/authz/test_listing.py +0 -139
  132. postkit-0.1.0/tests/authz/test_maintenance.py +0 -166
  133. postkit-0.1.0/tests/authz/test_rls.py +0 -230
  134. postkit-0.1.0/tests/authz/test_sdk.py +0 -178
  135. postkit-0.1.0/tests/authz/test_transactions.py +0 -87
  136. postkit-0.1.0/tests/conftest.py +0 -7
  137. postkit-0.1.0/uv.lock +0 -251
  138. {postkit-0.1.0 → postkit-0.3.0}/.gitignore +0 -0
  139. /postkit-0.1.0/tests/__init__.py → /postkit-0.3.0/src/postkit/py.typed +0 -0
  140. {postkit-0.1.0/tests/authn → postkit-0.3.0/tests}/__init__.py +0 -0
  141. {postkit-0.1.0/tests/authz → postkit-0.3.0/tests/authn}/__init__.py +0 -0
@@ -1,9 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: postkit
3
- Version: 0.1.0
4
- Summary: PostgreSQL-native authentication and authorization SDK
3
+ Version: 0.3.0
4
+ Summary: PostgreSQL-native auth, permissions, versioned config, usage tracking, and job queues
5
5
  Project-URL: Homepage, https://github.com/varunchopra/postkit
6
6
  Project-URL: Repository, https://github.com/varunchopra/postkit
7
+ Project-URL: Documentation, https://github.com/varunchopra/postkit/tree/main/docs
8
+ Project-URL: Issues, https://github.com/varunchopra/postkit/issues
7
9
  Author: Varun Chopra
8
10
  License-Expression: Apache-2.0
9
11
  Keywords: authentication,authorization,postgresql,rebac,sdk
@@ -11,24 +13,28 @@ Classifier: Development Status :: 4 - Beta
11
13
  Classifier: Intended Audience :: Developers
12
14
  Classifier: License :: OSI Approved :: Apache Software License
13
15
  Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3.10
15
16
  Classifier: Programming Language :: Python :: 3.11
16
17
  Classifier: Programming Language :: Python :: 3.12
17
18
  Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
18
20
  Classifier: Topic :: Database
19
21
  Classifier: Topic :: Security
20
- Requires-Python: >=3.10
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: >=3.11
24
+ Requires-Dist: jsonschema>=4.0.0
21
25
  Requires-Dist: psycopg>=3.1.0
22
26
  Provides-Extra: binary
23
27
  Requires-Dist: psycopg[binary]>=3.1.0; extra == 'binary'
24
28
  Provides-Extra: dev
25
29
  Requires-Dist: psycopg[binary]>=3.1.0; extra == 'dev'
30
+ Requires-Dist: pytest-randomly>=3.0; extra == 'dev'
31
+ Requires-Dist: pytest-xdist>=3.0; extra == 'dev'
26
32
  Requires-Dist: pytest>=7.0; extra == 'dev'
27
33
  Description-Content-Type: text/markdown
28
34
 
29
- # postkit
35
+ # postkit SDK
30
36
 
31
- PostgreSQL-native authentication and authorization SDK.
37
+ Python client for postkit.
32
38
 
33
39
  ## Installation
34
40
 
@@ -48,8 +54,9 @@ cursor = conn.cursor()
48
54
 
49
55
  # Authorization
50
56
  authz = AuthzClient(cursor, namespace="my-app")
57
+ authz.set_hierarchy("repo", "admin", "write", "read")
51
58
  authz.grant("admin", resource=("repo", "api"), subject=("user", "alice"))
52
- if authz.check("alice", "read", ("repo", "api")):
59
+ if authz.check(("user", "alice"), "read", ("repo", "api")):
53
60
  print("Access granted")
54
61
 
55
62
  # Authentication
@@ -1,6 +1,6 @@
1
- # postkit
1
+ # postkit SDK
2
2
 
3
- PostgreSQL-native authentication and authorization SDK.
3
+ Python client for postkit.
4
4
 
5
5
  ## Installation
6
6
 
@@ -20,8 +20,9 @@ cursor = conn.cursor()
20
20
 
21
21
  # Authorization
22
22
  authz = AuthzClient(cursor, namespace="my-app")
23
+ authz.set_hierarchy("repo", "admin", "write", "read")
23
24
  authz.grant("admin", resource=("repo", "api"), subject=("user", "alice"))
24
- if authz.check("alice", "read", ("repo", "api")):
25
+ if authz.check(("user", "alice"), "read", ("repo", "api")):
25
26
  print("Access granted")
26
27
 
27
28
  # Authentication
@@ -1,33 +1,49 @@
1
1
  [project]
2
2
  name = "postkit"
3
- version = "0.1.0"
4
- description = "PostgreSQL-native authentication and authorization SDK"
3
+ version = "0.3.0"
4
+ description = "PostgreSQL-native auth, permissions, versioned config, usage tracking, and job queues"
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
7
- requires-python = ">=3.10"
8
- authors = [{ name = "Varun Chopra" }]
9
- keywords = ["postgresql", "authentication", "authorization", "rebac", "sdk"]
7
+ requires-python = ">=3.11"
8
+ keywords = [
9
+ "postgresql",
10
+ "authentication",
11
+ "authorization",
12
+ "rebac",
13
+ "sdk",
14
+ ]
10
15
  classifiers = [
11
16
  "Development Status :: 4 - Beta",
12
17
  "Intended Audience :: Developers",
13
18
  "License :: OSI Approved :: Apache Software License",
14
19
  "Programming Language :: Python :: 3",
15
- "Programming Language :: Python :: 3.10",
16
20
  "Programming Language :: Python :: 3.11",
17
21
  "Programming Language :: Python :: 3.12",
18
22
  "Programming Language :: Python :: 3.13",
23
+ "Programming Language :: Python :: 3.14",
19
24
  "Topic :: Database",
20
25
  "Topic :: Security",
26
+ "Typing :: Typed",
21
27
  ]
22
- dependencies = ["psycopg>=3.1.0"]
28
+ dependencies = ["psycopg>=3.1.0", "jsonschema>=4.0.0"]
29
+
30
+ [[project.authors]]
31
+ name = "Varun Chopra"
23
32
 
24
33
  [project.optional-dependencies]
25
34
  binary = ["psycopg[binary]>=3.1.0"]
26
- dev = ["pytest>=7.0", "psycopg[binary]>=3.1.0"]
35
+ dev = [
36
+ "psycopg[binary]>=3.1.0",
37
+ "pytest>=7.0",
38
+ "pytest-xdist>=3.0",
39
+ "pytest-randomly>=3.0",
40
+ ]
27
41
 
28
42
  [project.urls]
29
43
  Homepage = "https://github.com/varunchopra/postkit"
30
44
  Repository = "https://github.com/varunchopra/postkit"
45
+ Documentation = "https://github.com/varunchopra/postkit/tree/main/docs"
46
+ Issues = "https://github.com/varunchopra/postkit/issues"
31
47
 
32
48
  [build-system]
33
49
  requires = ["hatchling"]
@@ -5,5 +5,3 @@ Usage:
5
5
  from postkit.authz import AuthzClient
6
6
  from postkit.authn import AuthnClient
7
7
  """
8
-
9
- __version__ = "0.1.0"
@@ -5,9 +5,11 @@ from postkit.authn.client import (
5
5
  AuthnError,
6
6
  AuthnValidationError,
7
7
  )
8
+ from postkit.errors import AuthnErrorCode
8
9
 
9
10
  __all__ = [
10
11
  "AuthnClient",
11
12
  "AuthnError",
13
+ "AuthnErrorCode",
12
14
  "AuthnValidationError",
13
15
  ]