Package: ad-components
Accelerated Discovery Reusable ComponentsThe central implementation of Accelerated Discover Reusable Components. It serves as a wrapper around client libraries we use locally like Dapr and MLflow.1.InstallationAll components will be availble usingpipinstallad-componentsCLIHere's an example usage of the CLIusage: adc [-h] [--verbose] [--version] {<component>} ...

Accelerated Discovery reusable components.

positional arguments:
  <component>    the component that you want to trigger.

optional arguments:
  -h, --help     show this help message and exit.
  --version      show program's version number and exit.2. Usage2.0. In your pipelineTo use a component in your pipeline, you need to run it in a Step contextfromad.stepimportDaprStepfromad.storageimportdownload,uploadwithDaprStep():resp=download(download_src,download_dest,binding_name=binding)print(f"download resp:{resp}")resp=upload(upload_src,upload_dest,binding_name=binding)print(f"upload resp:{resp}")Running the components inside a step will make sure the client dependencies are handled correctly.2.1. Storage2.1.2. Python moduleYou can invoke the manager using native python. Please note that the package must be present in you python environment.fromad.storageimportdownload,uploaddownload_resp=download(src,dest,# binding_name="s3-state",  # Or any other binding)upload_resp=upload(src,dest,# binding_name="s3-state",  # Or any other binding)2.1.3. CLIusage:adcstorage[-h]--srcPATH--destPATH[--bindingNAME][--timeoutSEC]{download,upload}positionalarguments:{download,upload}actiontobeperformedondata.

optionalarguments:-h,--helpshowthishelpmessageandexitactionarguments:--srcPATH,-rPATHpathoffiletoperformactionon.--destPATH,-dPATHobject'sdesiredfullpathinthedestination.--bindingNAME,-bNAMEthenameofthebindingasdefinedinthecomponents.

daprarguments:--timeoutSEC,-tSECvalueinsecondsweshouldwaitforsidecartocomeup.Note:You can replaceadcwithpython ad/main.py ...if you don't have the package installed in your python environment.ExamplesTo download an object from S3 runadcstoragedownload\--srctest.txt\--desttmp/downloaded.txtTo upload an object to S3 runadcstorageupload\--srctmp/downloaded.txt\--destlocal/uploaded.txt3. Supported components3.1. Storage3.1.1. Supported operationsBelow is a list of the operations you might intend to perform in your component.UploadUploads data from a file to an object in a bucket.Argumentssrc: Name of file to download.dest: Object name in the bucket.binding: The name of the binding to perform the operation.DownloadDownloads data of an object to file.Argumentssrc: Object name in the bucket.dest: Name of file to download.binding: The name of the binding to perform the operation.Dapr configurationsaddress: Dapr Runtime gRPC endpoint address.timeout: Value in seconds we should wait for sidecar to come up4. PublishingEvery change to the python script requires a new version to be pushed PyPi registry.If you have the right (write) permissions, and a correctly-configured$HOME/.pypircfile, run the following command to publish the packagemake4.1. Increment the versionTo increment the version, go toadstorage/version.pyand increment the version there. Both thesetup.pyand theCLIwill read the new version correctly.4.2 Configure PyPi registryTo be able to push to the package to our private registry, you need to tell PyPi about it. This one-liner command will take care of it for youcat<< EOF > $HOME/.pypirc[distutils]index-servers =pypi[pypi]repository: https://upload.pypi.org/legacy/username: __token__password: $PYPI_TOKENEOFNote:The pip package will fetch the version fromad/version.pyfile, so make sure to increment before pushing.