Package: apollo-lunar
lunar-sdkContentsDescriptionInstallationHow to usecredentialsSDKCLIDevelopmentRequirements for developmentPython environmentDocuments generationSDK for lunar microservicesDescriptionA Python based SDK & CLI for Lunar microservicesThis python package includesFunctions forlunar-recCLI (Command Line Interface) namedlunarInstallationBuild package and wheel files withpoetry.# installationpoetryinstall

poetryrunlunar-hHow to useCredentialslunaruses a credentials file to setup a config(env,apikey) with ainitfile type.The path for credentials file and format must be as follow:[Path].lunar/credentials[default]env=localapikey=ABCDEFG123[dev]env=devapikey=AERSDF123[stg]env=stgapikey=HIJKLMNO456[prd]env=prdapikey=PQRSTUV789The first [default] is used when SDK / CLI is run without a specified profile.To specify a profile, useAWS_PROFILEto overrides the default profile for commands that run in that session.exportAWS_PROFILE=stgSDKlunarpackage provides functions for using all lunar microservices.
For the detailed information related to each function, please refer toDocs.Here is an example for CRUDing channels:importlunar# Environment for Lunar-rec is automatically set with credential fileclient=lunar.client("channel")# Get list of channelschannels=client.get_channels()# Get a channelchannel=client.get_channel(id="test_channel")# Create a channelchannel=client.create_channel(id="new_channel",experiment_id="new_experiment")# Update(or partial) a channelupdated_channel=client.update_channel(id="test_channel",experiment_id="a")partially_updated_channel=client.update_channel_partial(id="test_channel",experiment_id="ab")# Delete a channelclient.delete_channel(channel.id)All functions on the SDK also supports asyncio. If necessary, use an async version of each function.Naming rule: Suffix with_async. (e.g.list_channels()→list_channels_async())CLIlunaralso provides CLI (Command Line Interface) generated byclickpackage.poetryrunlunar-hshould show something like the below:Usage:lunar[OPTIONS]COMMAND[ARGS]...

Options:-h,--helpShowthismessageandexit.

Commands:channelChannelsonlunar-recexperimentExperimentsonlunar-recrecommendRecommendationonlunar-recEach option also has its own usage instruction.poetryrunlunarexperiments-h

Usage:lunarexperiment[OPTIONS]{CREATE|LIST|READ|UPDATE|DELETE}Experimentsonlunar-recSendarequesttoLunarRecommendationAPI(`/v1/experiemnts/`).Return:dictorlist(dict)Options:-i,--idTEXTUniqueidentifierofachannel-b,--buckets<TEXTINTEGER>...Bucketlist-s,--bucketing-seedTEXTRandomseedforbucketing-p,--partialPartialupdateornot(default:False)-h,--helpShowthismessageandexit.DevelopmentRequirements for developmentPython 3.8PoetryInstalling Python 3.8 withpyenvis recommended. Checkthis.For zsh,# Install Xcode command line tools (Only if you don't have it already)xcode-select--install# Install pyenv and its dependenciesbrewupdate
brewinstallpyenvopensslreadlinesqlite3xzzlibecho'eval "$(pyenv init --path)"'>>~/.zshrceval'"$(pyenv init -)"'>>~/.zshrc# Restart the terminal# Install Python 3.8pyenvinstall3.8.10
pyenvglobal3.8.10# Restart the terminal# Check if the version is rightpython-V# Install Poetrycurl-sSLhttps://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py|python-
poetryconfigvirtualenvs.in-projecttrueshould work.Python environmentpoetryinstallIf you need additional deps,# For productionpoetryaddpackage_name# For development onlypoetryadd--devpackage_nameDocuments generationrm-rfdocs
pdoc--html--configshow_source_code=False-f-o./docslunar