cloud-files 5.3.2__tar.gz → 5.4.1__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 (38) hide show
  1. {cloud_files-5.3.2 → cloud_files-5.4.1}/ChangeLog +17 -0
  2. {cloud_files-5.3.2 → cloud_files-5.4.1}/PKG-INFO +2 -3
  3. {cloud_files-5.3.2 → cloud_files-5.4.1}/automated_test.py +3 -0
  4. {cloud_files-5.3.2 → cloud_files-5.4.1}/cloud_files.egg-info/PKG-INFO +2 -3
  5. cloud_files-5.4.1/cloud_files.egg-info/pbr.json +1 -0
  6. {cloud_files-5.3.2 → cloud_files-5.4.1}/cloudfiles/cloudfiles.py +1 -2
  7. {cloud_files-5.3.2 → cloud_files-5.4.1}/cloudfiles/interfaces.py +21 -4
  8. {cloud_files-5.3.2 → cloud_files-5.4.1}/cloudfiles/paths.py +7 -2
  9. {cloud_files-5.3.2 → cloud_files-5.4.1}/cloudfiles/secrets.py +16 -12
  10. {cloud_files-5.3.2 → cloud_files-5.4.1}/cloudfiles_cli/cloudfiles_cli.py +1 -1
  11. {cloud_files-5.3.2 → cloud_files-5.4.1}/setup.cfg +1 -2
  12. cloud_files-5.3.2/cloud_files.egg-info/pbr.json +0 -1
  13. {cloud_files-5.3.2 → cloud_files-5.4.1}/.github/workflows/test-suite.yml +0 -0
  14. {cloud_files-5.3.2 → cloud_files-5.4.1}/AUTHORS +0 -0
  15. {cloud_files-5.3.2 → cloud_files-5.4.1}/LICENSE +0 -0
  16. {cloud_files-5.3.2 → cloud_files-5.4.1}/MANIFEST.in +0 -0
  17. {cloud_files-5.3.2 → cloud_files-5.4.1}/README.md +0 -0
  18. {cloud_files-5.3.2 → cloud_files-5.4.1}/cloud_files.egg-info/SOURCES.txt +0 -0
  19. {cloud_files-5.3.2 → cloud_files-5.4.1}/cloud_files.egg-info/dependency_links.txt +0 -0
  20. {cloud_files-5.3.2 → cloud_files-5.4.1}/cloud_files.egg-info/entry_points.txt +0 -0
  21. {cloud_files-5.3.2 → cloud_files-5.4.1}/cloud_files.egg-info/not-zip-safe +0 -0
  22. {cloud_files-5.3.2 → cloud_files-5.4.1}/cloud_files.egg-info/requires.txt +0 -0
  23. {cloud_files-5.3.2 → cloud_files-5.4.1}/cloud_files.egg-info/top_level.txt +0 -0
  24. {cloud_files-5.3.2 → cloud_files-5.4.1}/cloudfiles/__init__.py +0 -0
  25. {cloud_files-5.3.2 → cloud_files-5.4.1}/cloudfiles/compression.py +0 -0
  26. {cloud_files-5.3.2 → cloud_files-5.4.1}/cloudfiles/connectionpools.py +0 -0
  27. {cloud_files-5.3.2 → cloud_files-5.4.1}/cloudfiles/exceptions.py +0 -0
  28. {cloud_files-5.3.2 → cloud_files-5.4.1}/cloudfiles/gcs.py +0 -0
  29. {cloud_files-5.3.2 → cloud_files-5.4.1}/cloudfiles/lib.py +0 -0
  30. {cloud_files-5.3.2 → cloud_files-5.4.1}/cloudfiles/resumable_tools.py +0 -0
  31. {cloud_files-5.3.2 → cloud_files-5.4.1}/cloudfiles/scheduler.py +0 -0
  32. {cloud_files-5.3.2 → cloud_files-5.4.1}/cloudfiles/test.py +0 -0
  33. {cloud_files-5.3.2 → cloud_files-5.4.1}/cloudfiles/threaded_queue.py +0 -0
  34. {cloud_files-5.3.2 → cloud_files-5.4.1}/cloudfiles/typing.py +0 -0
  35. {cloud_files-5.3.2 → cloud_files-5.4.1}/cloudfiles_cli/LICENSE +0 -0
  36. {cloud_files-5.3.2 → cloud_files-5.4.1}/cloudfiles_cli/__init__.py +0 -0
  37. {cloud_files-5.3.2 → cloud_files-5.4.1}/requirements.txt +0 -0
  38. {cloud_files-5.3.2 → cloud_files-5.4.1}/setup.py +0 -0
@@ -1,6 +1,23 @@
1
1
  CHANGES
2
2
  =======
3
3
 
4
+ 5.4.1
5
+ -----
6
+
7
+ * fix: enable CAVE to accept secret kw and alternative server credentials
8
+ * fix(cave): ensure CAVE tokens are handled properly
9
+ * fix: isdir was inverted for http
10
+ * chore: update changelog
11
+ * fix(cli): incorrect escaping
12
+
13
+ 5.4.0
14
+ -----
15
+
16
+ * test: check nokura works in path parsing
17
+ * install: fix license information
18
+ * fix: expand hardcoded references to "matrix"
19
+ * feat(alias): add "nokura" as an official alias
20
+
4
21
  5.3.2
5
22
  -----
6
23
 
@@ -1,14 +1,13 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cloud-files
3
- Version: 5.3.2
3
+ Version: 5.4.1
4
4
  Summary: Fast access to cloud storage and local FS.
5
5
  Home-page: https://github.com/seung-lab/cloud-files/
6
6
  Author: William Silversmith
7
7
  Author-email: ws9@princeton.edu
8
- License: License :: OSI Approved :: BSD License
8
+ License: BSD-3-Clause
9
9
  Classifier: Intended Audience :: Developers
10
10
  Classifier: Development Status :: 4 - Beta
11
- Classifier: License :: OSI Approved :: BSD License
12
11
  Classifier: Programming Language :: Python :: 3
13
12
  Classifier: Programming Language :: Python :: 3.9
14
13
  Classifier: Programming Language :: Python :: 3.10
@@ -749,6 +749,9 @@ def test_to_https_protocol():
749
749
  pth = to_https_protocol("matrix://my_bucket/to/heaven")
750
750
  assert pth == "https://s3-hpcrc.rc.princeton.edu/my_bucket/to/heaven"
751
751
 
752
+ pth = to_https_protocol("nokura://my_bucket/to/heaven")
753
+ assert pth == "https://nokura.pni.princeton.edu/my_bucket/to/heaven"
754
+
752
755
  pth = to_https_protocol("tigerdata://my_bucket/to/heaven")
753
756
  assert pth == "https://td.princeton.edu/my_bucket/to/heaven"
754
757
 
@@ -1,14 +1,13 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cloud-files
3
- Version: 5.3.2
3
+ Version: 5.4.1
4
4
  Summary: Fast access to cloud storage and local FS.
5
5
  Home-page: https://github.com/seung-lab/cloud-files/
6
6
  Author: William Silversmith
7
7
  Author-email: ws9@princeton.edu
8
- License: License :: OSI Approved :: BSD License
8
+ License: BSD-3-Clause
9
9
  Classifier: Intended Audience :: Developers
10
10
  Classifier: Development Status :: 4 - Beta
11
- Classifier: License :: OSI Approved :: BSD License
12
11
  Classifier: Programming Language :: Python :: 3
13
12
  Classifier: Programming Language :: Python :: 3.9
14
13
  Classifier: Programming Language :: Python :: 3.10
@@ -0,0 +1 @@
1
+ {"git_version": "e4d56b4", "is_release": true}
@@ -751,8 +751,7 @@ class CloudFiles:
751
751
  res = first(self.list(prefix=prefix))
752
752
  return res is not None
753
753
  except NotImplementedError as err:
754
- res = CloudFile(self.cloudpath).size()
755
- return res > 0
754
+ return not CloudFile(self.cloudpath).exists()
756
755
 
757
756
  def exists(
758
757
  self, paths:GetPathType,
@@ -1497,8 +1497,25 @@ class CaveInterface(HttpInterface):
1497
1497
  is, don't worry about it.
1498
1498
  see: https://github.com/CAVEconnectome
1499
1499
  """
1500
- def default_headers(self):
1501
- cred = cave_credentials()
1500
+ def __init__(self, path, secrets=None, **kwargs):
1501
+ super().__init__(path, secrets=secrets, **kwargs)
1502
+
1503
+ secrets = kwargs.get('secrets', None)
1504
+ if secrets is None:
1505
+ secrets = {}
1506
+
1507
+ self._token = secrets.get('token', None)
1508
+ if self._token is None:
1509
+ server = self._path.host.replace("https://", "", 1)
1510
+ server = server.replace("http://", "", 1)
1511
+ self._token = cave_credentials(server)
1512
+ if self._token is not None:
1513
+ self._token = self._token.get('token', None)
1514
+
1515
+ def default_headers(self) -> dict:
1516
+ if self._token is None:
1517
+ return {}
1518
+
1502
1519
  return {
1503
- "Authorization": f"Bearer {cred['token']}",
1504
- }
1520
+ "Authorization": f"Bearer {self._token}",
1521
+ }
@@ -22,6 +22,7 @@ PRECOMPUTED_SUFFIX = '|neuroglancer-precomputed:'
22
22
 
23
23
  ALIAS_FILE = os.path.join(CLOUD_FILES_DIR, "aliases.json")
24
24
  OFFICIAL_ALIASES = {
25
+ "nokura": "s3://https://nokura.pni.princeton.edu/",
25
26
  "matrix": "s3://https://s3-hpcrc.rc.princeton.edu/",
26
27
  "tigerdata": "s3://https://td.princeton.edu/",
27
28
  }
@@ -40,6 +41,10 @@ ALLOWED_FORMATS = [
40
41
  'render', 'vtk', 'nifti', 'dvid',
41
42
  ]
42
43
 
44
+ CLOUD_PROTOCOLS = [
45
+ "gs", "s3"
46
+ ] + list(OFFICIAL_ALIASES.keys())
47
+
43
48
  def update_aliases_from_file():
44
49
  global ALIASES_FROM_FILE
45
50
  global ALIAS_FILE
@@ -374,7 +379,7 @@ def extract(cloudpath:str, windows=None) -> ExtractedPath:
374
379
  cloudpath = toabs(cloudpath)
375
380
 
376
381
  bucket = None
377
- if protocol in ('gs', 's3', 'matrix', 'mem'):
382
+ if protocol in CLOUD_PROTOCOLS + ['mem']:
378
383
  match = re.match(BUCKET_RE, cloudpath)
379
384
  if not match:
380
385
  raise error
@@ -398,7 +403,7 @@ def extract(cloudpath:str, windows=None) -> ExtractedPath:
398
403
 
399
404
  def to_https_protocol(cloudpath):
400
405
  if isinstance(cloudpath, ExtractedPath):
401
- if cloudpath.protocol in ('gs', 's3', 'matrix'):
406
+ if cloudpath.protocol in CLOUD_PROTOCOLS:
402
407
  return extract(to_https_protocol(ascloudpath(cloudpath)))
403
408
  return cloudpath
404
409
 
@@ -137,23 +137,27 @@ def aws_credentials(bucket = '', service = 'aws', skip_files=False):
137
137
  AWS_CREDENTIALS_CACHE[service][bucket] = aws_credentials
138
138
  return aws_credentials
139
139
 
140
- CAVE_CREDENTIALS = None
141
- def cave_credentials():
140
+ CAVE_CREDENTIALS:CredentialCacheType = {}
141
+ def cave_credentials(server = ''):
142
142
  global CAVE_CREDENTIALS
143
- default_file_path = 'cave-secret.json'
144
- path = secretpath(default_file_path)
145
143
 
146
- if CAVE_CREDENTIALS:
147
- return CAVE_CREDENTIALS
144
+ paths = [
145
+ secretpath('cave-secret.json')
146
+ ]
148
147
 
149
- if os.path.exists(path):
150
- with open(path, 'rt') as f:
151
- CAVE_CREDENTIALS = json.loads(f.read())
152
- else:
153
- CAVE_CREDENTIALS = None
148
+ if server:
149
+ paths = [ secretpath(f'{server}-cave-secret.json') ] + paths
150
+
151
+ if server in CAVE_CREDENTIALS:
152
+ return CAVE_CREDENTIALS.get(server, None)
154
153
 
155
- return CAVE_CREDENTIALS
154
+ for path in paths:
155
+ if os.path.exists(path):
156
+ with open(path, 'rt') as f:
157
+ CAVE_CREDENTIALS[server] = json.loads(f.read())
158
+ break
156
159
 
160
+ return CAVE_CREDENTIALS.get(server, None)
157
161
 
158
162
  HTTP_CREDENTIALS = None
159
163
  def http_credentials():
@@ -84,7 +84,7 @@ def license():
84
84
  @main.command()
85
85
  @click.option('--shortpath', is_flag=True, default=False, help='Don\'t print the common base path for each listed path.',show_default=True)
86
86
  @click.option('--flat', is_flag=True, default=False, help='Only produce a single level of directory hierarchy.',show_default=True)
87
- @click.option('-e','--expr',is_flag=True, default=False, help='Use a limited regexp language (e.g. [abc123]\{3\}) to generate prefixes.', show_default=True)
87
+ @click.option('-e','--expr',is_flag=True, default=False, help=r'Use a limited regexp language (e.g. [abc123]{3}) to generate prefixes.', show_default=True)
88
88
  @click.option('--no-auth',is_flag=True, default=False, help='Uses the http API for read-only operations.', show_default=True)
89
89
  @click.argument("cloudpath")
90
90
  def ls(shortpath, flat, expr, cloudpath, no_auth):
@@ -7,11 +7,10 @@ description_file = README.md
7
7
  author = William Silversmith
8
8
  author_email = ws9@princeton.edu
9
9
  home_page = https://github.com/seung-lab/cloud-files/
10
- license = License :: OSI Approved :: BSD License
10
+ license = BSD-3-Clause
11
11
  classifier =
12
12
  Intended Audience :: Developers
13
13
  Development Status :: 4 - Beta
14
- License :: OSI Approved :: BSD License
15
14
  Programming Language :: Python :: 3
16
15
  Programming Language :: Python :: 3.9
17
16
  Programming Language :: Python :: 3.10
@@ -1 +0,0 @@
1
- {"git_version": "9370f96", "is_release": true}
File without changes
File without changes
File without changes
File without changes
File without changes