otdf-python 0.3.1__py3-none-any.whl → 0.3.3__py3-none-any.whl

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.
otdf_python/cli.py CHANGED
@@ -20,7 +20,6 @@ from otdf_python.config import KASInfo, NanoTDFConfig, TDFConfig
20
20
  from otdf_python.sdk import SDK
21
21
  from otdf_python.sdk_builder import SDKBuilder
22
22
  from otdf_python.sdk_exceptions import SDKException
23
- from otdf_python.tdf import TDFReaderConfig
24
23
 
25
24
  try:
26
25
  __version__ = metadata.version("otdf-python")
@@ -310,10 +309,7 @@ def cmd_decrypt(args):
310
309
  if encrypted_data.startswith(b"PK"):
311
310
  # Regular TDF (ZIP format)
312
311
  logger.debug("Decrypting TDF")
313
- reader_config = TDFReaderConfig()
314
- tdf_reader = sdk.load_tdf_with_config(
315
- encrypted_data, reader_config
316
- )
312
+ tdf_reader = sdk.load_tdf(encrypted_data)
317
313
  # Access payload directly from TDFReader
318
314
  payload_bytes = tdf_reader.payload
319
315
  output_file.write(payload_bytes)
@@ -336,8 +332,7 @@ def cmd_decrypt(args):
336
332
  if encrypted_data.startswith(b"PK"):
337
333
  # Regular TDF (ZIP format)
338
334
  logger.debug("Decrypting TDF")
339
- reader_config = TDFReaderConfig()
340
- tdf_reader = sdk.load_tdf_with_config(encrypted_data, reader_config)
335
+ tdf_reader = sdk.load_tdf(encrypted_data)
341
336
  payload_bytes = tdf_reader.payload
342
337
  output_file.write(payload_bytes)
343
338
  logger.info("Successfully decrypted TDF")
@@ -370,10 +365,7 @@ def cmd_inspect(args):
370
365
  if encrypted_data.startswith(b"PK"):
371
366
  # Regular TDF
372
367
  logger.debug("Inspecting TDF")
373
- reader_config = TDFReaderConfig()
374
- tdf_reader = sdk.load_tdf_with_config(
375
- BytesIO(encrypted_data), reader_config
376
- )
368
+ tdf_reader = sdk.load_tdf(BytesIO(encrypted_data))
377
369
  manifest = tdf_reader.manifest
378
370
 
379
371
  # Try to get data attributes
otdf_python/sdk.py CHANGED
@@ -348,11 +348,13 @@ class SDK(AbstractContextManager):
348
348
  """Returns the platform URL if set"""
349
349
  return self.platform_url
350
350
 
351
- def load_tdf_with_config(
352
- self, tdf_data: bytes | BinaryIO | BytesIO, config: TDFReaderConfig
351
+ def load_tdf(
352
+ self,
353
+ tdf_data: bytes | BinaryIO | BytesIO,
354
+ config: TDFReaderConfig | None = None,
353
355
  ) -> TDFReader:
354
356
  """
355
- Loads a TDF from the provided data according to the config.
357
+ Loads a TDF from the provided data, optionally according to the config.
356
358
 
357
359
  Args:
358
360
  tdf_data: The TDF data as bytes, file object, or BytesIO
@@ -365,26 +367,10 @@ class SDK(AbstractContextManager):
365
367
  SDKException: If there's an error loading the TDF
366
368
  """
367
369
  tdf = TDF(self.services)
368
- return tdf.load_tdf(tdf_data, config)
369
-
370
- def load_tdf_without_config(
371
- self, tdf_data: bytes | BinaryIO | BytesIO
372
- ) -> TDFReader:
373
- """
374
- Loads a TDF from the provided data.
375
-
376
- Args:
377
- tdf_data: The TDF data as bytes, file object, or BytesIO
370
+ if config is None:
371
+ config = TDFReaderConfig()
378
372
 
379
- Returns:
380
- TDFReader: Contains payload and manifest
381
-
382
- Raises:
383
- SDKException: If there's an error loading the TDF
384
- """
385
- tdf = TDF(self.services)
386
- default = TDFReaderConfig()
387
- return tdf.load_tdf(tdf_data, default)
373
+ return tdf.load_tdf(tdf_data, config)
388
374
 
389
375
  def create_tdf(
390
376
  self,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: otdf-python
3
- Version: 0.3.1
3
+ Version: 0.3.3
4
4
  Summary: Unofficial OpenTDF SDK for Python
5
5
  Author-email: b-long <b-long@users.noreply.github.com>
6
6
  License-File: LICENSE
@@ -32,65 +32,6 @@ Unofficial OpenTDF SDK for Python
32
32
 
33
33
  A legacy version (0.2.x) of this project is available for users who need the previous implementation. For more information, see [LEGACY_VERSION.md](docs/LEGACY_VERSION.md) or visit the [legacy branch on GitHub](https://github.com/b-long/opentdf-python-sdk/tree/0.2.x).
34
34
 
35
- ## Prerequisites
36
-
37
- This project uses [uv](https://docs.astral.sh/uv/) for dependency management and task running.
38
-
39
- ### Installing uv
40
-
41
- Install `uv` using one of the following methods:
42
-
43
- **macOS/Linux:**
44
- ```bash
45
- curl -LsSf https://astral.sh/uv/install.sh | sh
46
- ```
47
-
48
- **Windows:**
49
- ```powershell
50
- powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
51
- ```
52
-
53
- **Using Homebrew (macOS):**
54
- ```bash
55
- brew install uv
56
- ```
57
-
58
- For more installation options, see the [uv installation guide](https://docs.astral.sh/uv/getting-started/installation/).
59
-
60
- ## Development Setup
61
-
62
- 1. Clone the repository:
63
- ```bash
64
- git clone <repository-url>
65
- cd opentdf-python-sdk
66
- ```
67
-
68
- 2. Install dependencies:
69
- ```bash
70
- uv sync
71
- ```
72
-
73
- ## Running Tests
74
-
75
- Run the full test suite:
76
- ```bash
77
- uv run pytest tests/
78
- ```
79
-
80
- Run specific test files:
81
- ```bash
82
- uv run pytest tests/test_sdk.py
83
- ```
84
-
85
- Run tests with verbose output:
86
- ```bash
87
- uv run pytest tests/ -v
88
- ```
89
-
90
- Run integration tests only:
91
- ```bash
92
- uv run pytest tests/ -m integration
93
- ```
94
35
 
95
36
  ## Installation
96
37
 
@@ -99,21 +40,6 @@ Install from PyPI:
99
40
  pip install otdf-python
100
41
  ```
101
42
 
102
-
103
- ## Protobuf & Connect RPC Generation
104
-
105
- This project uses a dedicated submodule, `otdf-python-proto/`, for generating Python protobuf files and Connect RPC clients from OpenTDF platform proto definitions.
106
-
107
- ### Regenerating Protobuf & Connect RPC Files
108
-
109
- From the submodule:
110
- ```bash
111
- cd otdf-python-proto
112
- uv run python scripts/generate_connect_proto.py
113
- ```
114
-
115
- See [`otdf-python-proto/README.md`](otdf-python-proto/README.md) and [`PROTOBUF_SETUP.md`](PROTOBUF_SETUP.md) for details.
116
-
117
43
  ## Quick Start
118
44
 
119
45
  ### Basic Configuration
@@ -160,7 +86,7 @@ sdk = builder.build()
160
86
  from io import BytesIO
161
87
 
162
88
  # Create TDF configuration with attributes
163
- config = sdk.new_tdf_config(attributes=["https://example.com/attr/classification/value/public"])
89
+ config = sdk.new_tdf_config(attributes=["https://example.net/attr/attr1/value/value1"])
164
90
 
165
91
  # Encrypt data to TDF format
166
92
  input_data = b"Hello, World!"
@@ -176,15 +102,12 @@ with open("encrypted.tdf", "wb") as f:
176
102
  ### Decrypt Data
177
103
 
178
104
  ```python
179
- from otdf_python.tdf import TDFReaderConfig
180
-
181
105
  # Read encrypted TDF file
182
106
  with open("encrypted.tdf", "rb") as f:
183
107
  encrypted_data = f.read()
184
108
 
185
109
  # Decrypt TDF
186
- reader_config = TDFReaderConfig()
187
- tdf_reader = sdk.load_tdf(encrypted_data, reader_config)
110
+ tdf_reader = sdk.load_tdf(encrypted_data)
188
111
  decrypted_data = tdf_reader.payload
189
112
 
190
113
  # Save decrypted data
@@ -208,6 +131,7 @@ src/otdf_python/
208
131
  └── ... # Additional modules
209
132
  tests/
210
133
  └── ... # Various tests
134
+ ```
211
135
 
212
136
  ## Contributing
213
137
 
@@ -215,14 +139,14 @@ tests/
215
139
  2. Create a feature branch: `git checkout -b feature-name`
216
140
  3. Make your changes
217
141
  4. Run tests: `uv run pytest tests/`
218
- 5. Commit your changes: `git commit -am 'Add feature'`
142
+ 5. Commit your changes: `git commit -am 'feat: add feature'`
219
143
  6. Push to the branch: `git push origin feature-name`
220
144
  7. Submit a pull request
221
145
 
222
146
  ### Release Process
223
147
 
224
148
  For maintainers and contributors working on releases:
225
- - See [RELEASES.md](RELEASES.md) for comprehensive release documentation
149
+ - See [RELEASES.md](docs/RELEASES.md) for comprehensive release documentation
226
150
  - Feature branch alpha releases available for testing changes before merge
227
151
  - Automated releases via Release Please on the main branch
228
152
 
@@ -8,7 +8,7 @@ otdf_python/asym_decryption.py,sha256=eVfgfzFHMK4ni3g-u8fBe3sdF02eo_msZouo19UBlh
8
8
  otdf_python/asym_encryption.py,sha256=ex-S_PvBnWKSSvbocTjJ_p5VQjjeiThcc9bMRZqvifw,2932
9
9
  otdf_python/auth_headers.py,sha256=LFjfWiobNo9DNaPgcm-aJANzHZh7_u9oHTxnEzEq-Ro,562
10
10
  otdf_python/autoconfigure_utils.py,sha256=NiNtbapBoIO-6kM59HRvX3Kj_Z0IRMrTkFlXjwuNfPc,3236
11
- otdf_python/cli.py,sha256=GoDmar7E4TG_kMTTa121TFL2aQGksrF_rQ4j9dPhuxQ,19838
11
+ otdf_python/cli.py,sha256=oRPn002DB7Xvc0y4oPzIFt97OmvMOYHwR6pZXrdwvAo,19463
12
12
  otdf_python/collection_store.py,sha256=MH1RxlevRVFj5lBS_6DN3zz5ZgOhBjD0P7AYBLBqS0o,1004
13
13
  otdf_python/collection_store_impl.py,sha256=g3YeSwMeXr1BNmwmFr75fv9ptPjieC36Bhct-Jf1trw,613
14
14
  otdf_python/config.py,sha256=uGYVByTWl7pWcKRER41ef-ay5VevIbOyUAEd6BIArVg,2185
@@ -35,7 +35,7 @@ otdf_python/policy_info.py,sha256=n9hgdQrTRqPO7O1R90EUtIyoWNlaABAF7mRfbjIzaX8,28
35
35
  otdf_python/policy_object.py,sha256=zzwHk6jhZwpiX2BWxTJ1kDl3cgFijQfQrKJP3OqI35Q,380
36
36
  otdf_python/policy_stub.py,sha256=BQn06Ye5MwCu9feJZFPmO_UTfhugtiQa539iBkSQwhQ,117
37
37
  otdf_python/resource_locator.py,sha256=zYN5yd9cGwN9SRQO2tUD1UXj2zkPl2apd-X4E1MrnDg,1879
38
- otdf_python/sdk.py,sha256=u-mYUv615AMxlh3yGaMADAwqmS2uEsIDBkZ9jUzmutI,17507
38
+ otdf_python/sdk.py,sha256=-JNrbk7Nr3IKsTX9BZp2OxPlCilaSbA8FmP7Zn_GWsU,17082
39
39
  otdf_python/sdk_builder.py,sha256=QEu9y5I8xLPBuR8O2AG7AWInqO7g4Q5-WGW0sIVsOmQ,15803
40
40
  otdf_python/sdk_exceptions.py,sha256=L_bYkkyF-hnEBFXfjT5C41i5lM-t8OJB5mU_1zYvfP8,479
41
41
  otdf_python/symmetric_and_payload_config.py,sha256=D_LArhk1gA5-tpUiaUZTTM90ZKdc3DCq1a6X8etCir8,992
@@ -131,7 +131,7 @@ otdf_python_proto/wellknownconfiguration/__init__.py,sha256=X3GeZJ1mG_N1MViryjkq
131
131
  otdf_python_proto/wellknownconfiguration/wellknown_configuration_pb2.py,sha256=g9xSm9TxX0IPMqiFCaridJvI2TrL8PrXVFPgu8tX9VM,3863
132
132
  otdf_python_proto/wellknownconfiguration/wellknown_configuration_pb2.pyi,sha256=Zw4vROvTgomnFqsalJrYda632ojXH0FVXSzTXxerybw,1490
133
133
  otdf_python_proto/wellknownconfiguration/wellknown_configuration_pb2_connect.py,sha256=i9rGG2mgQZfk6xGCp1ywu4QqKWSiwpuLoNKGUwl43t8,5346
134
- otdf_python-0.3.1.dist-info/METADATA,sha256=c_xz4PSK5R_IPZCa2jHFxYzZ6DkYAsMA5l2N2nya4gc,5822
135
- otdf_python-0.3.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
136
- otdf_python-0.3.1.dist-info/licenses/LICENSE,sha256=DPrPHdI6tfZcqk9kzQ37vh1Ftk7LJYdMrUtwKl7L3Pw,1074
137
- otdf_python-0.3.1.dist-info/RECORD,,
134
+ otdf_python-0.3.3.dist-info/METADATA,sha256=8NI8cmpOqLFh4QjizWUXIHiCCiWN5D1k11MhekFzAKQ,4279
135
+ otdf_python-0.3.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
136
+ otdf_python-0.3.3.dist-info/licenses/LICENSE,sha256=DPrPHdI6tfZcqk9kzQ37vh1Ftk7LJYdMrUtwKl7L3Pw,1074
137
+ otdf_python-0.3.3.dist-info/RECORD,,