diff --git a/openapi-generator-config.yaml b/openapi-generator-config.yaml index 60830e4..104df88 100644 --- a/openapi-generator-config.yaml +++ b/openapi-generator-config.yaml @@ -1,9 +1,9 @@ project_name_override: neptune-api package_version_override: 0.1.0 post_hooks: - - "ruff check . --fix" + - "ruff check . --fix --target-version=py38" - "ruff format " - "isort ." - - "echo >> py.typed" + - "echo -n > py.typed" content_type_overrides: application/x-protobuf: application/octet-stream diff --git a/pyproject.toml b/pyproject.toml index 26db63d..a6d65a7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -85,7 +85,7 @@ exclude = ["src/neptune_api/proto", "src/neptune_retrieval_api/proto"] select = ["F", "UP"] [tool.mypy] -files = ['src/neptune_api', 'src/neptune_retrieval_api'] +files = ['src/neptune_api', 'src/neptune_retrieval_api', 'src/neptune_storage_api'] mypy_path = "stubs" install_types = "True" non_interactive = "True" diff --git a/scripts/update-storagebridge.sh b/scripts/update-storagebridge.sh new file mode 100755 index 0000000..a7a2eb7 --- /dev/null +++ b/scripts/update-storagebridge.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash + +if [ ! -f "storagebridge_swagger.json" ]; then + echo "storagebridge_swagger.json not found. Make sure it's in CWD when running the script" + exit 1 +fi + +# Show every command and exit on error +set -ex + +## Preserve specific files +mkdir -p tmp + +# Modify the Swagger JSON to support application/x-protobuf +jq ' + .paths |= with_entries( + .value |= with_entries( + if .value.produces? and (.value.produces | index("application/json")) and (.value.produces | index("application/x-protobuf")) + then + .value.produces = ["application/x-protobuf"] + else + . + end + ) + ) +' storagebridge_swagger.json > tmp/storagebridge_swagger.json && mv tmp/storagebridge_swagger.json storagebridge_swagger.json + +jq ' + .paths |= with_entries( + .value |= with_entries( + if .value.produces? and (.value.produces | index("application/x-protobuf")) + then + .value.responses."200".schema = { + "type": "string", + "format": "binary" + } + else + . + end + ) + ) +' storagebridge_swagger.json > tmp/storagebridge_swagger.json && mv tmp/storagebridge_swagger.json storagebridge_swagger.json + +# Add license information using jq +jq '.info.license = {"name": "", "url": ""}' storagebridge_openapi.json > tmp_storagebridge_openapi.json && mv tmp_storagebridge_openapi.json storagebridge_openapi.json + + +openapi-python-client generate \ + --overwrite \ + --meta none \ + --path "storagebridge_openapi.json" \ + --custom-template-path=templates/ \ + --config openapi-generator-config.yaml \ + --output-path src/neptune_storage_api + + +# Clean tmp directories +rm -rf tmp + + +cat scripts/preserve_files.txt | while read entry; do + git checkout HEAD -- $entry +done diff --git a/src/neptune_api/proto/google_rpc/code_pb2.py b/src/neptune_api/proto/google_rpc/code_pb2.py index 22d305f..dc4c3e2 100644 --- a/src/neptune_api/proto/google_rpc/code_pb2.py +++ b/src/neptune_api/proto/google_rpc/code_pb2.py @@ -1,15 +1,17 @@ """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import runtime_version as _runtime_version from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder +_runtime_version.ValidateProtobufRuntimeVersion(_runtime_version.Domain.PUBLIC, 5, 28, 1, '', 'google_rpc/code.proto') _sym_db = _symbol_database.Default() DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15google_rpc/code.proto\x12\ngoogle_rpc*\xb7\x02\n\x04Code\x12\x06\n\x02OK\x10\x00\x12\r\n\tCANCELLED\x10\x01\x12\x0b\n\x07UNKNOWN\x10\x02\x12\x14\n\x10INVALID_ARGUMENT\x10\x03\x12\x15\n\x11DEADLINE_EXCEEDED\x10\x04\x12\r\n\tNOT_FOUND\x10\x05\x12\x12\n\x0eALREADY_EXISTS\x10\x06\x12\x15\n\x11PERMISSION_DENIED\x10\x07\x12\x13\n\x0fUNAUTHENTICATED\x10\x10\x12\x16\n\x12RESOURCE_EXHAUSTED\x10\x08\x12\x17\n\x13FAILED_PRECONDITION\x10\t\x12\x0b\n\x07ABORTED\x10\n\x12\x10\n\x0cOUT_OF_RANGE\x10\x0b\x12\x11\n\rUNIMPLEMENTED\x10\x0c\x12\x0c\n\x08INTERNAL\x10\r\x12\x0f\n\x0bUNAVAILABLE\x10\x0e\x12\r\n\tDATA_LOSS\x10\x0fBX\n\x0ecom.google.rpcB\tCodeProtoP\x01Z3google.golang.org/genproto/googleapis/rpc/code;code\xa2\x02\x03RPCb\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google_rpc.code_pb2', _globals) -if _descriptor._USE_C_DESCRIPTORS == False: - _globals['DESCRIPTOR']._options = None +if not _descriptor._USE_C_DESCRIPTORS: + _globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._serialized_options = b'\n\x0ecom.google.rpcB\tCodeProtoP\x01Z3google.golang.org/genproto/googleapis/rpc/code;code\xa2\x02\x03RPC' _globals['_CODE']._serialized_start = 38 _globals['_CODE']._serialized_end = 349 \ No newline at end of file diff --git a/src/neptune_api/proto/neptune_pb/ingest/v1/common_pb2.py b/src/neptune_api/proto/neptune_pb/ingest/v1/common_pb2.py index 6488e42..16ce086 100644 --- a/src/neptune_api/proto/neptune_pb/ingest/v1/common_pb2.py +++ b/src/neptune_api/proto/neptune_pb/ingest/v1/common_pb2.py @@ -1,52 +1,56 @@ """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import runtime_version as _runtime_version from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder +_runtime_version.ValidateProtobufRuntimeVersion(_runtime_version.Domain.PUBLIC, 5, 28, 1, '', 'neptune_pb/ingest/v1/common.proto') _sym_db = _symbol_database.Default() from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n!neptune_pb/ingest/v1/common.proto\x12\x11neptune.ingest.v1\x1a\x1fgoogle/protobuf/timestamp.proto"$\n\x04Step\x12\r\n\x05whole\x18\x01 \x01(\x04\x12\r\n\x05micro\x18\x02 \x01(\x04"\x9b\x01\n\tForkPoint\x12\x16\n\x0eparent_project\x18\x01 \x01(\t\x12\x15\n\rparent_run_id\x18\x02 \x01(\t\x12%\n\x04step\x18\x04 \x01(\x0b2\x17.neptune.ingest.v1.Step\x12 \n\x13requested_parent_id\x18\x0f \x01(\tH\x00\x88\x01\x01B\x16\n\x14_requested_parent_id"\x1b\n\tStringSet\x12\x0e\n\x06values\x18\x01 \x03(\t"\xbb\x01\n\x05Value\x12\x11\n\x07float64\x18\x01 \x01(\x01H\x00\x12\x0f\n\x05int64\x18\x03 \x01(\x03H\x00\x12\x0e\n\x04bool\x18\x05 \x01(\x08H\x00\x12\x10\n\x06string\x18\x06 \x01(\tH\x00\x12/\n\ttimestamp\x18\x08 \x01(\x0b2\x1a.google.protobuf.TimestampH\x00\x122\n\nstring_set\x18\x0c \x01(\x0b2\x1c.neptune.ingest.v1.StringSetH\x00B\x07\n\x05value"\xa2\x01\n\x0fModifyStringSet\x12>\n\x06values\x18\x01 \x03(\x0b2..neptune.ingest.v1.ModifyStringSet.ValuesEntry\x1aO\n\x0bValuesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12/\n\x05value\x18\x02 \x01(\x0e2 .neptune.ingest.v1.SET_OPERATION:\x028\x01"I\n\tModifySet\x124\n\x06string\x18\x01 \x01(\x0b2".neptune.ingest.v1.ModifyStringSetH\x00B\x06\n\x04type"F\n\x05Owner\x12\x11\n\x07user_id\x18\x01 \x01(\tH\x00\x12\x1c\n\x12service_account_id\x18\x02 \x01(\tH\x00B\x0c\n\nowner_type"\xcf\x02\n\x03Run\x12\x13\n\x06run_id\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1a\n\rexperiment_id\x18\x05 \x01(\tH\x01\x88\x01\x01\x120\n\nfork_point\x18\x02 \x01(\x0b2\x1c.neptune.ingest.v1.ForkPoint\x12\x13\n\x06family\x18\x04 \x01(\tH\x02\x88\x01\x01\x126\n\rcreation_time\x18\x03 \x01(\x0b2\x1a.google.protobuf.TimestampH\x03\x88\x01\x01\x12,\n\x05owner\x18\x06 \x01(\x0b2\x18.neptune.ingest.v1.OwnerH\x04\x88\x01\x01\x12\x17\n\nrequest_id\x18\x07 \x01(\tH\x05\x88\x01\x01B\t\n\x07_run_idB\x10\n\x0e_experiment_idB\t\n\x07_familyB\x10\n\x0e_creation_timeB\x08\n\x06_ownerB\r\n\x0b_request_id"\xc3\x04\n\x11UpdateRunSnapshot\x12%\n\x04step\x18\x01 \x01(\x0b2\x17.neptune.ingest.v1.Step\x12-\n\ttimestamp\x18\x02 \x01(\x0b2\x1a.google.protobuf.Timestamp\x12@\n\x06assign\x18\x04 \x03(\x0b20.neptune.ingest.v1.UpdateRunSnapshot.AssignEntry\x12I\n\x0bmodify_sets\x18\x05 \x03(\x0b24.neptune.ingest.v1.UpdateRunSnapshot.ModifySetsEntry\x12@\n\x06append\x18\x08 \x03(\x0b20.neptune.ingest.v1.UpdateRunSnapshot.AppendEntry\x12\x17\n\nrequest_id\x18\t \x01(\tH\x00\x88\x01\x01\x1aG\n\x0bAssignEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\'\n\x05value\x18\x02 \x01(\x0b2\x18.neptune.ingest.v1.Value:\x028\x01\x1aO\n\x0fModifySetsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12+\n\x05value\x18\x02 \x01(\x0b2\x1c.neptune.ingest.v1.ModifySet:\x028\x01\x1aG\n\x0bAppendEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\'\n\x05value\x18\x02 \x01(\x0b2\x18.neptune.ingest.v1.Value:\x028\x01B\r\n\x0b_request_id"M\n\x12UpdateRunSnapshots\x127\n\tsnapshots\x18\x01 \x03(\x0b2$.neptune.ingest.v1.UpdateRunSnapshot*.\n\rSET_OPERATION\x12\x08\n\x04NOOP\x10\x00\x12\x07\n\x03ADD\x10\x01\x12\n\n\x06REMOVE\x10\x02B5\n$ml.neptune.leaderboard.api.ingest.v1B\x0bCommonProtoP\x01b\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n!neptune_pb/ingest/v1/common.proto\x12\x11neptune.ingest.v1\x1a\x1fgoogle/protobuf/timestamp.proto"$\n\x04Step\x12\r\n\x05whole\x18\x01 \x01(\x04\x12\r\n\x05micro\x18\x02 \x01(\x04"\x9b\x01\n\tForkPoint\x12\x16\n\x0eparent_project\x18\x01 \x01(\t\x12\x15\n\rparent_run_id\x18\x02 \x01(\t\x12%\n\x04step\x18\x04 \x01(\x0b2\x17.neptune.ingest.v1.Step\x12 \n\x13requested_parent_id\x18\x0f \x01(\tH\x00\x88\x01\x01B\x16\n\x14_requested_parent_id"\x1b\n\tStringSet\x12\x0e\n\x06values\x18\x01 \x03(\t">\n\x07FileRef\x12\x0c\n\x04path\x18\x01 \x01(\t\x12\x12\n\nsize_bytes\x18\x02 \x01(\x03\x12\x11\n\tmime_type\x18\x03 \x01(\t"\xeb\x01\n\x05Value\x12\x11\n\x07float64\x18\x01 \x01(\x01H\x00\x12\x0f\n\x05int64\x18\x03 \x01(\x03H\x00\x12\x0e\n\x04bool\x18\x05 \x01(\x08H\x00\x12\x10\n\x06string\x18\x06 \x01(\tH\x00\x12/\n\ttimestamp\x18\x08 \x01(\x0b2\x1a.google.protobuf.TimestampH\x00\x122\n\nstring_set\x18\x0c \x01(\x0b2\x1c.neptune.ingest.v1.StringSetH\x00\x12.\n\x08file_ref\x18\r \x01(\x0b2\x1a.neptune.ingest.v1.FileRefH\x00B\x07\n\x05value"\xa2\x01\n\x0fModifyStringSet\x12>\n\x06values\x18\x01 \x03(\x0b2..neptune.ingest.v1.ModifyStringSet.ValuesEntry\x1aO\n\x0bValuesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12/\n\x05value\x18\x02 \x01(\x0e2 .neptune.ingest.v1.SET_OPERATION:\x028\x01"I\n\tModifySet\x124\n\x06string\x18\x01 \x01(\x0b2".neptune.ingest.v1.ModifyStringSetH\x00B\x06\n\x04type"F\n\x05Owner\x12\x11\n\x07user_id\x18\x01 \x01(\tH\x00\x12\x1c\n\x12service_account_id\x18\x02 \x01(\tH\x00B\x0c\n\nowner_type"\xcf\x02\n\x03Run\x12\x13\n\x06run_id\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1a\n\rexperiment_id\x18\x05 \x01(\tH\x01\x88\x01\x01\x120\n\nfork_point\x18\x02 \x01(\x0b2\x1c.neptune.ingest.v1.ForkPoint\x12\x13\n\x06family\x18\x04 \x01(\tH\x02\x88\x01\x01\x126\n\rcreation_time\x18\x03 \x01(\x0b2\x1a.google.protobuf.TimestampH\x03\x88\x01\x01\x12,\n\x05owner\x18\x06 \x01(\x0b2\x18.neptune.ingest.v1.OwnerH\x04\x88\x01\x01\x12\x17\n\nrequest_id\x18\x07 \x01(\tH\x05\x88\x01\x01B\t\n\x07_run_idB\x10\n\x0e_experiment_idB\t\n\x07_familyB\x10\n\x0e_creation_timeB\x08\n\x06_ownerB\r\n\x0b_request_id"\xc3\x04\n\x11UpdateRunSnapshot\x12%\n\x04step\x18\x01 \x01(\x0b2\x17.neptune.ingest.v1.Step\x12-\n\ttimestamp\x18\x02 \x01(\x0b2\x1a.google.protobuf.Timestamp\x12@\n\x06assign\x18\x04 \x03(\x0b20.neptune.ingest.v1.UpdateRunSnapshot.AssignEntry\x12I\n\x0bmodify_sets\x18\x05 \x03(\x0b24.neptune.ingest.v1.UpdateRunSnapshot.ModifySetsEntry\x12@\n\x06append\x18\x08 \x03(\x0b20.neptune.ingest.v1.UpdateRunSnapshot.AppendEntry\x12\x17\n\nrequest_id\x18\t \x01(\tH\x00\x88\x01\x01\x1aG\n\x0bAssignEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\'\n\x05value\x18\x02 \x01(\x0b2\x18.neptune.ingest.v1.Value:\x028\x01\x1aO\n\x0fModifySetsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12+\n\x05value\x18\x02 \x01(\x0b2\x1c.neptune.ingest.v1.ModifySet:\x028\x01\x1aG\n\x0bAppendEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\'\n\x05value\x18\x02 \x01(\x0b2\x18.neptune.ingest.v1.Value:\x028\x01B\r\n\x0b_request_id"M\n\x12UpdateRunSnapshots\x127\n\tsnapshots\x18\x01 \x03(\x0b2$.neptune.ingest.v1.UpdateRunSnapshot*.\n\rSET_OPERATION\x12\x08\n\x04NOOP\x10\x00\x12\x07\n\x03ADD\x10\x01\x12\n\n\x06REMOVE\x10\x02B5\n$ml.neptune.leaderboard.api.ingest.v1B\x0bCommonProtoP\x01b\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'neptune_pb.ingest.v1.common_pb2', _globals) -if _descriptor._USE_C_DESCRIPTORS == False: - _globals['DESCRIPTOR']._options = None +if not _descriptor._USE_C_DESCRIPTORS: + _globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._serialized_options = b'\n$ml.neptune.leaderboard.api.ingest.v1B\x0bCommonProtoP\x01' - _globals['_MODIFYSTRINGSET_VALUESENTRY']._options = None + _globals['_MODIFYSTRINGSET_VALUESENTRY']._loaded_options = None _globals['_MODIFYSTRINGSET_VALUESENTRY']._serialized_options = b'8\x01' - _globals['_UPDATERUNSNAPSHOT_ASSIGNENTRY']._options = None + _globals['_UPDATERUNSNAPSHOT_ASSIGNENTRY']._loaded_options = None _globals['_UPDATERUNSNAPSHOT_ASSIGNENTRY']._serialized_options = b'8\x01' - _globals['_UPDATERUNSNAPSHOT_MODIFYSETSENTRY']._options = None + _globals['_UPDATERUNSNAPSHOT_MODIFYSETSENTRY']._loaded_options = None _globals['_UPDATERUNSNAPSHOT_MODIFYSETSENTRY']._serialized_options = b'8\x01' - _globals['_UPDATERUNSNAPSHOT_APPENDENTRY']._options = None + _globals['_UPDATERUNSNAPSHOT_APPENDENTRY']._loaded_options = None _globals['_UPDATERUNSNAPSHOT_APPENDENTRY']._serialized_options = b'8\x01' - _globals['_SET_OPERATION']._serialized_start = 1815 - _globals['_SET_OPERATION']._serialized_end = 1861 + _globals['_SET_OPERATION']._serialized_start = 1927 + _globals['_SET_OPERATION']._serialized_end = 1973 _globals['_STEP']._serialized_start = 89 _globals['_STEP']._serialized_end = 125 _globals['_FORKPOINT']._serialized_start = 128 _globals['_FORKPOINT']._serialized_end = 283 _globals['_STRINGSET']._serialized_start = 285 _globals['_STRINGSET']._serialized_end = 312 - _globals['_VALUE']._serialized_start = 315 - _globals['_VALUE']._serialized_end = 502 - _globals['_MODIFYSTRINGSET']._serialized_start = 505 - _globals['_MODIFYSTRINGSET']._serialized_end = 667 - _globals['_MODIFYSTRINGSET_VALUESENTRY']._serialized_start = 588 - _globals['_MODIFYSTRINGSET_VALUESENTRY']._serialized_end = 667 - _globals['_MODIFYSET']._serialized_start = 669 - _globals['_MODIFYSET']._serialized_end = 742 - _globals['_OWNER']._serialized_start = 744 - _globals['_OWNER']._serialized_end = 814 - _globals['_RUN']._serialized_start = 817 - _globals['_RUN']._serialized_end = 1152 - _globals['_UPDATERUNSNAPSHOT']._serialized_start = 1155 - _globals['_UPDATERUNSNAPSHOT']._serialized_end = 1734 - _globals['_UPDATERUNSNAPSHOT_ASSIGNENTRY']._serialized_start = 1494 - _globals['_UPDATERUNSNAPSHOT_ASSIGNENTRY']._serialized_end = 1565 - _globals['_UPDATERUNSNAPSHOT_MODIFYSETSENTRY']._serialized_start = 1567 - _globals['_UPDATERUNSNAPSHOT_MODIFYSETSENTRY']._serialized_end = 1646 - _globals['_UPDATERUNSNAPSHOT_APPENDENTRY']._serialized_start = 1648 - _globals['_UPDATERUNSNAPSHOT_APPENDENTRY']._serialized_end = 1719 - _globals['_UPDATERUNSNAPSHOTS']._serialized_start = 1736 - _globals['_UPDATERUNSNAPSHOTS']._serialized_end = 1813 \ No newline at end of file + _globals['_FILEREF']._serialized_start = 314 + _globals['_FILEREF']._serialized_end = 376 + _globals['_VALUE']._serialized_start = 379 + _globals['_VALUE']._serialized_end = 614 + _globals['_MODIFYSTRINGSET']._serialized_start = 617 + _globals['_MODIFYSTRINGSET']._serialized_end = 779 + _globals['_MODIFYSTRINGSET_VALUESENTRY']._serialized_start = 700 + _globals['_MODIFYSTRINGSET_VALUESENTRY']._serialized_end = 779 + _globals['_MODIFYSET']._serialized_start = 781 + _globals['_MODIFYSET']._serialized_end = 854 + _globals['_OWNER']._serialized_start = 856 + _globals['_OWNER']._serialized_end = 926 + _globals['_RUN']._serialized_start = 929 + _globals['_RUN']._serialized_end = 1264 + _globals['_UPDATERUNSNAPSHOT']._serialized_start = 1267 + _globals['_UPDATERUNSNAPSHOT']._serialized_end = 1846 + _globals['_UPDATERUNSNAPSHOT_ASSIGNENTRY']._serialized_start = 1606 + _globals['_UPDATERUNSNAPSHOT_ASSIGNENTRY']._serialized_end = 1677 + _globals['_UPDATERUNSNAPSHOT_MODIFYSETSENTRY']._serialized_start = 1679 + _globals['_UPDATERUNSNAPSHOT_MODIFYSETSENTRY']._serialized_end = 1758 + _globals['_UPDATERUNSNAPSHOT_APPENDENTRY']._serialized_start = 1760 + _globals['_UPDATERUNSNAPSHOT_APPENDENTRY']._serialized_end = 1831 + _globals['_UPDATERUNSNAPSHOTS']._serialized_start = 1848 + _globals['_UPDATERUNSNAPSHOTS']._serialized_end = 1925 \ No newline at end of file diff --git a/src/neptune_api/proto/neptune_pb/ingest/v1/common_pb2.pyi b/src/neptune_api/proto/neptune_pb/ingest/v1/common_pb2.pyi index fd834d1..7fb3be6 100644 --- a/src/neptune_api/proto/neptune_pb/ingest/v1/common_pb2.pyi +++ b/src/neptune_api/proto/neptune_pb/ingest/v1/common_pb2.pyi @@ -106,6 +106,23 @@ class StringSet(google.protobuf.message.Message): ... global___StringSet = StringSet +@typing.final +class FileRef(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + PATH_FIELD_NUMBER: builtins.int + SIZE_BYTES_FIELD_NUMBER: builtins.int + MIME_TYPE_FIELD_NUMBER: builtins.int + path: builtins.str + size_bytes: builtins.int + mime_type: builtins.str + + def __init__(self, *, path: builtins.str=..., size_bytes: builtins.int=..., mime_type: builtins.str=...) -> None: + ... + + def ClearField(self, field_name: typing.Literal['mime_type', b'mime_type', 'path', b'path', 'size_bytes', b'size_bytes']) -> None: + ... +global___FileRef = FileRef + @typing.final class Value(google.protobuf.message.Message): """Value is a union of all supported types that can be used to update a field. @@ -118,6 +135,7 @@ class Value(google.protobuf.message.Message): STRING_FIELD_NUMBER: builtins.int TIMESTAMP_FIELD_NUMBER: builtins.int STRING_SET_FIELD_NUMBER: builtins.int + FILE_REF_FIELD_NUMBER: builtins.int float64: builtins.float int64: builtins.int bool: builtins.bool @@ -131,16 +149,20 @@ class Value(google.protobuf.message.Message): def string_set(self) -> global___StringSet: ... - def __init__(self, *, float64: builtins.float=..., int64: builtins.int=..., bool: builtins.bool=..., string: builtins.str=..., timestamp: google.protobuf.timestamp_pb2.Timestamp | None=..., string_set: global___StringSet | None=...) -> None: + @property + def file_ref(self) -> global___FileRef: + ... + + def __init__(self, *, float64: builtins.float=..., int64: builtins.int=..., bool: builtins.bool=..., string: builtins.str=..., timestamp: google.protobuf.timestamp_pb2.Timestamp | None=..., string_set: global___StringSet | None=..., file_ref: global___FileRef | None=...) -> None: ... - def HasField(self, field_name: typing.Literal['bool', b'bool', 'float64', b'float64', 'int64', b'int64', 'string', b'string', 'string_set', b'string_set', 'timestamp', b'timestamp', 'value', b'value']) -> builtins.bool: + def HasField(self, field_name: typing.Literal['bool', b'bool', 'file_ref', b'file_ref', 'float64', b'float64', 'int64', b'int64', 'string', b'string', 'string_set', b'string_set', 'timestamp', b'timestamp', 'value', b'value']) -> builtins.bool: ... - def ClearField(self, field_name: typing.Literal['bool', b'bool', 'float64', b'float64', 'int64', b'int64', 'string', b'string', 'string_set', b'string_set', 'timestamp', b'timestamp', 'value', b'value']) -> None: + def ClearField(self, field_name: typing.Literal['bool', b'bool', 'file_ref', b'file_ref', 'float64', b'float64', 'int64', b'int64', 'string', b'string', 'string_set', b'string_set', 'timestamp', b'timestamp', 'value', b'value']) -> None: ... - def WhichOneof(self, oneof_group: typing.Literal['value', b'value']) -> typing.Literal['float64', 'int64', 'bool', 'string', 'timestamp', 'string_set'] | None: + def WhichOneof(self, oneof_group: typing.Literal['value', b'value']) -> typing.Literal['float64', 'int64', 'bool', 'string', 'timestamp', 'string_set', 'file_ref'] | None: ... global___Value = Value diff --git a/src/neptune_api/proto/neptune_pb/ingest/v1/ingest_pb2.py b/src/neptune_api/proto/neptune_pb/ingest/v1/ingest_pb2.py index 521f944..71925b0 100644 --- a/src/neptune_api/proto/neptune_pb/ingest/v1/ingest_pb2.py +++ b/src/neptune_api/proto/neptune_pb/ingest/v1/ingest_pb2.py @@ -1,24 +1,26 @@ """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import runtime_version as _runtime_version from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder +_runtime_version.ValidateProtobufRuntimeVersion(_runtime_version.Domain.PUBLIC, 5, 28, 1, '', 'neptune_pb/ingest/v1/ingest.proto') _sym_db = _symbol_database.Default() from ....google_rpc import code_pb2 as google__rpc_dot_code__pb2 from ....neptune_pb.ingest.v1 import common_pb2 as neptune__pb_dot_ingest_dot_v1_dot_common__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n!neptune_pb/ingest/v1/ingest.proto\x12\x11neptune.ingest.v1\x1a\x15google_rpc/code.proto\x1a!neptune_pb/ingest/v1/common.proto"0\n\x0cBatchContext\x12\x0f\n\x07project\x18\x01 \x01(\t\x12\x0f\n\x07api_key\x18\x02 \x01(\x0c"V\n\tUpdateRun\x12A\n\x10update_snapshots\x18\x08 \x01(\x0b2%.neptune.ingest.v1.UpdateRunSnapshotsH\x00B\x06\n\x04mode"\xb8\x02\n\x16BatchProjectOperations\x120\n\x07context\x18\x01 \x01(\x0b2\x1f.neptune.ingest.v1.BatchContext\x12\x1e\n\x16create_missing_project\x18\x03 \x01(\x08\x12+\n\x0bcreate_runs\x18\x04 \x03(\x0b2\x16.neptune.ingest.v1.Run\x12N\n\x0bupdate_runs\x18\x08 \x03(\x0b29.neptune.ingest.v1.BatchProjectOperations.UpdateRunsEntry\x1aO\n\x0fUpdateRunsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12+\n\x05value\x18\x02 \x01(\x0b2\x1c.neptune.ingest.v1.UpdateRun:\x028\x01"z\n\x0eCreateRunError\x12#\n\tgrpc_code\x18\x01 \x01(\x0e2\x10.google_rpc.Code\x122\n\x0bingest_code\x18\x03 \x01(\x0e2\x1d.neptune.ingest.v1.IngestCode\x12\x0f\n\x07message\x18\x02 \x01(\t"t\n\x0fCreateRunResult\x12%\n\x03run\x18\x01 \x01(\x0b2\x16.neptune.ingest.v1.RunH\x00\x122\n\x05error\x18\x02 \x01(\x0b2!.neptune.ingest.v1.CreateRunErrorH\x00B\x06\n\x04type"\xb4\x03\n\rResultSummary\x12\x1e\n\x16total_operations_count\x18\x01 \x01(\x03\x12\x18\n\x10successful_count\x18\x02 \x01(\x03\x12\x14\n\x0cfailed_count\x18\x03 \x01(\x03\x12V\n\x13failed_by_grpc_code\x18\x04 \x03(\x0b29.neptune.ingest.v1.ResultSummary.FailedByGRPCCodeCounters\x12R\n\x15failed_by_ingest_code\x18\x05 \x03(\x0b23.neptune.ingest.v1.ResultSummary.IngestCodeCounters\x1aN\n\x18FailedByGRPCCodeCounters\x12#\n\tgrpc_code\x18\x01 \x01(\x0e2\x10.google_rpc.Code\x12\r\n\x05count\x18\x02 \x01(\x03\x1aW\n\x12IngestCodeCounters\x122\n\x0bingest_code\x18\x01 \x01(\x0e2\x1d.neptune.ingest.v1.IngestCode\x12\r\n\x05count\x18\x02 \x01(\x03"\x89\x01\n\x0eUpdateRunError\x12#\n\tgrpc_code\x18\x01 \x01(\x0e2\x10.google_rpc.Code\x122\n\x0bingest_code\x18\x02 \x01(\x0e2\x1d.neptune.ingest.v1.IngestCode\x12\x0f\n\x07message\x18\x03 \x01(\t\x12\r\n\x05field\x18\x04 \x01(\t"\x8a\x01\n\x10UpdateRunResults\x12<\n\x12operations_summary\x18\x01 \x01(\x0b2 .neptune.ingest.v1.ResultSummary\x128\n\rupdate_errors\x18\x02 \x03(\x0b2!.neptune.ingest.v1.UpdateRunError"\xb6\x03\n\x0bBatchResult\x12#\n\tgrpc_code\x18\x01 \x01(\x0e2\x10.google_rpc.Code\x122\n\x0bingest_code\x18\t \x01(\x0e2\x1d.neptune.ingest.v1.IngestCode\x12<\n\x12operations_summary\x18\x02 \x01(\x0b2 .neptune.ingest.v1.ResultSummary\x12\x0f\n\x07project\x18\x05 \x01(\t\x12>\n\x12create_run_results\x18\x06 \x03(\x0b2".neptune.ingest.v1.CreateRunResult\x12P\n\x12update_run_results\x18\x07 \x03(\x0b24.neptune.ingest.v1.BatchResult.UpdateRunResultsEntry\x12\x0f\n\x07message\x18\x08 \x01(\t\x1a\\\n\x15UpdateRunResultsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x122\n\x05value\x18\x02 \x01(\x0b2#.neptune.ingest.v1.UpdateRunResults:\x028\x01"K\n\rIngestRequest\x12:\n\x07batches\x18\x01 \x03(\x0b2).neptune.ingest.v1.BatchProjectOperations"\x91\x01\n\x0eIngestResponse\x121\n\x07summary\x18\x02 \x01(\x0b2 .neptune.ingest.v1.ResultSummary\x12\x15\n\rerror_message\x18\x04 \x01(\t\x125\n\rbatch_results\x18\x05 \x03(\x0b2\x1e.neptune.ingest.v1.BatchResult*\xa1\x05\n\nIngestCode\x12\x06\n\x02OK\x10\x00\x12!\n\x1dBATCH_CONTAINS_DEPENDENT_RUNS\x10\x04\x12\x15\n\x11PROJECT_NOT_FOUND\x10\x08\x12\x18\n\x14PROJECT_INVALID_NAME\x10\t\x12\x11\n\rRUN_NOT_FOUND\x10\n\x12\x11\n\rRUN_DUPLICATE\x10\x0b\x12\x13\n\x0fRUN_CONFLICTING\x10\x0c\x12\x1d\n\x19RUN_FORK_PARENT_NOT_FOUND\x10\r\x12#\n\x1fRUN_INVALID_CREATION_PARAMETERS\x10\x0e\x12!\n\x1dFIELD_PATH_EXCEEDS_SIZE_LIMIT\x10\x10\x12\x14\n\x10FIELD_PATH_EMPTY\x10\x11\x12\x16\n\x12FIELD_PATH_INVALID\x10\x12\x12\x1b\n\x17FIELD_PATH_NON_WRITABLE\x10\x13\x12\x1a\n\x16FIELD_TYPE_UNSUPPORTED\x10\x14\x12\x1a\n\x16FIELD_TYPE_CONFLICTING\x10\x15\x12\x1a\n\x16SERIES_POINT_DUPLICATE\x10\x18\x12\x1e\n\x1aSERIES_STEP_NON_INCREASING\x10\x19\x12$\n SERIES_STEP_NOT_AFTER_FORK_POINT\x10\x1a\x12\x1f\n\x1bSERIES_TIMESTAMP_DECREASING\x10\x1b\x12#\n\x1fFLOAT_VALUE_NAN_INF_UNSUPPORTED\x10 \x12#\n\x1fSTRING_VALUE_EXCEEDS_SIZE_LIMIT\x10$\x12!\n\x1dSTRING_SET_EXCEEDS_SIZE_LIMIT\x10%\x12\x14\n\x10INGEST_SUSPENDED\x10?\x12\x0c\n\x08INTERNAL\x10@B5\n$ml.neptune.leaderboard.api.ingest.v1B\x0bIngestProtoP\x01b\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n!neptune_pb/ingest/v1/ingest.proto\x12\x11neptune.ingest.v1\x1a\x15google_rpc/code.proto\x1a!neptune_pb/ingest/v1/common.proto"0\n\x0cBatchContext\x12\x0f\n\x07project\x18\x01 \x01(\t\x12\x0f\n\x07api_key\x18\x02 \x01(\x0c"V\n\tUpdateRun\x12A\n\x10update_snapshots\x18\x08 \x01(\x0b2%.neptune.ingest.v1.UpdateRunSnapshotsH\x00B\x06\n\x04mode"\xb8\x02\n\x16BatchProjectOperations\x120\n\x07context\x18\x01 \x01(\x0b2\x1f.neptune.ingest.v1.BatchContext\x12\x1e\n\x16create_missing_project\x18\x03 \x01(\x08\x12+\n\x0bcreate_runs\x18\x04 \x03(\x0b2\x16.neptune.ingest.v1.Run\x12N\n\x0bupdate_runs\x18\x08 \x03(\x0b29.neptune.ingest.v1.BatchProjectOperations.UpdateRunsEntry\x1aO\n\x0fUpdateRunsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12+\n\x05value\x18\x02 \x01(\x0b2\x1c.neptune.ingest.v1.UpdateRun:\x028\x01"z\n\x0eCreateRunError\x12#\n\tgrpc_code\x18\x01 \x01(\x0e2\x10.google_rpc.Code\x122\n\x0bingest_code\x18\x03 \x01(\x0e2\x1d.neptune.ingest.v1.IngestCode\x12\x0f\n\x07message\x18\x02 \x01(\t"t\n\x0fCreateRunResult\x12%\n\x03run\x18\x01 \x01(\x0b2\x16.neptune.ingest.v1.RunH\x00\x122\n\x05error\x18\x02 \x01(\x0b2!.neptune.ingest.v1.CreateRunErrorH\x00B\x06\n\x04type"\xb4\x03\n\rResultSummary\x12\x1e\n\x16total_operations_count\x18\x01 \x01(\x03\x12\x18\n\x10successful_count\x18\x02 \x01(\x03\x12\x14\n\x0cfailed_count\x18\x03 \x01(\x03\x12V\n\x13failed_by_grpc_code\x18\x04 \x03(\x0b29.neptune.ingest.v1.ResultSummary.FailedByGRPCCodeCounters\x12R\n\x15failed_by_ingest_code\x18\x05 \x03(\x0b23.neptune.ingest.v1.ResultSummary.IngestCodeCounters\x1aN\n\x18FailedByGRPCCodeCounters\x12#\n\tgrpc_code\x18\x01 \x01(\x0e2\x10.google_rpc.Code\x12\r\n\x05count\x18\x02 \x01(\x03\x1aW\n\x12IngestCodeCounters\x122\n\x0bingest_code\x18\x01 \x01(\x0e2\x1d.neptune.ingest.v1.IngestCode\x12\r\n\x05count\x18\x02 \x01(\x03"\x89\x01\n\x0eUpdateRunError\x12#\n\tgrpc_code\x18\x01 \x01(\x0e2\x10.google_rpc.Code\x122\n\x0bingest_code\x18\x02 \x01(\x0e2\x1d.neptune.ingest.v1.IngestCode\x12\x0f\n\x07message\x18\x03 \x01(\t\x12\r\n\x05field\x18\x04 \x01(\t"\x8a\x01\n\x10UpdateRunResults\x12<\n\x12operations_summary\x18\x01 \x01(\x0b2 .neptune.ingest.v1.ResultSummary\x128\n\rupdate_errors\x18\x02 \x03(\x0b2!.neptune.ingest.v1.UpdateRunError"\xb6\x03\n\x0bBatchResult\x12#\n\tgrpc_code\x18\x01 \x01(\x0e2\x10.google_rpc.Code\x122\n\x0bingest_code\x18\t \x01(\x0e2\x1d.neptune.ingest.v1.IngestCode\x12<\n\x12operations_summary\x18\x02 \x01(\x0b2 .neptune.ingest.v1.ResultSummary\x12\x0f\n\x07project\x18\x05 \x01(\t\x12>\n\x12create_run_results\x18\x06 \x03(\x0b2".neptune.ingest.v1.CreateRunResult\x12P\n\x12update_run_results\x18\x07 \x03(\x0b24.neptune.ingest.v1.BatchResult.UpdateRunResultsEntry\x12\x0f\n\x07message\x18\x08 \x01(\t\x1a\\\n\x15UpdateRunResultsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x122\n\x05value\x18\x02 \x01(\x0b2#.neptune.ingest.v1.UpdateRunResults:\x028\x01"K\n\rIngestRequest\x12:\n\x07batches\x18\x01 \x03(\x0b2).neptune.ingest.v1.BatchProjectOperations"\x91\x01\n\x0eIngestResponse\x121\n\x07summary\x18\x02 \x01(\x0b2 .neptune.ingest.v1.ResultSummary\x12\x15\n\rerror_message\x18\x04 \x01(\t\x125\n\rbatch_results\x18\x05 \x03(\x0b2\x1e.neptune.ingest.v1.BatchResult*\xc2\x05\n\nIngestCode\x12\x06\n\x02OK\x10\x00\x12!\n\x1dBATCH_CONTAINS_DEPENDENT_RUNS\x10\x04\x12\x15\n\x11PROJECT_NOT_FOUND\x10\x08\x12\x18\n\x14PROJECT_INVALID_NAME\x10\t\x12\x11\n\rRUN_NOT_FOUND\x10\n\x12\x11\n\rRUN_DUPLICATE\x10\x0b\x12\x13\n\x0fRUN_CONFLICTING\x10\x0c\x12\x1d\n\x19RUN_FORK_PARENT_NOT_FOUND\x10\r\x12#\n\x1fRUN_INVALID_CREATION_PARAMETERS\x10\x0e\x12!\n\x1dFIELD_PATH_EXCEEDS_SIZE_LIMIT\x10\x10\x12\x14\n\x10FIELD_PATH_EMPTY\x10\x11\x12\x16\n\x12FIELD_PATH_INVALID\x10\x12\x12\x1b\n\x17FIELD_PATH_NON_WRITABLE\x10\x13\x12\x1a\n\x16FIELD_TYPE_UNSUPPORTED\x10\x14\x12\x1a\n\x16FIELD_TYPE_CONFLICTING\x10\x15\x12\x1a\n\x16SERIES_POINT_DUPLICATE\x10\x18\x12\x1e\n\x1aSERIES_STEP_NON_INCREASING\x10\x19\x12$\n SERIES_STEP_NOT_AFTER_FORK_POINT\x10\x1a\x12\x1f\n\x1bSERIES_TIMESTAMP_DECREASING\x10\x1b\x12#\n\x1fFLOAT_VALUE_NAN_INF_UNSUPPORTED\x10 \x12#\n\x1fSTRING_VALUE_EXCEEDS_SIZE_LIMIT\x10$\x12!\n\x1dSTRING_SET_EXCEEDS_SIZE_LIMIT\x10%\x12\x1f\n\x1bFILE_REF_EXCEEDS_SIZE_LIMIT\x10&\x12\x14\n\x10INGEST_SUSPENDED\x10?\x12\x0c\n\x08INTERNAL\x10@B5\n$ml.neptune.leaderboard.api.ingest.v1B\x0bIngestProtoP\x01b\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'neptune_pb.ingest.v1.ingest_pb2', _globals) -if _descriptor._USE_C_DESCRIPTORS == False: - _globals['DESCRIPTOR']._options = None +if not _descriptor._USE_C_DESCRIPTORS: + _globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._serialized_options = b'\n$ml.neptune.leaderboard.api.ingest.v1B\x0bIngestProtoP\x01' - _globals['_BATCHPROJECTOPERATIONS_UPDATERUNSENTRY']._options = None + _globals['_BATCHPROJECTOPERATIONS_UPDATERUNSENTRY']._loaded_options = None _globals['_BATCHPROJECTOPERATIONS_UPDATERUNSENTRY']._serialized_options = b'8\x01' - _globals['_BATCHRESULT_UPDATERUNRESULTSENTRY']._options = None + _globals['_BATCHRESULT_UPDATERUNRESULTSENTRY']._loaded_options = None _globals['_BATCHRESULT_UPDATERUNRESULTSENTRY']._serialized_options = b'8\x01' _globals['_INGESTCODE']._serialized_start = 2196 - _globals['_INGESTCODE']._serialized_end = 2869 + _globals['_INGESTCODE']._serialized_end = 2902 _globals['_BATCHCONTEXT']._serialized_start = 114 _globals['_BATCHCONTEXT']._serialized_end = 162 _globals['_UPDATERUN']._serialized_start = 164 diff --git a/src/neptune_api/proto/neptune_pb/ingest/v1/ingest_pb2.pyi b/src/neptune_api/proto/neptune_pb/ingest/v1/ingest_pb2.pyi index 6e8a61c..e945873 100644 --- a/src/neptune_api/proto/neptune_pb/ingest/v1/ingest_pb2.pyi +++ b/src/neptune_api/proto/neptune_pb/ingest/v1/ingest_pb2.pyi @@ -65,9 +65,11 @@ class _IngestCodeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._Enu FLOAT_VALUE_NAN_INF_UNSUPPORTED: _IngestCode.ValueType 'Unsupported value type for float64 field or float64 series. Applies to Inf and NaN values.' STRING_VALUE_EXCEEDS_SIZE_LIMIT: _IngestCode.ValueType - 'String value is too long. Maximum length is 64KB.' + 'String value is too long. Maximum length is 1MiB.' STRING_SET_EXCEEDS_SIZE_LIMIT: _IngestCode.ValueType - 'String Set value is too long. Maximum length is 64KB.' + 'String Set value is too long. Maximum length is 1MiB.' + FILE_REF_EXCEEDS_SIZE_LIMIT: _IngestCode.ValueType + 'File Ref value is too long. Maximum length is 4KiB.' INGEST_SUSPENDED: _IngestCode.ValueType 'Ingest is currently suspended' INTERNAL: _IngestCode.ValueType @@ -116,9 +118,11 @@ SERIES_TIMESTAMP_DECREASING: IngestCode.ValueType FLOAT_VALUE_NAN_INF_UNSUPPORTED: IngestCode.ValueType 'Unsupported value type for float64 field or float64 series. Applies to Inf and NaN values.' STRING_VALUE_EXCEEDS_SIZE_LIMIT: IngestCode.ValueType -'String value is too long. Maximum length is 64KB.' +'String value is too long. Maximum length is 1MiB.' STRING_SET_EXCEEDS_SIZE_LIMIT: IngestCode.ValueType -'String Set value is too long. Maximum length is 64KB.' +'String Set value is too long. Maximum length is 1MiB.' +FILE_REF_EXCEEDS_SIZE_LIMIT: IngestCode.ValueType +'File Ref value is too long. Maximum length is 4KiB.' INGEST_SUSPENDED: IngestCode.ValueType 'Ingest is currently suspended' INTERNAL: IngestCode.ValueType diff --git a/src/neptune_api/proto/neptune_pb/ingest/v1/pub/client_pb2.py b/src/neptune_api/proto/neptune_pb/ingest/v1/pub/client_pb2.py index 22f3eaf..a585c98 100644 --- a/src/neptune_api/proto/neptune_pb/ingest/v1/pub/client_pb2.py +++ b/src/neptune_api/proto/neptune_pb/ingest/v1/pub/client_pb2.py @@ -1,16 +1,18 @@ """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import runtime_version as _runtime_version from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder +_runtime_version.ValidateProtobufRuntimeVersion(_runtime_version.Domain.PUBLIC, 5, 28, 1, '', 'neptune_pb/ingest/v1/pub/client.proto') _sym_db = _symbol_database.Default() from .....neptune_pb.ingest.v1.pub import request_status_pb2 as neptune__pb_dot_ingest_dot_v1_dot_pub_dot_request__status__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n%neptune_pb/ingest/v1/pub/client.proto\x12\x15neptune.ingest.v1.pub\x1a-neptune_pb/ingest/v1/pub/request_status.proto"\x1a\n\tRequestId\x12\r\n\x05value\x18\x01 \x01(\t">\n\rRequestIdList\x12-\n\x03ids\x18\x01 \x03(\x0b2 .neptune.ingest.v1.pub.RequestId"K\n\x11BulkRequestStatus\x126\n\x08statuses\x18\x01 \x03(\x0b2$.neptune.ingest.v1.pub.RequestStatus"9\n\x0eSubmitResponse\x12\x12\n\nrequest_id\x18\x01 \x01(\t\x12\x13\n\x0brequest_ids\x18\x02 \x03(\tB3\n\x1cml.neptune.client.api.modelsB\x11ClientIngestProtoP\x01b\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'neptune_pb.ingest.v1.pub.client_pb2', _globals) -if _descriptor._USE_C_DESCRIPTORS == False: - _globals['DESCRIPTOR']._options = None +if not _descriptor._USE_C_DESCRIPTORS: + _globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._serialized_options = b'\n\x1cml.neptune.client.api.modelsB\x11ClientIngestProtoP\x01' _globals['_REQUESTID']._serialized_start = 111 _globals['_REQUESTID']._serialized_end = 137 diff --git a/src/neptune_api/proto/neptune_pb/ingest/v1/pub/ingest_pb2.py b/src/neptune_api/proto/neptune_pb/ingest/v1/pub/ingest_pb2.py index 3897e11..85b82b3 100644 --- a/src/neptune_api/proto/neptune_pb/ingest/v1/pub/ingest_pb2.py +++ b/src/neptune_api/proto/neptune_pb/ingest/v1/pub/ingest_pb2.py @@ -1,16 +1,18 @@ """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import runtime_version as _runtime_version from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder +_runtime_version.ValidateProtobufRuntimeVersion(_runtime_version.Domain.PUBLIC, 5, 28, 1, '', 'neptune_pb/ingest/v1/pub/ingest.proto') _sym_db = _symbol_database.Default() from .....neptune_pb.ingest.v1 import common_pb2 as neptune__pb_dot_ingest_dot_v1_dot_common__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n%neptune_pb/ingest/v1/pub/ingest.proto\x12\x15neptune.ingest.v1.pub\x1a!neptune_pb/ingest/v1/common.proto"\x8e\x02\n\x0cRunOperation\x12\x0f\n\x07project\x18\x01 \x01(\t\x12\x0e\n\x06run_id\x18\x02 \x01(\t\x12\x1e\n\x16create_missing_project\x18\x03 \x01(\x08\x12(\n\x06create\x18\x06 \x01(\x0b2\x16.neptune.ingest.v1.RunH\x00\x126\n\x06update\x18\x07 \x01(\x0b2$.neptune.ingest.v1.UpdateRunSnapshotH\x00\x12=\n\x0cupdate_batch\x18\x08 \x01(\x0b2%.neptune.ingest.v1.UpdateRunSnapshotsH\x00\x12\x0f\n\x07api_key\x18\x0c \x01(\x0cB\x0b\n\toperationB<\n(ml.neptune.leaderboard.api.ingest.v1.pubB\x0eIngestPubProtoP\x01b\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'neptune_pb.ingest.v1.pub.ingest_pb2', _globals) -if _descriptor._USE_C_DESCRIPTORS == False: - _globals['DESCRIPTOR']._options = None +if not _descriptor._USE_C_DESCRIPTORS: + _globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._serialized_options = b'\n(ml.neptune.leaderboard.api.ingest.v1.pubB\x0eIngestPubProtoP\x01' _globals['_RUNOPERATION']._serialized_start = 100 _globals['_RUNOPERATION']._serialized_end = 370 \ No newline at end of file diff --git a/src/neptune_api/proto/neptune_pb/ingest/v1/pub/request_status_pb2.py b/src/neptune_api/proto/neptune_pb/ingest/v1/pub/request_status_pb2.py index 25593b7..c399f4c 100644 --- a/src/neptune_api/proto/neptune_pb/ingest/v1/pub/request_status_pb2.py +++ b/src/neptune_api/proto/neptune_pb/ingest/v1/pub/request_status_pb2.py @@ -1,8 +1,10 @@ """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import runtime_version as _runtime_version from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder +_runtime_version.ValidateProtobufRuntimeVersion(_runtime_version.Domain.PUBLIC, 5, 28, 1, '', 'neptune_pb/ingest/v1/pub/request_status.proto') _sym_db = _symbol_database.Default() from .....google_rpc import code_pb2 as google__rpc_dot_code__pb2 from .....neptune_pb.ingest.v1 import ingest_pb2 as neptune__pb_dot_ingest_dot_v1_dot_ingest__pb2 @@ -10,8 +12,8 @@ _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'neptune_pb.ingest.v1.pub.request_status_pb2', _globals) -if _descriptor._USE_C_DESCRIPTORS == False: - _globals['DESCRIPTOR']._options = None +if not _descriptor._USE_C_DESCRIPTORS: + _globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._serialized_options = b'\n(ml.neptune.leaderboard.api.ingest.v1.pubB\x18IngestRequestStatusProtoP\x01' _globals['_REQUESTSTATUS']._serialized_start = 131 _globals['_REQUESTSTATUS']._serialized_end = 328 diff --git a/src/neptune_retrieval_api/proto/neptune_pb/api/v1/model/attributes_pb2.py b/src/neptune_retrieval_api/proto/neptune_pb/api/v1/model/attributes_pb2.py index 4e3dab1..0ff28d1 100644 --- a/src/neptune_retrieval_api/proto/neptune_pb/api/v1/model/attributes_pb2.py +++ b/src/neptune_retrieval_api/proto/neptune_pb/api/v1/model/attributes_pb2.py @@ -1,16 +1,18 @@ """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import runtime_version as _runtime_version from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder +_runtime_version.ValidateProtobufRuntimeVersion(_runtime_version.Domain.PUBLIC, 5, 28, 1, '', 'neptune_pb/api/v1/model/attributes.proto') _sym_db = _symbol_database.Default() from .....neptune_pb.api.v1.model import leaderboard_entries_pb2 as neptune__pb_dot_api_dot_v1_dot_model_dot_leaderboard__entries__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n(neptune_pb/api/v1/model/attributes.proto\x12\x14neptune.api.v1.model\x1a1neptune_pb/api/v1/model/leaderboard_entries.proto"d\n\x1eProtoAttributesSearchResultDTO\x12B\n\x07entries\x18\x01 \x03(\x0b21.neptune.api.v1.model.ProtoAttributeDefinitionDTO"9\n\x1bProtoAttributeDefinitionDTO\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04type\x18\x02 \x01(\t"\xa9\x01\n\x1dProtoQueryAttributesResultDTO\x12N\n\x07entries\x18\x01 \x03(\x0b2=.neptune.api.v1.model.ProtoQueryAttributesExperimentResultDTO\x128\n\x08nextPage\x18\x02 \x01(\x0b2&.neptune.api.v1.model.ProtoNextPageDTO"^\n\x10ProtoNextPageDTO\x12\x1a\n\rnextPageToken\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x12\n\x05limit\x18\x02 \x01(\rH\x01\x88\x01\x01B\x10\n\x0e_nextPageTokenB\x08\n\x06_limit"\x97\x01\n\'ProtoQueryAttributesExperimentResultDTO\x12\x14\n\x0cexperimentId\x18\x01 \x01(\t\x12\x19\n\x11experimentShortId\x18\x02 \x01(\t\x12;\n\nattributes\x18\x03 \x03(\x0b2\'.neptune.api.v1.model.ProtoAttributeDTOB4\n0ml.neptune.leaderboard.api.model.proto.generatedP\x01b\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'neptune_pb.api.v1.model.attributes_pb2', _globals) -if _descriptor._USE_C_DESCRIPTORS == False: - _globals['DESCRIPTOR']._options = None +if not _descriptor._USE_C_DESCRIPTORS: + _globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._serialized_options = b'\n0ml.neptune.leaderboard.api.model.proto.generatedP\x01' _globals['_PROTOATTRIBUTESSEARCHRESULTDTO']._serialized_start = 117 _globals['_PROTOATTRIBUTESSEARCHRESULTDTO']._serialized_end = 217 diff --git a/src/neptune_retrieval_api/proto/neptune_pb/api/v1/model/leaderboard_entries_pb2.py b/src/neptune_retrieval_api/proto/neptune_pb/api/v1/model/leaderboard_entries_pb2.py index 62e06d0..c551a05 100644 --- a/src/neptune_retrieval_api/proto/neptune_pb/api/v1/model/leaderboard_entries_pb2.py +++ b/src/neptune_retrieval_api/proto/neptune_pb/api/v1/model/leaderboard_entries_pb2.py @@ -1,35 +1,39 @@ """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import runtime_version as _runtime_version from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder +_runtime_version.ValidateProtobufRuntimeVersion(_runtime_version.Domain.PUBLIC, 5, 28, 1, '', 'neptune_pb/api/v1/model/leaderboard_entries.proto') _sym_db = _symbol_database.Default() -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n1neptune_pb/api/v1/model/leaderboard_entries.proto\x12\x14neptune.api.v1.model"\xb6\x01\n&ProtoLeaderboardEntriesSearchResultDTO\x12\x1b\n\x13matching_item_count\x18\x01 \x01(\x03\x12\x1e\n\x11total_group_count\x18\x02 \x01(\x03H\x00\x88\x01\x01\x129\n\x07entries\x18\x03 \x03(\x0b2(.neptune.api.v1.model.ProtoAttributesDTOB\x14\n\x12_total_group_count"\xd4\x01\n\x12ProtoAttributesDTO\x12\x15\n\rexperiment_id\x18\x01 \x01(\t\x12\x0c\n\x04type\x18\x02 \x01(\t\x12\x12\n\nproject_id\x18\x03 \x01(\t\x12\x17\n\x0forganization_id\x18\x04 \x01(\t\x12\x14\n\x0cproject_name\x18\x05 \x01(\t\x12\x19\n\x11organization_name\x18\x06 \x01(\t\x12;\n\nattributes\x18\x07 \x03(\x0b2\'.neptune.api.v1.model.ProtoAttributeDTO"\x82\x06\n\x11ProtoAttributeDTO\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04type\x18\x02 \x01(\t\x12G\n\x0eint_properties\x18\x03 \x01(\x0b2*.neptune.api.v1.model.ProtoIntAttributeDTOH\x00\x88\x01\x01\x12K\n\x10float_properties\x18\x04 \x01(\x0b2,.neptune.api.v1.model.ProtoFloatAttributeDTOH\x01\x88\x01\x01\x12M\n\x11string_properties\x18\x05 \x01(\x0b2-.neptune.api.v1.model.ProtoStringAttributeDTOH\x02\x88\x01\x01\x12I\n\x0fbool_properties\x18\x06 \x01(\x0b2+.neptune.api.v1.model.ProtoBoolAttributeDTOH\x03\x88\x01\x01\x12Q\n\x13datetime_properties\x18\x07 \x01(\x0b2/.neptune.api.v1.model.ProtoDatetimeAttributeDTOH\x04\x88\x01\x01\x12T\n\x15string_set_properties\x18\x08 \x01(\x0b20.neptune.api.v1.model.ProtoStringSetAttributeDTOH\x05\x88\x01\x01\x12X\n\x17float_series_properties\x18\t \x01(\x0b22.neptune.api.v1.model.ProtoFloatSeriesAttributeDTOH\x06\x88\x01\x01B\x11\n\x0f_int_propertiesB\x13\n\x11_float_propertiesB\x14\n\x12_string_propertiesB\x12\n\x10_bool_propertiesB\x16\n\x14_datetime_propertiesB\x18\n\x16_string_set_propertiesB\x1a\n\x18_float_series_properties"U\n\x14ProtoIntAttributeDTO\x12\x16\n\x0eattribute_name\x18\x01 \x01(\t\x12\x16\n\x0eattribute_type\x18\x02 \x01(\t\x12\r\n\x05value\x18\x03 \x01(\x03"W\n\x16ProtoFloatAttributeDTO\x12\x16\n\x0eattribute_name\x18\x01 \x01(\t\x12\x16\n\x0eattribute_type\x18\x02 \x01(\t\x12\r\n\x05value\x18\x03 \x01(\x01"X\n\x17ProtoStringAttributeDTO\x12\x16\n\x0eattribute_name\x18\x01 \x01(\t\x12\x16\n\x0eattribute_type\x18\x02 \x01(\t\x12\r\n\x05value\x18\x03 \x01(\t"V\n\x15ProtoBoolAttributeDTO\x12\x16\n\x0eattribute_name\x18\x01 \x01(\t\x12\x16\n\x0eattribute_type\x18\x02 \x01(\t\x12\r\n\x05value\x18\x03 \x01(\x08"Z\n\x19ProtoDatetimeAttributeDTO\x12\x16\n\x0eattribute_name\x18\x01 \x01(\t\x12\x16\n\x0eattribute_type\x18\x02 \x01(\t\x12\r\n\x05value\x18\x03 \x01(\x03"[\n\x1aProtoStringSetAttributeDTO\x12\x16\n\x0eattribute_name\x18\x01 \x01(\t\x12\x16\n\x0eattribute_type\x18\x02 \x01(\t\x12\r\n\x05value\x18\x03 \x03(\t"\xd4\x02\n\x1cProtoFloatSeriesAttributeDTO\x12\x16\n\x0eattribute_name\x18\x01 \x01(\t\x12\x16\n\x0eattribute_type\x18\x02 \x01(\t\x12\x16\n\tlast_step\x18\x03 \x01(\x01H\x00\x88\x01\x01\x12\x11\n\x04last\x18\x04 \x01(\x01H\x01\x88\x01\x01\x12\x10\n\x03min\x18\x05 \x01(\x01H\x02\x88\x01\x01\x12\x10\n\x03max\x18\x06 \x01(\x01H\x03\x88\x01\x01\x12\x14\n\x07average\x18\x07 \x01(\x01H\x04\x88\x01\x01\x12\x15\n\x08variance\x18\x08 \x01(\x01H\x05\x88\x01\x01\x12H\n\x06config\x18\t \x01(\x0b28.neptune.api.v1.model.ProtoFloatSeriesAttributeConfigDTOB\x0c\n\n_last_stepB\x07\n\x05_lastB\x06\n\x04_minB\x06\n\x04_maxB\n\n\x08_averageB\x0b\n\t_variance"t\n"ProtoFloatSeriesAttributeConfigDTO\x12\x10\n\x03min\x18\x01 \x01(\x01H\x00\x88\x01\x01\x12\x10\n\x03max\x18\x02 \x01(\x01H\x01\x88\x01\x01\x12\x11\n\x04unit\x18\x03 \x01(\tH\x02\x88\x01\x01B\x06\n\x04_minB\x06\n\x04_maxB\x07\n\x05_unitB4\n0ml.neptune.leaderboard.api.model.proto.generatedP\x01b\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n1neptune_pb/api/v1/model/leaderboard_entries.proto\x12\x14neptune.api.v1.model"\xb6\x01\n&ProtoLeaderboardEntriesSearchResultDTO\x12\x1b\n\x13matching_item_count\x18\x01 \x01(\x03\x12\x1e\n\x11total_group_count\x18\x02 \x01(\x03H\x00\x88\x01\x01\x129\n\x07entries\x18\x03 \x03(\x0b2(.neptune.api.v1.model.ProtoAttributesDTOB\x14\n\x12_total_group_count"\xd4\x01\n\x12ProtoAttributesDTO\x12\x15\n\rexperiment_id\x18\x01 \x01(\t\x12\x0c\n\x04type\x18\x02 \x01(\t\x12\x12\n\nproject_id\x18\x03 \x01(\t\x12\x17\n\x0forganization_id\x18\x04 \x01(\t\x12\x14\n\x0cproject_name\x18\x05 \x01(\t\x12\x19\n\x11organization_name\x18\x06 \x01(\t\x12;\n\nattributes\x18\x07 \x03(\x0b2\'.neptune.api.v1.model.ProtoAttributeDTO"\xec\x06\n\x11ProtoAttributeDTO\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04type\x18\x02 \x01(\t\x12G\n\x0eint_properties\x18\x03 \x01(\x0b2*.neptune.api.v1.model.ProtoIntAttributeDTOH\x00\x88\x01\x01\x12K\n\x10float_properties\x18\x04 \x01(\x0b2,.neptune.api.v1.model.ProtoFloatAttributeDTOH\x01\x88\x01\x01\x12M\n\x11string_properties\x18\x05 \x01(\x0b2-.neptune.api.v1.model.ProtoStringAttributeDTOH\x02\x88\x01\x01\x12I\n\x0fbool_properties\x18\x06 \x01(\x0b2+.neptune.api.v1.model.ProtoBoolAttributeDTOH\x03\x88\x01\x01\x12Q\n\x13datetime_properties\x18\x07 \x01(\x0b2/.neptune.api.v1.model.ProtoDatetimeAttributeDTOH\x04\x88\x01\x01\x12T\n\x15string_set_properties\x18\x08 \x01(\x0b20.neptune.api.v1.model.ProtoStringSetAttributeDTOH\x05\x88\x01\x01\x12X\n\x17float_series_properties\x18\t \x01(\x0b22.neptune.api.v1.model.ProtoFloatSeriesAttributeDTOH\x06\x88\x01\x01\x12P\n\x13file_ref_properties\x18\n \x01(\x0b2..neptune.api.v1.model.ProtoFileRefAttributeDTOH\x07\x88\x01\x01B\x11\n\x0f_int_propertiesB\x13\n\x11_float_propertiesB\x14\n\x12_string_propertiesB\x12\n\x10_bool_propertiesB\x16\n\x14_datetime_propertiesB\x18\n\x16_string_set_propertiesB\x1a\n\x18_float_series_propertiesB\x16\n\x14_file_ref_properties"U\n\x14ProtoIntAttributeDTO\x12\x16\n\x0eattribute_name\x18\x01 \x01(\t\x12\x16\n\x0eattribute_type\x18\x02 \x01(\t\x12\r\n\x05value\x18\x03 \x01(\x03"W\n\x16ProtoFloatAttributeDTO\x12\x16\n\x0eattribute_name\x18\x01 \x01(\t\x12\x16\n\x0eattribute_type\x18\x02 \x01(\t\x12\r\n\x05value\x18\x03 \x01(\x01"X\n\x17ProtoStringAttributeDTO\x12\x16\n\x0eattribute_name\x18\x01 \x01(\t\x12\x16\n\x0eattribute_type\x18\x02 \x01(\t\x12\r\n\x05value\x18\x03 \x01(\t"V\n\x15ProtoBoolAttributeDTO\x12\x16\n\x0eattribute_name\x18\x01 \x01(\t\x12\x16\n\x0eattribute_type\x18\x02 \x01(\t\x12\r\n\x05value\x18\x03 \x01(\x08"Z\n\x19ProtoDatetimeAttributeDTO\x12\x16\n\x0eattribute_name\x18\x01 \x01(\t\x12\x16\n\x0eattribute_type\x18\x02 \x01(\t\x12\r\n\x05value\x18\x03 \x01(\x03"[\n\x1aProtoStringSetAttributeDTO\x12\x16\n\x0eattribute_name\x18\x01 \x01(\t\x12\x16\n\x0eattribute_type\x18\x02 \x01(\t\x12\r\n\x05value\x18\x03 \x03(\t"\xd4\x02\n\x1cProtoFloatSeriesAttributeDTO\x12\x16\n\x0eattribute_name\x18\x01 \x01(\t\x12\x16\n\x0eattribute_type\x18\x02 \x01(\t\x12\x16\n\tlast_step\x18\x03 \x01(\x01H\x00\x88\x01\x01\x12\x11\n\x04last\x18\x04 \x01(\x01H\x01\x88\x01\x01\x12\x10\n\x03min\x18\x05 \x01(\x01H\x02\x88\x01\x01\x12\x10\n\x03max\x18\x06 \x01(\x01H\x03\x88\x01\x01\x12\x14\n\x07average\x18\x07 \x01(\x01H\x04\x88\x01\x01\x12\x15\n\x08variance\x18\x08 \x01(\x01H\x05\x88\x01\x01\x12H\n\x06config\x18\t \x01(\x0b28.neptune.api.v1.model.ProtoFloatSeriesAttributeConfigDTOB\x0c\n\n_last_stepB\x07\n\x05_lastB\x06\n\x04_minB\x06\n\x04_maxB\n\n\x08_averageB\x0b\n\t_variance"t\n"ProtoFloatSeriesAttributeConfigDTO\x12\x10\n\x03min\x18\x01 \x01(\x01H\x00\x88\x01\x01\x12\x10\n\x03max\x18\x02 \x01(\x01H\x01\x88\x01\x01\x12\x11\n\x04unit\x18\x03 \x01(\tH\x02\x88\x01\x01B\x06\n\x04_minB\x06\n\x04_maxB\x07\n\x05_unit"}\n\x18ProtoFileRefAttributeDTO\x12\x16\n\x0eattribute_name\x18\x01 \x01(\t\x12\x16\n\x0eattribute_type\x18\x02 \x01(\t\x12\x0c\n\x04path\x18\x03 \x01(\t\x12\x11\n\tsizeBytes\x18\x04 \x01(\x03\x12\x10\n\x08mimeType\x18\x05 \x01(\tB4\n0ml.neptune.leaderboard.api.model.proto.generatedP\x01b\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'neptune_pb.api.v1.model.leaderboard_entries_pb2', _globals) -if _descriptor._USE_C_DESCRIPTORS == False: - _globals['DESCRIPTOR']._options = None +if not _descriptor._USE_C_DESCRIPTORS: + _globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._serialized_options = b'\n0ml.neptune.leaderboard.api.model.proto.generatedP\x01' _globals['_PROTOLEADERBOARDENTRIESSEARCHRESULTDTO']._serialized_start = 76 _globals['_PROTOLEADERBOARDENTRIESSEARCHRESULTDTO']._serialized_end = 258 _globals['_PROTOATTRIBUTESDTO']._serialized_start = 261 _globals['_PROTOATTRIBUTESDTO']._serialized_end = 473 _globals['_PROTOATTRIBUTEDTO']._serialized_start = 476 - _globals['_PROTOATTRIBUTEDTO']._serialized_end = 1246 - _globals['_PROTOINTATTRIBUTEDTO']._serialized_start = 1248 - _globals['_PROTOINTATTRIBUTEDTO']._serialized_end = 1333 - _globals['_PROTOFLOATATTRIBUTEDTO']._serialized_start = 1335 - _globals['_PROTOFLOATATTRIBUTEDTO']._serialized_end = 1422 - _globals['_PROTOSTRINGATTRIBUTEDTO']._serialized_start = 1424 - _globals['_PROTOSTRINGATTRIBUTEDTO']._serialized_end = 1512 - _globals['_PROTOBOOLATTRIBUTEDTO']._serialized_start = 1514 - _globals['_PROTOBOOLATTRIBUTEDTO']._serialized_end = 1600 - _globals['_PROTODATETIMEATTRIBUTEDTO']._serialized_start = 1602 - _globals['_PROTODATETIMEATTRIBUTEDTO']._serialized_end = 1692 - _globals['_PROTOSTRINGSETATTRIBUTEDTO']._serialized_start = 1694 - _globals['_PROTOSTRINGSETATTRIBUTEDTO']._serialized_end = 1785 - _globals['_PROTOFLOATSERIESATTRIBUTEDTO']._serialized_start = 1788 - _globals['_PROTOFLOATSERIESATTRIBUTEDTO']._serialized_end = 2128 - _globals['_PROTOFLOATSERIESATTRIBUTECONFIGDTO']._serialized_start = 2130 - _globals['_PROTOFLOATSERIESATTRIBUTECONFIGDTO']._serialized_end = 2246 \ No newline at end of file + _globals['_PROTOATTRIBUTEDTO']._serialized_end = 1352 + _globals['_PROTOINTATTRIBUTEDTO']._serialized_start = 1354 + _globals['_PROTOINTATTRIBUTEDTO']._serialized_end = 1439 + _globals['_PROTOFLOATATTRIBUTEDTO']._serialized_start = 1441 + _globals['_PROTOFLOATATTRIBUTEDTO']._serialized_end = 1528 + _globals['_PROTOSTRINGATTRIBUTEDTO']._serialized_start = 1530 + _globals['_PROTOSTRINGATTRIBUTEDTO']._serialized_end = 1618 + _globals['_PROTOBOOLATTRIBUTEDTO']._serialized_start = 1620 + _globals['_PROTOBOOLATTRIBUTEDTO']._serialized_end = 1706 + _globals['_PROTODATETIMEATTRIBUTEDTO']._serialized_start = 1708 + _globals['_PROTODATETIMEATTRIBUTEDTO']._serialized_end = 1798 + _globals['_PROTOSTRINGSETATTRIBUTEDTO']._serialized_start = 1800 + _globals['_PROTOSTRINGSETATTRIBUTEDTO']._serialized_end = 1891 + _globals['_PROTOFLOATSERIESATTRIBUTEDTO']._serialized_start = 1894 + _globals['_PROTOFLOATSERIESATTRIBUTEDTO']._serialized_end = 2234 + _globals['_PROTOFLOATSERIESATTRIBUTECONFIGDTO']._serialized_start = 2236 + _globals['_PROTOFLOATSERIESATTRIBUTECONFIGDTO']._serialized_end = 2352 + _globals['_PROTOFILEREFATTRIBUTEDTO']._serialized_start = 2354 + _globals['_PROTOFILEREFATTRIBUTEDTO']._serialized_end = 2479 \ No newline at end of file diff --git a/src/neptune_retrieval_api/proto/neptune_pb/api/v1/model/leaderboard_entries_pb2.pyi b/src/neptune_retrieval_api/proto/neptune_pb/api/v1/model/leaderboard_entries_pb2.pyi index f01b45c..8461bcb 100644 --- a/src/neptune_retrieval_api/proto/neptune_pb/api/v1/model/leaderboard_entries_pb2.pyi +++ b/src/neptune_retrieval_api/proto/neptune_pb/api/v1/model/leaderboard_entries_pb2.pyi @@ -76,6 +76,7 @@ class ProtoAttributeDTO(google.protobuf.message.Message): DATETIME_PROPERTIES_FIELD_NUMBER: builtins.int STRING_SET_PROPERTIES_FIELD_NUMBER: builtins.int FLOAT_SERIES_PROPERTIES_FIELD_NUMBER: builtins.int + FILE_REF_PROPERTIES_FIELD_NUMBER: builtins.int name: builtins.str type: builtins.str @@ -107,13 +108,17 @@ class ProtoAttributeDTO(google.protobuf.message.Message): def float_series_properties(self) -> global___ProtoFloatSeriesAttributeDTO: ... - def __init__(self, *, name: builtins.str=..., type: builtins.str=..., int_properties: global___ProtoIntAttributeDTO | None=..., float_properties: global___ProtoFloatAttributeDTO | None=..., string_properties: global___ProtoStringAttributeDTO | None=..., bool_properties: global___ProtoBoolAttributeDTO | None=..., datetime_properties: global___ProtoDatetimeAttributeDTO | None=..., string_set_properties: global___ProtoStringSetAttributeDTO | None=..., float_series_properties: global___ProtoFloatSeriesAttributeDTO | None=...) -> None: + @property + def file_ref_properties(self) -> global___ProtoFileRefAttributeDTO: + ... + + def __init__(self, *, name: builtins.str=..., type: builtins.str=..., int_properties: global___ProtoIntAttributeDTO | None=..., float_properties: global___ProtoFloatAttributeDTO | None=..., string_properties: global___ProtoStringAttributeDTO | None=..., bool_properties: global___ProtoBoolAttributeDTO | None=..., datetime_properties: global___ProtoDatetimeAttributeDTO | None=..., string_set_properties: global___ProtoStringSetAttributeDTO | None=..., float_series_properties: global___ProtoFloatSeriesAttributeDTO | None=..., file_ref_properties: global___ProtoFileRefAttributeDTO | None=...) -> None: ... - def HasField(self, field_name: typing.Literal['_bool_properties', b'_bool_properties', '_datetime_properties', b'_datetime_properties', '_float_properties', b'_float_properties', '_float_series_properties', b'_float_series_properties', '_int_properties', b'_int_properties', '_string_properties', b'_string_properties', '_string_set_properties', b'_string_set_properties', 'bool_properties', b'bool_properties', 'datetime_properties', b'datetime_properties', 'float_properties', b'float_properties', 'float_series_properties', b'float_series_properties', 'int_properties', b'int_properties', 'string_properties', b'string_properties', 'string_set_properties', b'string_set_properties']) -> builtins.bool: + def HasField(self, field_name: typing.Literal['_bool_properties', b'_bool_properties', '_datetime_properties', b'_datetime_properties', '_file_ref_properties', b'_file_ref_properties', '_float_properties', b'_float_properties', '_float_series_properties', b'_float_series_properties', '_int_properties', b'_int_properties', '_string_properties', b'_string_properties', '_string_set_properties', b'_string_set_properties', 'bool_properties', b'bool_properties', 'datetime_properties', b'datetime_properties', 'file_ref_properties', b'file_ref_properties', 'float_properties', b'float_properties', 'float_series_properties', b'float_series_properties', 'int_properties', b'int_properties', 'string_properties', b'string_properties', 'string_set_properties', b'string_set_properties']) -> builtins.bool: ... - def ClearField(self, field_name: typing.Literal['_bool_properties', b'_bool_properties', '_datetime_properties', b'_datetime_properties', '_float_properties', b'_float_properties', '_float_series_properties', b'_float_series_properties', '_int_properties', b'_int_properties', '_string_properties', b'_string_properties', '_string_set_properties', b'_string_set_properties', 'bool_properties', b'bool_properties', 'datetime_properties', b'datetime_properties', 'float_properties', b'float_properties', 'float_series_properties', b'float_series_properties', 'int_properties', b'int_properties', 'name', b'name', 'string_properties', b'string_properties', 'string_set_properties', b'string_set_properties', 'type', b'type']) -> None: + def ClearField(self, field_name: typing.Literal['_bool_properties', b'_bool_properties', '_datetime_properties', b'_datetime_properties', '_file_ref_properties', b'_file_ref_properties', '_float_properties', b'_float_properties', '_float_series_properties', b'_float_series_properties', '_int_properties', b'_int_properties', '_string_properties', b'_string_properties', '_string_set_properties', b'_string_set_properties', 'bool_properties', b'bool_properties', 'datetime_properties', b'datetime_properties', 'file_ref_properties', b'file_ref_properties', 'float_properties', b'float_properties', 'float_series_properties', b'float_series_properties', 'int_properties', b'int_properties', 'name', b'name', 'string_properties', b'string_properties', 'string_set_properties', b'string_set_properties', 'type', b'type']) -> None: ... @typing.overload @@ -124,6 +129,10 @@ class ProtoAttributeDTO(google.protobuf.message.Message): def WhichOneof(self, oneof_group: typing.Literal['_datetime_properties', b'_datetime_properties']) -> typing.Literal['datetime_properties'] | None: ... + @typing.overload + def WhichOneof(self, oneof_group: typing.Literal['_file_ref_properties', b'_file_ref_properties']) -> typing.Literal['file_ref_properties'] | None: + ... + @typing.overload def WhichOneof(self, oneof_group: typing.Literal['_float_properties', b'_float_properties']) -> typing.Literal['float_properties'] | None: ... @@ -339,4 +348,25 @@ class ProtoFloatSeriesAttributeConfigDTO(google.protobuf.message.Message): @typing.overload def WhichOneof(self, oneof_group: typing.Literal['_unit', b'_unit']) -> typing.Literal['unit'] | None: ... -global___ProtoFloatSeriesAttributeConfigDTO = ProtoFloatSeriesAttributeConfigDTO \ No newline at end of file +global___ProtoFloatSeriesAttributeConfigDTO = ProtoFloatSeriesAttributeConfigDTO + +@typing.final +class ProtoFileRefAttributeDTO(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + ATTRIBUTE_NAME_FIELD_NUMBER: builtins.int + ATTRIBUTE_TYPE_FIELD_NUMBER: builtins.int + PATH_FIELD_NUMBER: builtins.int + SIZEBYTES_FIELD_NUMBER: builtins.int + MIMETYPE_FIELD_NUMBER: builtins.int + attribute_name: builtins.str + attribute_type: builtins.str + path: builtins.str + sizeBytes: builtins.int + mimeType: builtins.str + + def __init__(self, *, attribute_name: builtins.str=..., attribute_type: builtins.str=..., path: builtins.str=..., sizeBytes: builtins.int=..., mimeType: builtins.str=...) -> None: + ... + + def ClearField(self, field_name: typing.Literal['attribute_name', b'attribute_name', 'attribute_type', b'attribute_type', 'mimeType', b'mimeType', 'path', b'path', 'sizeBytes', b'sizeBytes']) -> None: + ... +global___ProtoFileRefAttributeDTO = ProtoFileRefAttributeDTO \ No newline at end of file diff --git a/src/neptune_retrieval_api/proto/neptune_pb/api/v1/model/series_values_pb2.py b/src/neptune_retrieval_api/proto/neptune_pb/api/v1/model/series_values_pb2.py index b23defe..6d82e15 100644 --- a/src/neptune_retrieval_api/proto/neptune_pb/api/v1/model/series_values_pb2.py +++ b/src/neptune_retrieval_api/proto/neptune_pb/api/v1/model/series_values_pb2.py @@ -1,15 +1,17 @@ """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import runtime_version as _runtime_version from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder +_runtime_version.ValidateProtobufRuntimeVersion(_runtime_version.Domain.PUBLIC, 5, 28, 1, '', 'neptune_pb/api/v1/model/series_values.proto') _sym_db = _symbol_database.Default() DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n+neptune_pb/api/v1/model/series_values.proto\x12\x14neptune.api.v1.model"x\n!ProtoFloatSeriesValuesResponseDTO\x12S\n\x06series\x18\x01 \x03(\x0b2C.neptune.api.v1.model.ProtoFloatSeriesValuesSingleSeriesResponseDTO"\x83\x01\n-ProtoFloatSeriesValuesSingleSeriesResponseDTO\x12\x11\n\trequestId\x18\x01 \x01(\t\x12?\n\x06series\x18\x02 \x01(\x0b2/.neptune.api.v1.model.ProtoFloatSeriesValuesDTO"t\n\x19ProtoFloatSeriesValuesDTO\x12\x18\n\x10total_item_count\x18\x01 \x01(\x03\x12=\n\x06values\x18\x02 \x03(\x0b2-.neptune.api.v1.model.ProtoFloatPointValueDTO"P\n\x17ProtoFloatPointValueDTO\x12\x18\n\x10timestamp_millis\x18\x01 \x01(\x03\x12\x0c\n\x04step\x18\x02 \x01(\x01\x12\r\n\x05value\x18\x03 \x01(\x01B4\n0ml.neptune.leaderboard.api.model.proto.generatedP\x01b\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'neptune_pb.api.v1.model.series_values_pb2', _globals) -if _descriptor._USE_C_DESCRIPTORS == False: - _globals['DESCRIPTOR']._options = None +if not _descriptor._USE_C_DESCRIPTORS: + _globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._serialized_options = b'\n0ml.neptune.leaderboard.api.model.proto.generatedP\x01' _globals['_PROTOFLOATSERIESVALUESRESPONSEDTO']._serialized_start = 69 _globals['_PROTOFLOATSERIESVALUESRESPONSEDTO']._serialized_end = 189 diff --git a/src/neptune_storage_api/__init__.py b/src/neptune_storage_api/__init__.py new file mode 100644 index 0000000..6535099 --- /dev/null +++ b/src/neptune_storage_api/__init__.py @@ -0,0 +1,11 @@ +"""A client library for accessing storagebridge""" + +from .client import ( + AuthenticatedClient, + Client, +) + +__all__ = ( + "AuthenticatedClient", + "Client", +) diff --git a/src/neptune_storage_api/api/__init__.py b/src/neptune_storage_api/api/__init__.py new file mode 100644 index 0000000..81f9fa2 --- /dev/null +++ b/src/neptune_storage_api/api/__init__.py @@ -0,0 +1 @@ +"""Contains methods for accessing the API""" diff --git a/src/neptune_storage_api/api/storagebridge/__init__.py b/src/neptune_storage_api/api/storagebridge/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/neptune_storage_api/api/storagebridge/signed_url.py b/src/neptune_storage_api/api/storagebridge/signed_url.py new file mode 100644 index 0000000..40292cf --- /dev/null +++ b/src/neptune_storage_api/api/storagebridge/signed_url.py @@ -0,0 +1,173 @@ +from http import HTTPStatus +from typing import ( + Any, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...models.create_signed_urls_request import CreateSignedUrlsRequest +from ...models.create_signed_urls_response import CreateSignedUrlsResponse +from ...types import Response + + +def _get_kwargs( + *, + body: CreateSignedUrlsRequest, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/api/storagebridge/v1/azure/signedUrl", + } + + _body = body.to_dict() + + _kwargs["json"] = _body + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, CreateSignedUrlsResponse]]: + if response.status_code == 200: + response_200 = CreateSignedUrlsResponse.from_dict(response.json()) + + return response_200 + if response.status_code == 401: + response_401 = cast(Any, None) + return response_401 + if response.status_code == 403: + response_403 = cast(Any, None) + return response_403 + if response.status_code == 413: + response_413 = cast(Any, None) + return response_413 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, CreateSignedUrlsResponse]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: Union[AuthenticatedClient, Client], + body: CreateSignedUrlsRequest, +) -> Response[Union[Any, CreateSignedUrlsResponse]]: + """ + Args: + body (CreateSignedUrlsRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Union[Any, CreateSignedUrlsResponse]] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: Union[AuthenticatedClient, Client], + body: CreateSignedUrlsRequest, +) -> Optional[Union[Any, CreateSignedUrlsResponse]]: + """ + Args: + body (CreateSignedUrlsRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Union[Any, CreateSignedUrlsResponse] + """ + + return sync_detailed( + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + *, + client: Union[AuthenticatedClient, Client], + body: CreateSignedUrlsRequest, +) -> Response[Union[Any, CreateSignedUrlsResponse]]: + """ + Args: + body (CreateSignedUrlsRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Union[Any, CreateSignedUrlsResponse]] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: Union[AuthenticatedClient, Client], + body: CreateSignedUrlsRequest, +) -> Optional[Union[Any, CreateSignedUrlsResponse]]: + """ + Args: + body (CreateSignedUrlsRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Union[Any, CreateSignedUrlsResponse] + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + ) + ).parsed diff --git a/src/neptune_storage_api/client.py b/src/neptune_storage_api/client.py new file mode 100644 index 0000000..74544bd --- /dev/null +++ b/src/neptune_storage_api/client.py @@ -0,0 +1,411 @@ +# +# Copyright (c) 2025, Neptune Labs Sp. z o.o. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +__all__ = ["Client", "AuthenticatedClient", "NeptuneAuthenticator"] + +import ssl +import threading +import typing +from typing import ( + Any, + Callable, + Dict, + Generator, + Optional, + Union, +) + +import httpx +from attrs import ( + define, + evolve, + field, +) + +from neptune_api.credentials import Credentials +from neptune_api.errors import UnableToRefreshTokenError +from neptune_api.types import OAuthToken + + +@define +class Client: + """A class for keeping track of data related to the API + + The following are accepted as keyword arguments and will be used to construct httpx Clients internally: + + ``base_url``: The base URL for the API, all requests are made to a relative path to this URL + + ``cookies``: A dictionary of cookies to be sent with every request + + ``headers``: A dictionary of headers to be sent with every request + + ``timeout``: The maximum amount of a time a request can take. API functions will raise + httpx.TimeoutException if this is exceeded. + + ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production, + but can be set to False for testing purposes. + + ``follow_redirects``: Whether or not to follow redirects. Default value is False. + + ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor. + + + Attributes: + raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a + status code that was not documented in the source OpenAPI document. Can also be provided as a keyword + argument to the constructor. + """ + + raise_on_unexpected_status: bool = field(default=False, kw_only=True) + _base_url: str = field(alias="base_url") + _cookies: Dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") + _headers: Dict[str, str] = field(factory=dict, kw_only=True, alias="headers") + _timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout") + _verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl") + _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") + _httpx_args: Dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") + _client: Optional[httpx.Client] = field(default=None, init=False) + _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False) + + def with_headers(self, headers: Dict[str, str]) -> "Client": + """Get a new client matching this one with additional headers""" + if self._client is not None: + self._client.headers.update(headers) + if self._async_client is not None: + self._async_client.headers.update(headers) + return evolve(self, headers={**self._headers, **headers}) + + def with_cookies(self, cookies: Dict[str, str]) -> "Client": + """Get a new client matching this one with additional cookies""" + if self._client is not None: + self._client.cookies.update(cookies) + if self._async_client is not None: + self._async_client.cookies.update(cookies) + return evolve(self, cookies={**self._cookies, **cookies}) + + def with_timeout(self, timeout: httpx.Timeout) -> "Client": + """Get a new client matching this one with a new timeout (in seconds)""" + if self._client is not None: + self._client.timeout = timeout + if self._async_client is not None: + self._async_client.timeout = timeout + return evolve(self, timeout=timeout) + + def set_httpx_client(self, client: httpx.Client) -> "Client": + """Manually the underlying httpx.Client + + **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. + """ + self._client = client + return self + + def get_httpx_client(self) -> httpx.Client: + """Get the underlying httpx.Client, constructing a new one if not previously set""" + if self._client is None: + self._client = httpx.Client( + base_url=self._base_url, + cookies=self._cookies, + headers=self._headers, + timeout=self._timeout, + verify=self._verify_ssl, + follow_redirects=self._follow_redirects, + **self._httpx_args, + ) + return self._client + + def __enter__(self) -> "Client": + """Enter a context manager for self.client—you cannot enter twice (see httpx docs)""" + self.get_httpx_client().__enter__() + return self + + def __exit__(self, *args: Any, **kwargs: Any) -> None: + """Exit a context manager for internal httpx.Client (see httpx docs)""" + self.get_httpx_client().__exit__(*args, **kwargs) + + def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client": + """Manually the underlying httpx.AsyncClient + + **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. + """ + self._async_client = async_client + return self + + def get_async_httpx_client(self) -> httpx.AsyncClient: + """Get the underlying httpx.AsyncClient, constructing a new one if not previously set""" + if self._async_client is None: + self._async_client = httpx.AsyncClient( + base_url=self._base_url, + cookies=self._cookies, + headers=self._headers, + timeout=self._timeout, + verify=self._verify_ssl, + follow_redirects=self._follow_redirects, + **self._httpx_args, + ) + return self._async_client + + async def __aenter__(self) -> "Client": + """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)""" + await self.get_async_httpx_client().__aenter__() + return self + + async def __aexit__(self, *args: Any, **kwargs: Any) -> None: + """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)""" + await self.get_async_httpx_client().__aexit__(*args, **kwargs) + + +@define +class AuthenticatedClient: + """A Client which has been authenticated for use on secured endpoints + + The following are accepted as keyword arguments and will be used to construct httpx Clients internally: + + ``base_url``: The base URL for the API, all requests are made to a relative path to this URL + + ``cookies``: A dictionary of cookies to be sent with every request + + ``headers``: A dictionary of headers to be sent with every request + + ``timeout``: The maximum amount of a time a request can take. API functions will raise + httpx.TimeoutException if this is exceeded. + + ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production, + but can be set to False for testing purposes. + + ``follow_redirects``: Whether or not to follow redirects. Default value is False. + + ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor. + + + Attributes: + raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a + status code that was not documented in the source OpenAPI document. Can also be provided as a keyword + argument to the constructor. + credentials: User credentials for authentication. + token_refreshing_endpoint: Token refreshing endpoint url + client_id: Client identifier for the OAuth application. + api_key_exchange_callback: The Neptune API Token exchange function + prefix: The prefix to use for the Authorization header + auth_header_name: The name of the Authorization header + """ + + raise_on_unexpected_status: bool = field(default=False, kw_only=True) + _base_url: str = field(alias="base_url") + _cookies: Dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") + _headers: Dict[str, str] = field(factory=dict, kw_only=True, alias="headers") + _timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout") + _verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl") + _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") + _httpx_args: Dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") + _client: Optional[httpx.Client] = field(default=None, init=False) + _token_refreshing_client: Optional[Client] = field(default=None, init=False) + _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False) + + credentials: Credentials + token_refreshing_endpoint: str + client_id: str + api_key_exchange_callback: Callable[[Client, Credentials], OAuthToken] + prefix: str = "Bearer" + auth_header_name: str = "Authorization" + + def with_headers(self, headers: Dict[str, str]) -> "AuthenticatedClient": + """Get a new client matching this one with additional headers""" + if self._client is not None: + self._client.headers.update(headers) + + if self._async_client is not None: + self._async_client.headers.update(headers) + + if self._token_refreshing_client is not None: + self._token_refreshing_client.with_headers(headers) + + return evolve(self, headers={**self._headers, **headers}) + + def with_cookies(self, cookies: Dict[str, str]) -> "AuthenticatedClient": + """Get a new client matching this one with additional cookies""" + if self._client is not None: + self._client.cookies.update(cookies) + + if self._async_client is not None: + self._async_client.cookies.update(cookies) + + if self._token_refreshing_client is not None: + self._token_refreshing_client.with_cookies(cookies) + + return evolve(self, cookies={**self._cookies, **cookies}) + + def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient": + """Get a new client matching this one with a new timeout (in seconds)""" + if self._client is not None: + self._client.timeout = timeout + + if self._async_client is not None: + self._async_client.timeout = timeout + + if self._token_refreshing_client is not None: + self._token_refreshing_client.with_timeout(timeout) + + return evolve(self, timeout=timeout) + + def set_httpx_client(self, client: httpx.Client) -> "AuthenticatedClient": + """Manually the underlying httpx.Client + + **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. + """ + self._client = client + return self + + def get_token_refreshing_client(self) -> Client: + """Get the underlying Client, constructing a new one if not previously set""" + if self._token_refreshing_client is None: + self._token_refreshing_client = Client( + base_url=self._base_url, + cookies=self._cookies, + headers=self._headers, + timeout=self._timeout, + verify_ssl=self._verify_ssl, + follow_redirects=self._follow_redirects, + httpx_args=self._httpx_args, + ) + return self._token_refreshing_client + + def set_token_refreshing_client(self, client: Client) -> "AuthenticatedClient": + """Manually the underlying Client used for authentication + + **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. + """ + self._token_refreshing_client = client + return self + + def get_httpx_client(self) -> httpx.Client: + """Get the underlying httpx.Client, constructing a new one if not previously set""" + if self._client is None: + self._client = httpx.Client( + auth=NeptuneAuthenticator( + credentials=self.credentials, + client_id=self.client_id, + token_refreshing_endpoint=self.token_refreshing_endpoint, + api_key_exchange_factory=self.api_key_exchange_callback, + client=self.get_token_refreshing_client(), + ), + base_url=self._base_url, + cookies=self._cookies, + headers=self._headers, + timeout=self._timeout, + verify=self._verify_ssl, + follow_redirects=self._follow_redirects, + **self._httpx_args, + ) + return self._client + + def __enter__(self) -> "AuthenticatedClient": + """Enter a context manager for self.client—you cannot enter twice (see httpx docs)""" + self.get_token_refreshing_client().__enter__() + self.get_httpx_client().__enter__() + return self + + def __exit__(self, *args: Any, **kwargs: Any) -> None: + """Exit a context manager for internal httpx.Client (see httpx docs)""" + self.get_token_refreshing_client().__exit__(*args, **kwargs) + self.get_httpx_client().__exit__(*args, **kwargs) + + def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient": + """Manually the underlying httpx.AsyncClient + + **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. + """ + # TODO: Missing implementation + raise NotImplementedError + + def get_async_httpx_client(self) -> httpx.AsyncClient: + """Get the underlying httpx.AsyncClient, constructing a new one if not previously set""" + # TODO: Missing implementation + raise NotImplementedError + + async def __aenter__(self) -> "AuthenticatedClient": + """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)""" + # TODO: Missing implementation + raise NotImplementedError + + async def __aexit__(self, *args: Any, **kwargs: Any) -> None: + """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)""" + # TODO: Missing implementation + raise NotImplementedError + + +class NeptuneAuthenticator(httpx.Auth): + __LOCK = threading.RLock() + + def __init__( + self, + credentials: Credentials, + client_id: str, + token_refreshing_endpoint: str, + api_key_exchange_factory: Callable[[Client, Credentials], OAuthToken], + client: Client, + ): + self._credentials: Credentials = credentials + self._client_id: str = client_id + self._token_refreshing_endpoint: str = token_refreshing_endpoint + self._api_key_exchange_factory: Callable[[Client, Credentials], OAuthToken] = api_key_exchange_factory + + self._client = client + self._token: Optional[OAuthToken] = None + + def _refresh_existing_token(self) -> None: + if self._token is None: + # This should never happen, but just in case + self._token = self._api_key_exchange_factory(self._client, self._credentials) + return + + try: + response = self._client.get_httpx_client().post( + url=self._token_refreshing_endpoint, + data={ + "grant_type": "refresh_token", + "refresh_token": self._token.refresh_token, + "client_id": self._client_id, + "expires_in": self._token.seconds_left, + }, + ) + data = response.json() + except Exception as e: + raise UnableToRefreshTokenError("Unable to refresh token") from e + + self._token = OAuthToken.from_tokens(access=data["access_token"], refresh=data["refresh_token"]) + + def _refresh_token(self) -> None: + with self.__LOCK: + if self._token is not None: + self._refresh_existing_token() + + if self._token is None: + self._token = self._api_key_exchange_factory(self._client, self._credentials) + + def _refresh_token_if_expired(self) -> None: + if self._token is None or self._token.is_expired: + self._refresh_token() + + def sync_auth_flow(self, request: httpx.Request) -> Generator[httpx.Request, httpx.Response, None]: + self._refresh_token_if_expired() + + if self._token is not None: + request.headers["Authorization"] = f"Bearer {self._token.access_token}" + + yield request + + async def async_auth_flow(self, request: httpx.Request) -> typing.AsyncGenerator[httpx.Request, httpx.Response]: + # TODO: Missing implementation + yield request diff --git a/src/neptune_storage_api/errors.py b/src/neptune_storage_api/errors.py new file mode 100644 index 0000000..36a17df --- /dev/null +++ b/src/neptune_storage_api/errors.py @@ -0,0 +1,64 @@ +# +# Copyright (c) 2025, Neptune Labs Sp. z o.o. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Contains shared errors types that can be raised from API functions""" + +__all__ = [ + "UnexpectedStatus", + "InvalidApiTokenException", + "UnableToExchangeApiKeyError", + "UnableToDeserializeApiKeyError", + "UnableToRefreshTokenError", +] + + +class UnexpectedStatus(Exception): + """Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True""" + + def __init__(self, status_code: int, content: bytes): + self.status_code = status_code + self.content = content + + super().__init__( + f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}" + ) + + +class InvalidApiTokenException(Exception): + """Raised when the api token is invalid""" + + def __init__(self, reason: str = "") -> None: + super().__init__(f"Invalid API token. Reason: {reason}") + + +class UnableToExchangeApiKeyError(Exception): + """Raised when the API key exchange fails""" + + def __init__(self, reason: str = "Unknown") -> None: + super().__init__(f"Unable to exchange API key. Reason: {reason}") + + +class UnableToDeserializeApiKeyError(Exception): + """Raised when the API key cannot be deserialized""" + + def __init__(self) -> None: + super().__init__("Unable to deserialize API key") + + +class UnableToRefreshTokenError(Exception): + """Raised when the token refresh fails""" + + def __init__(self, reason: str = "Unknown") -> None: + super().__init__(f"Unable to refresh token. Reason: {reason}") diff --git a/src/neptune_storage_api/models/__init__.py b/src/neptune_storage_api/models/__init__.py new file mode 100644 index 0000000..7cb43b0 --- /dev/null +++ b/src/neptune_storage_api/models/__init__.py @@ -0,0 +1,15 @@ +"""Contains all the data models used in inputs/outputs""" + +from .create_signed_urls_request import CreateSignedUrlsRequest +from .create_signed_urls_response import CreateSignedUrlsResponse +from .file_to_sign import FileToSign +from .permission import Permission +from .signed_file import SignedFile + +__all__ = ( + "CreateSignedUrlsRequest", + "CreateSignedUrlsResponse", + "FileToSign", + "Permission", + "SignedFile", +) diff --git a/src/neptune_storage_api/models/create_signed_urls_request.py b/src/neptune_storage_api/models/create_signed_urls_request.py new file mode 100644 index 0000000..afe6335 --- /dev/null +++ b/src/neptune_storage_api/models/create_signed_urls_request.py @@ -0,0 +1,61 @@ +from typing import ( + Any, + TypeVar, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="CreateSignedUrlsRequest") + + +@_attrs_define +class CreateSignedUrlsRequest: + """ + Attributes: + files (Any): + """ + + files: Any + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + files = self.files + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "files": files, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: + d = src_dict.copy() + files = d.pop("files") + + create_signed_urls_request = cls( + files=files, + ) + + create_signed_urls_request.additional_properties = d + return create_signed_urls_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/src/neptune_storage_api/models/create_signed_urls_response.py b/src/neptune_storage_api/models/create_signed_urls_response.py new file mode 100644 index 0000000..202ec28 --- /dev/null +++ b/src/neptune_storage_api/models/create_signed_urls_response.py @@ -0,0 +1,61 @@ +from typing import ( + Any, + TypeVar, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="CreateSignedUrlsResponse") + + +@_attrs_define +class CreateSignedUrlsResponse: + """ + Attributes: + files (Any): + """ + + files: Any + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + files = self.files + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "files": files, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: + d = src_dict.copy() + files = d.pop("files") + + create_signed_urls_response = cls( + files=files, + ) + + create_signed_urls_response.additional_properties = d + return create_signed_urls_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/src/neptune_storage_api/models/file_to_sign.py b/src/neptune_storage_api/models/file_to_sign.py new file mode 100644 index 0000000..6911f5d --- /dev/null +++ b/src/neptune_storage_api/models/file_to_sign.py @@ -0,0 +1,79 @@ +from typing import ( + Any, + TypeVar, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..models.permission import Permission + +T = TypeVar("T", bound="FileToSign") + + +@_attrs_define +class FileToSign: + """ + Attributes: + path (Any): + permission (Permission): + project_identifier (Any): + """ + + path: Any + permission: Permission + project_identifier: Any + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + path = self.path + + permission = self.permission.value + + project_identifier = self.project_identifier + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "path": path, + "permission": permission, + "project_identifier": project_identifier, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: + d = src_dict.copy() + path = d.pop("path") + + permission = Permission(d.pop("permission")) + + project_identifier = d.pop("project_identifier") + + file_to_sign = cls( + path=path, + permission=permission, + project_identifier=project_identifier, + ) + + file_to_sign.additional_properties = d + return file_to_sign + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/src/neptune_storage_api/models/permission.py b/src/neptune_storage_api/models/permission.py new file mode 100644 index 0000000..9686ed6 --- /dev/null +++ b/src/neptune_storage_api/models/permission.py @@ -0,0 +1,9 @@ +from enum import Enum + + +class Permission(str, Enum): + READ = "read" + WRITE = "write" + + def __str__(self) -> str: + return str(self.value) diff --git a/src/neptune_storage_api/models/signed_file.py b/src/neptune_storage_api/models/signed_file.py new file mode 100644 index 0000000..59e7616 --- /dev/null +++ b/src/neptune_storage_api/models/signed_file.py @@ -0,0 +1,77 @@ +from typing import ( + Any, + TypeVar, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="SignedFile") + + +@_attrs_define +class SignedFile: + """ + Attributes: + path (Any): + project_identifier (Any): + url (Any): + """ + + path: Any + project_identifier: Any + url: Any + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + path = self.path + + project_identifier = self.project_identifier + + url = self.url + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "path": path, + "project_identifier": project_identifier, + "url": url, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: + d = src_dict.copy() + path = d.pop("path") + + project_identifier = d.pop("project_identifier") + + url = d.pop("url") + + signed_file = cls( + path=path, + project_identifier=project_identifier, + url=url, + ) + + signed_file.additional_properties = d + return signed_file + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/src/neptune_storage_api/py.typed b/src/neptune_storage_api/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/src/neptune_storage_api/types.py b/src/neptune_storage_api/types.py new file mode 100644 index 0000000..a64033a --- /dev/null +++ b/src/neptune_storage_api/types.py @@ -0,0 +1,110 @@ +# +# Copyright (c) 2025, Neptune Labs Sp. z o.o. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Contains some shared types for properties""" + +__all__ = ["File", "Response", "FileJsonType", "Unset", "UNSET", "OAuthToken"] + +import time +from http import HTTPStatus +from typing import ( + BinaryIO, + Generic, + Literal, + MutableMapping, + Optional, + Tuple, + TypeVar, +) + +import jwt +from attrs import ( + define, + field, +) + +from neptune_api.errors import InvalidApiTokenException + +MINIMAL_EXPIRATION_SECONDS = 30 +DECODING_OPTIONS = { + "verify_signature": False, + "verify_exp": False, + "verify_nbf": False, + "verify_iat": False, + "verify_aud": False, + "verify_iss": False, +} + + +class Unset: + def __bool__(self) -> Literal[False]: + return False + + +UNSET: Unset = Unset() + +FileJsonType = Tuple[Optional[str], BinaryIO, Optional[str]] + + +@define +class File: + """Contains information for file uploads""" + + payload: BinaryIO + file_name: Optional[str] = None + mime_type: Optional[str] = None + + def to_tuple(self) -> FileJsonType: + """Return a tuple representation that httpx will accept for multipart/form-data""" + return self.file_name, self.payload, self.mime_type + + +T = TypeVar("T") + + +@define +class Response(Generic[T]): + """A response from an endpoint""" + + status_code: HTTPStatus + content: bytes + headers: MutableMapping[str, str] + parsed: Optional[T] + + +@define +class OAuthToken: + _expiration_time: float = field(default=0.0, alias="expiration_time", kw_only=True) + access_token: str + refresh_token: str + + @classmethod + def from_tokens(cls, access: str, refresh: str) -> "OAuthToken": + # Decode the JWT to get expiration time + try: + decoded_token = jwt.decode(access, options=DECODING_OPTIONS) + expiration_time = float(decoded_token["exp"]) + except (jwt.ExpiredSignatureError, jwt.InvalidTokenError, KeyError) as e: + raise InvalidApiTokenException("Cannot decode the access token") from e + + return OAuthToken(access_token=access, refresh_token=refresh, expiration_time=expiration_time) + + @property + def seconds_left(self) -> float: + return self._expiration_time - time.time() - MINIMAL_EXPIRATION_SECONDS + + @property + def is_expired(self) -> bool: + return self.seconds_left <= 0