Skip to content

Commit b98680e

Browse files
authored
Merge branch 'master' into DEVEX-2431
2 parents bffd767 + b8a6549 commit b98680e

File tree

11 files changed

+67
-13
lines changed

11 files changed

+67
-13
lines changed

CHANGELOG.md

+21-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,27 @@ Categories for each release: Added, Changed, Deprecated, Removed, Fixed, Securit
66

77
## Unreleased
88

9-
## [385.0] - beta
9+
## [387.0] - beta
10+
11+
### Added
12+
13+
* `--name-mode` parameter for `dx find data`
14+
15+
### Fixed
16+
17+
* Nonce generation for python 3
18+
19+
## [386.0] - 2024.12.2
20+
21+
### Added
22+
23+
* `--database-results-restricted` `--unset-database-results-restricted` for `dx new project`
24+
25+
### Fixed
26+
27+
* Remove pipes import for Python 3.13 compatibility
28+
29+
## [385.0] - 2024.11.8
1030

1131
### Added
1232

src/R/dxR/DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: dxR
22
Type: Package
33
Title: DNAnexus R Client Library
4-
Version: 0.385.0
4+
Version: 0.387.0
55
Author: Katherine Lai
66
Maintainer: Katherine Lai <klai@dnanexus.com>
77
Description: dxR is an R extension containing API wrapper functions for

src/R/dxR/R/dxR-package.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
##' the new DNAnexus platform.
55
##'
66
##' \tabular{ll}{ Package: \tab dxR\cr Type: \tab Package\cr Version: \tab
7-
##' 0.385.0\cr License: \tab Apache License (== 2.0)\cr
7+
##' 0.387.0\cr License: \tab Apache License (== 2.0)\cr
88
##' }
99
##'
1010
##' @name dxR-package

src/R/dxR/man/dxR-package.Rd

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
}
1010
\details{
1111
\tabular{ll}{ Package: \tab dxR\cr Type: \tab Package\cr
12-
Version: \tab 0.385.0\cr License: \tab Apache License (==
12+
Version: \tab 0.387.0\cr License: \tab Apache License (==
1313
2.0)\cr }
1414
}
1515
\author{

src/python/dxpy/bindings/dxproject.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ def new(self, name, summary=None, description=None, region=None, protected=None,
285285
restricted=None, download_restricted=None, contains_phi=None,
286286
tags=None, properties=None, bill_to=None, database_ui_view_only=None,
287287
external_upload_restricted=None, default_symlink=None,
288+
database_results_restricted=None,
288289
**kwargs):
289290
"""
290291
:param name: The name of the project
@@ -313,6 +314,8 @@ def new(self, name, summary=None, description=None, region=None, protected=None,
313314
:type database_ui_view_only: boolean
314315
:param external_upload_restricted: If provided, whether project members can upload data to project from external sources, e.g. outside of job
315316
:type external_upload_restricted: boolean
317+
:param database_results_restricted: If provided, minimum amount of data that project members with VIEW access can see from databases in the project
318+
:type database_results_restricted: int
316319
:param default_symlink: If provided, the details needed to have writable symlinks in the project. Dict must include drive, container, and optional prefix.
317320
:type default_symlink: dict
318321
@@ -346,6 +349,8 @@ def new(self, name, summary=None, description=None, region=None, protected=None,
346349
input_hash["databaseUIViewOnly"] = database_ui_view_only
347350
if external_upload_restricted is not None:
348351
input_hash["externalUploadRestricted"] = external_upload_restricted
352+
if database_results_restricted is not None:
353+
input_hash["databaseResultsRestricted"] = database_results_restricted
349354
if tags is not None:
350355
input_hash["tags"] = tags
351356
if properties is not None:
@@ -360,7 +365,9 @@ def new(self, name, summary=None, description=None, region=None, protected=None,
360365
def update(self, name=None, summary=None, description=None, protected=None,
361366
restricted=None, download_restricted=None, version=None,
362367
allowed_executables=None, unset_allowed_executables=None,
363-
database_ui_view_only=None, external_upload_restricted=None, **kwargs):
368+
database_ui_view_only=None, external_upload_restricted=None,
369+
database_results_restricted=None, unset_database_results_restricted=None,
370+
**kwargs):
364371
"""
365372
:param name: If provided, the new project name
366373
:type name: string
@@ -376,10 +383,16 @@ def update(self, name=None, summary=None, description=None, protected=None,
376383
:type download_restricted: boolean
377384
:param allowed_executables: If provided, these are the only executable ID(s) allowed to run as root executions in this project
378385
:type allowed_executables: list
386+
:param unset_allowed_executables: If provided, removes any restrictions set by allowed_executables
387+
:type unset_allowed_executables: boolean
379388
:param database_ui_view_only: If provided, whether the viewers on the project can access the database data directly
380389
:type database_ui_view_only: boolean
381390
:param external_upload_restricted: If provided, whether project members can upload data to project from external sources, e.g. outside of job
382391
:type external_upload_restricted: boolean
392+
:param database_results_restricted: If provided, minimum amount of data that project members with VIEW access can see from databases in the project
393+
:type database_results_restricted: int
394+
:param unset_database_results_restricted: If provided, removes any restrictions set by database_results_restricted
395+
:type unset_database_results_restricted: boolean
383396
:param version: If provided, the update will only occur if the value matches the current project's version number
384397
:type version: int
385398
@@ -413,6 +426,10 @@ def update(self, name=None, summary=None, description=None, protected=None,
413426
update_hash["databaseUIViewOnly"] = database_ui_view_only
414427
if external_upload_restricted is not None:
415428
update_hash["externalUploadRestricted"] = external_upload_restricted
429+
if database_results_restricted is not None:
430+
update_hash["databaseResultsRestricted"] = database_results_restricted
431+
if unset_database_results_restricted is not None:
432+
update_hash["databaseResultsRestricted"] = None
416433
dxpy.api.project_update(self._dxid, update_hash, **kwargs)
417434

418435
def invite(self, invitee, level, send_email=True, **kwargs):

src/python/dxpy/cli/parsers.py

+4
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,10 @@ def get_update_project_args(args):
446446
input_params['allowedExecutables'] = args.allowed_executables
447447
if args.unset_allowed_executables:
448448
input_params['allowedExecutables'] = None
449+
if args.database_results_restricted is not None:
450+
input_params['databaseResultsRestricted'] = args.database_results_restricted
451+
if args.unset_database_results_restricted:
452+
input_params['databaseResultsRestricted'] = None
449453
if args.external_upload_restricted is not None:
450454
input_params['externalUploadRestricted'] = args.external_upload_restricted == 'true'
451455
return input_params

src/python/dxpy/scripts/dx.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -1432,6 +1432,8 @@ def new_project(args):
14321432
inputs["containsPHI"] = True
14331433
if args.database_ui_view_only:
14341434
inputs["databaseUIViewOnly"] = True
1435+
if args.database_results_restricted is not None:
1436+
inputs["databaseResultsRestricted"] = args.database_results_restricted
14351437
if args.monthly_compute_limit is not None:
14361438
inputs["monthlyComputeLimit"] = args.monthly_compute_limit
14371439
if args.monthly_egress_bytes_limit is not None:
@@ -2479,7 +2481,7 @@ def find_data(args):
24792481
visibility=args.visibility,
24802482
properties=args.properties,
24812483
name=args.name,
2482-
name_mode='glob',
2484+
name_mode=args.name_mode,
24832485
typename=args.type,
24842486
tags=args.tag, link=args.link,
24852487
project=args.project,
@@ -5427,6 +5429,9 @@ def positive_number(value):
54275429
allowed_executables_group = parser_update_project.add_mutually_exclusive_group()
54285430
allowed_executables_group.add_argument('--allowed-executables', help='Executable ID(s) this project is allowed to run. This operation overrides any existing list of executables.', type=str, nargs="+")
54295431
allowed_executables_group.add_argument('--unset-allowed-executables', help='Removes any restriction to run executables as set by --allowed-executables', action='store_true')
5432+
database_results_restricted_group = parser_update_project.add_mutually_exclusive_group()
5433+
database_results_restricted_group.add_argument('--database-results-restricted', help='Viewers on the project can access only more than specified size of visual data from databases', type=positive_integer)
5434+
database_results_restricted_group.add_argument('--unset-database-results-restricted', help='Removes any restriction to return data from databases as set by --database-results-restricted', action='store_true')
54305435

54315436
parser_update_project.set_defaults(func=update_project)
54325437
register_parser(parser_update_project, subparsers_action=subparsers_update, categories="metadata")
@@ -5813,6 +5818,7 @@ def __call__(self, parser, namespace, values, option_string=None):
58135818
action='store_true')
58145819
parser_new_project.add_argument('--database-ui-view-only', help='Viewers on the project cannot access database data directly', default=False,
58155820
action='store_true')
5821+
parser_new_project.add_argument('--database-results-restricted', help='Viewers on the project can access only more than specified size of visual data from databases', type=positive_integer)
58165822
parser_new_project.add_argument('--monthly-compute-limit', type=positive_integer, help='Monthly project spending limit for compute')
58175823
parser_new_project.add_argument('--monthly-egress-bytes-limit', type=positive_integer, help='Monthly project spending limit for egress (in Bytes)')
58185824
parser_new_project.add_argument('--monthly-storage-limit', type=positive_number, help='Monthly project spending limit for storage')
@@ -6137,7 +6143,8 @@ def __call__(self, parser, namespace, values, option_string=None):
61376143
)
61386144
parser_find_data.add_argument('--state', choices=['open', 'closing', 'closed', 'any'], help='State of the object')
61396145
parser_find_data.add_argument('--visibility', choices=['hidden', 'visible', 'either'], default='visible', help='Whether the object is hidden or not')
6140-
parser_find_data.add_argument('--name', help='Name of the object')
6146+
parser_find_data.add_argument('--name', help='Search criteria for the object name, interpreted according to the --name-mode')
6147+
parser_find_data.add_argument('--name-mode', default='glob', help='Name mode to use for searching', choices=['glob', 'exact', 'regexp'])
61416148
parser_find_data.add_argument('--type', help='Type of the data object')
61426149
parser_find_data.add_argument('--link', help='Object ID that the data object links to')
61436150
parser_find_data.add_argument('--all-projects', '--allprojects', help='Extend search to all projects (excluding public projects)', action='store_true')

src/python/dxpy/toolkit_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version = '0.385.0'
1+
version = '0.387.0'

src/python/dxpy/utils/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -292,10 +292,10 @@ class Nonce:
292292
'''
293293
def __init__(self):
294294
try:
295-
self.nonce = "%s%f" % (str(binascii.hexlify(os.urandom(32))), time.time())
295+
self.nonce = "%s%f" % (binascii.hexlify(os.urandom(32)).decode('utf-8'), time.time())
296296
except:
297297
random.seed(time.time())
298-
self.nonce = "%s%f" % (str(random.getrandbits(8*26)), time.time())
298+
self.nonce = "%s%f" % (random.getrandbits(8*26), time.time())
299299

300300
def __str__(self):
301301
return self.nonce

src/python/dxpy/utils/describe.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ def print_project_desc(desc, verbose=False):
415415
'containsPHI', 'databaseUIViewOnly', 'externalUploadRestricted', 'region', 'storageCost', 'pendingTransfer',
416416
'atSpendingLimit', 'currentMonthComputeAvailableBudget', 'currentMonthEgressBytesAvailableBudget',
417417
'currentMonthStorageAvailableBudget', 'currentMonthComputeUsage', 'currentMonthEgressBytesUsage',
418-
'currentMonthExpectedStorageUsage', 'defaultSymlink'
418+
'currentMonthExpectedStorageUsage', 'defaultSymlink', 'databaseResultsRestricted',
419419
# Following are app container-specific
420420
'destroyAt', 'project', 'type', 'app', 'appName'
421421
]
@@ -455,6 +455,8 @@ def print_project_desc(desc, verbose=False):
455455
print_json_field('External Upload Restricted', desc['externalUploadRestricted'])
456456
if 'defaultSymlink' in desc and verbose:
457457
print_json_field('Default Symlink', desc['defaultSymlink'])
458+
if 'databaseResultsRestricted' in desc and desc['databaseResultsRestricted']:
459+
print_json_field('Database Results Restricted', desc['databaseResultsRestricted'])
458460

459461
# Usage
460462
print_field("Created", render_timestamp(desc['created']))

src/python/test/test_dxpy.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ def test_new(self):
139139
self.assertEqual(desc["databaseUIViewOnly"], False)
140140
self.assertEqual(desc["externalUploadRestricted"], False)
141141
self.assertEqual(desc["tags"], [])
142+
self.assertEqual(desc["databaseResultsRestricted"], None)
142143
prop = dxpy.api.project_describe(dxproject.get_id(),
143144
{'fields': {'properties': True}})
144145
self.assertEqual(prop['properties'], {})
@@ -192,6 +193,7 @@ def test_update_describe(self):
192193
download_restricted=True,
193194
external_upload_restricted=False,
194195
allowed_executables=["applet-abcdefghijklmnopqrstuzwx"],
196+
database_results_restricted=10,
195197
description="new description")
196198
desc = dxproject.describe()
197199
self.assertEqual(desc["id"], self.proj_id)
@@ -203,13 +205,15 @@ def test_update_describe(self):
203205
self.assertEqual(desc["externalUploadRestricted"], False)
204206
self.assertEqual(desc["description"], "new description")
205207
self.assertEqual(desc["allowedExecutables"][0], "applet-abcdefghijklmnopqrstuzwx")
208+
self.assertEqual(desc["databaseResultsRestricted"], 10)
206209
self.assertTrue("created" in desc)
207210

208-
dxproject.update(restricted=False, download_restricted=False, unset_allowed_executables=True)
211+
dxproject.update(restricted=False, download_restricted=False, unset_allowed_executables=True, unset_database_results_restricted=True)
209212
desc = dxproject.describe()
210213
self.assertEqual(desc["restricted"], False)
211214
self.assertEqual(desc["downloadRestricted"], False)
212-
self.assertTrue("allowedExecutables" not in desc)
215+
self.assertEqual(desc["allowedExecutables"], None)
216+
self.assertEqual(desc["databaseResultsRestricted"], None)
213217

214218
def test_new_list_remove_folders(self):
215219
dxproject = dxpy.DXProject()

0 commit comments

Comments
 (0)