persidict 0.17.3__tar.gz → 0.18.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.

Potentially problematic release.


This version of persidict might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: persidict
3
- Version: 0.17.3
3
+ Version: 0.18.0
4
4
  Summary: Simple persistent key-value store for Python. Values are stored as files on a disk or as S3 objects on AWS cloud.
5
5
  Keywords: persistence,dicts,distributed,parallel
6
6
  Author: Vlad (Volodymyr) Pavlov
@@ -201,7 +201,7 @@ Binary installers for the latest released version are available at the Python pa
201
201
 
202
202
  Using uv :
203
203
  ```
204
- uv install persidict
204
+ uv add persidict
205
205
  ```
206
206
 
207
207
  Using pip (legacy alternative to uv):
@@ -168,7 +168,7 @@ Binary installers for the latest released version are available at the Python pa
168
168
 
169
169
  Using uv :
170
170
  ```
171
- uv install persidict
171
+ uv add persidict
172
172
  ```
173
173
 
174
174
  Using pip (legacy alternative to uv):
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "persidict"
7
- version = "0.17.3"
7
+ version = "0.18.0"
8
8
  description = "Simple persistent key-value store for Python. Values are stored as files on a disk or as S3 objects on AWS cloud."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
Binary file
@@ -12,6 +12,7 @@ from __future__ import annotations
12
12
  import os
13
13
  import random
14
14
  import time
15
+ from abc import abstractmethod
15
16
  from typing import Any, Optional
16
17
 
17
18
  import joblib
@@ -110,6 +111,7 @@ class FileDirDict(PersiDict):
110
111
 
111
112
  return repr_str
112
113
 
114
+
113
115
  def get_params(self):
114
116
  """Return configuration parameters of the dictionary."""
115
117
  params = super().get_params()
@@ -119,9 +121,14 @@ class FileDirDict(PersiDict):
119
121
  params.update(additional_params)
120
122
  return params
121
123
 
124
+ @property
125
+ def base_url(self) -> str:
126
+ """Return dictionary's URL"""
127
+ return f"file://{self.base_dir}"
128
+
122
129
 
123
130
  def __len__(self) -> int:
124
- """ Get number of key-value pairs in the dictionary."""
131
+ """ Get the number of key-value pairs in the dictionary."""
125
132
 
126
133
  num_files = 0
127
134
  suffix = "." + self.file_type
@@ -102,6 +102,12 @@ class PersiDict(MutableMapping, ParameterizableClass):
102
102
  )
103
103
  return params
104
104
 
105
+ @property
106
+ @abstractmethod
107
+ def base_url(self):
108
+ """Return dictionary's URL"""
109
+ raise NotImplementedError
110
+
105
111
 
106
112
  def __repr__(self) -> str:
107
113
  """Return repr(self)"""
@@ -1,6 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import os
4
+ from abc import abstractmethod
4
5
  from typing import Any, Optional
5
6
 
6
7
  import boto3
@@ -107,6 +108,7 @@ class S3Dict(PersiDict):
107
108
 
108
109
  return repr_str
109
110
 
111
+
110
112
  def get_params(self):
111
113
  """Return configuration parameters of the object as a dictionary."""
112
114
  params = self.local_cache.get_params()
@@ -116,6 +118,13 @@ class S3Dict(PersiDict):
116
118
  return params
117
119
 
118
120
 
121
+ @property
122
+ def base_url(self):
123
+ """Return dictionary's URl"""
124
+ return f"s3://{self.bucket_name}/{self.root_prefix}"
125
+
126
+
127
+
119
128
  def _build_full_objectname(self, key:PersiDictKey) -> str:
120
129
  """ Convert PersiDictKey into an S3 objectname. """
121
130
  key = SafeStrTuple(key)