%global _empty_manifest_terminate_build 0 Name: python-apollo-lunar Version: 2023.3.22 Release: 1 Summary: A Python SDK/CLI for Lunar API License: MIT URL: https://pypi.org/project/apollo-lunar/ Source0: https://mirrors.nju.edu.cn/pypi/web/packages/a8/3f/a2c683f07b69d534e8d4b92729a8c3819c294915b810971a8385600bdbf6/apollo-lunar-2023.3.22.tar.gz BuildArch: noarch Requires: python3-click Requires: python3-requests Requires: python3-pydantic Requires: python3-aiohttp Requires: python3-scikit-learn Requires: python3-catboost Requires: python3-lightgbm Requires: python3-xgboost Requires: python3-boto3 Requires: python3-cloudpickle %description # lunar-sdk ## Contents - [Description](#description) - [Installation](#installation) - [How to use](#how-to-use) - [credentials](#credentials) - [SDK](#sdk) - [CLI](#cli) - [Development](#development) - [Requirements for development](#requirements-for-development) - [Python environment](#python-environment) - [Documents generation](#documents-generation) SDK for lunar microservices ## Description A Python based SDK & CLI for Lunar microservices This python package includes - Functions for [lunar-rec](https://github.com/sktaiflow/lunar-rec) - CLI (Command Line Interface) named `lunar` ## Installation Build package and wheel files with `poetry`. ```bash # installation poetry install poetry run lunar -h ``` ## How to use ### Credentials `lunar` uses a credentials file to setup a config(`env`, `apikey`) with a `init` file type. The path for credentials file and format must be as follow: ```bash [Path] .lunar/credentials ``` ```bash [default] env=local apikey=ABCDEFG123 [dev] env=dev apikey=AERSDF123 [stg] env=stg apikey=HIJKLMNO456 [prd] env=prd apikey=PQRSTUV789 ``` The first [default] is used when SDK / CLI is run without a specified profile. To specify a profile, use `AWS_PROFILE` to overrides the default profile for commands that run in that session. ```bash export AWS_PROFILE=stg ``` ### SDK `lunar` package provides functions for using all lunar microservices. For the detailed information related to each function, please refer to [Docs](https://sktaiflow.github.io/lunar-sdk/lunar/). Here is an example for CRUDing channels: ```python import lunar # Environment for Lunar-rec is automatically set with credential file client = lunar.client("channel") # Get list of channels channels = client.get_channels() # Get a channel channel = client.get_channel(id="test_channel") # Create a channel channel = client.create_channel(id="new_channel", experiment_id="new_experiment") # Update(or partial) a channel updated_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 channel client.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()`) ### CLI `lunar` also provides CLI (Command Line Interface) generated by [click](https://click.palletsprojects.com/) package. ```zsh poetry run lunar -h ``` should show something like the below: ``` zsh Usage: lunar [OPTIONS] COMMAND [ARGS]... Options: -h, --help Show this message and exit. Commands: channel Channels on lunar-rec experiment Experiments on lunar-rec recommend Recommendation on lunar-rec ``` Each option also has its own usage instruction. ``` zsh poetry run lunar experiments -h Usage: lunar experiment [OPTIONS] {CREATE|LIST|READ|UPDATE|DELETE} Experiments on lunar-rec Send a request to Lunar Recommendation API (`/v1/experiemnts/`). Return: dict or list(dict) Options: -i, --id TEXT Unique identifier of a channel -b, --buckets ... Bucket list -s, --bucketing-seed TEXT Random seed for bucketing -p, --partial Partial update or not (default: False) -h, --help Show this message and exit. ``` ## Development ### Requirements for development - Python 3.8 - Poetry Installing Python 3.8 with [pyenv](https://github.com/pyenv/pyenv) is recommended. Check [this](https://github.com/pyenv/pyenv#installation). For zsh, ```zsh # Install Xcode command line tools (Only if you don't have it already) xcode-select --install # Install pyenv and its dependencies brew update brew install pyenv openssl readline sqlite3 xz zlib echo 'eval "$(pyenv init --path)"' >> ~/.zshrc eval '"$(pyenv init -)"' >> ~/.zshrc # Restart the terminal # Install Python 3.8 pyenv install 3.8.10 pyenv global 3.8.10 # Restart the terminal # Check if the version is right python -V # Install Poetry curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - poetry config virtualenvs.in-project true ``` should work. ### Python environment ```zsh poetry install ``` If you need additional deps, ```zsh # For production poetry add package_name # For development only poetry add --dev package_name ``` ### Documents generation ```bash rm -rf docs pdoc --html --config show_source_code=False -f -o ./docs lunar ``` %package -n python3-apollo-lunar Summary: A Python SDK/CLI for Lunar API Provides: python-apollo-lunar BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-apollo-lunar # lunar-sdk ## Contents - [Description](#description) - [Installation](#installation) - [How to use](#how-to-use) - [credentials](#credentials) - [SDK](#sdk) - [CLI](#cli) - [Development](#development) - [Requirements for development](#requirements-for-development) - [Python environment](#python-environment) - [Documents generation](#documents-generation) SDK for lunar microservices ## Description A Python based SDK & CLI for Lunar microservices This python package includes - Functions for [lunar-rec](https://github.com/sktaiflow/lunar-rec) - CLI (Command Line Interface) named `lunar` ## Installation Build package and wheel files with `poetry`. ```bash # installation poetry install poetry run lunar -h ``` ## How to use ### Credentials `lunar` uses a credentials file to setup a config(`env`, `apikey`) with a `init` file type. The path for credentials file and format must be as follow: ```bash [Path] .lunar/credentials ``` ```bash [default] env=local apikey=ABCDEFG123 [dev] env=dev apikey=AERSDF123 [stg] env=stg apikey=HIJKLMNO456 [prd] env=prd apikey=PQRSTUV789 ``` The first [default] is used when SDK / CLI is run without a specified profile. To specify a profile, use `AWS_PROFILE` to overrides the default profile for commands that run in that session. ```bash export AWS_PROFILE=stg ``` ### SDK `lunar` package provides functions for using all lunar microservices. For the detailed information related to each function, please refer to [Docs](https://sktaiflow.github.io/lunar-sdk/lunar/). Here is an example for CRUDing channels: ```python import lunar # Environment for Lunar-rec is automatically set with credential file client = lunar.client("channel") # Get list of channels channels = client.get_channels() # Get a channel channel = client.get_channel(id="test_channel") # Create a channel channel = client.create_channel(id="new_channel", experiment_id="new_experiment") # Update(or partial) a channel updated_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 channel client.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()`) ### CLI `lunar` also provides CLI (Command Line Interface) generated by [click](https://click.palletsprojects.com/) package. ```zsh poetry run lunar -h ``` should show something like the below: ``` zsh Usage: lunar [OPTIONS] COMMAND [ARGS]... Options: -h, --help Show this message and exit. Commands: channel Channels on lunar-rec experiment Experiments on lunar-rec recommend Recommendation on lunar-rec ``` Each option also has its own usage instruction. ``` zsh poetry run lunar experiments -h Usage: lunar experiment [OPTIONS] {CREATE|LIST|READ|UPDATE|DELETE} Experiments on lunar-rec Send a request to Lunar Recommendation API (`/v1/experiemnts/`). Return: dict or list(dict) Options: -i, --id TEXT Unique identifier of a channel -b, --buckets ... Bucket list -s, --bucketing-seed TEXT Random seed for bucketing -p, --partial Partial update or not (default: False) -h, --help Show this message and exit. ``` ## Development ### Requirements for development - Python 3.8 - Poetry Installing Python 3.8 with [pyenv](https://github.com/pyenv/pyenv) is recommended. Check [this](https://github.com/pyenv/pyenv#installation). For zsh, ```zsh # Install Xcode command line tools (Only if you don't have it already) xcode-select --install # Install pyenv and its dependencies brew update brew install pyenv openssl readline sqlite3 xz zlib echo 'eval "$(pyenv init --path)"' >> ~/.zshrc eval '"$(pyenv init -)"' >> ~/.zshrc # Restart the terminal # Install Python 3.8 pyenv install 3.8.10 pyenv global 3.8.10 # Restart the terminal # Check if the version is right python -V # Install Poetry curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - poetry config virtualenvs.in-project true ``` should work. ### Python environment ```zsh poetry install ``` If you need additional deps, ```zsh # For production poetry add package_name # For development only poetry add --dev package_name ``` ### Documents generation ```bash rm -rf docs pdoc --html --config show_source_code=False -f -o ./docs lunar ``` %package help Summary: Development documents and examples for apollo-lunar Provides: python3-apollo-lunar-doc %description help # lunar-sdk ## Contents - [Description](#description) - [Installation](#installation) - [How to use](#how-to-use) - [credentials](#credentials) - [SDK](#sdk) - [CLI](#cli) - [Development](#development) - [Requirements for development](#requirements-for-development) - [Python environment](#python-environment) - [Documents generation](#documents-generation) SDK for lunar microservices ## Description A Python based SDK & CLI for Lunar microservices This python package includes - Functions for [lunar-rec](https://github.com/sktaiflow/lunar-rec) - CLI (Command Line Interface) named `lunar` ## Installation Build package and wheel files with `poetry`. ```bash # installation poetry install poetry run lunar -h ``` ## How to use ### Credentials `lunar` uses a credentials file to setup a config(`env`, `apikey`) with a `init` file type. The path for credentials file and format must be as follow: ```bash [Path] .lunar/credentials ``` ```bash [default] env=local apikey=ABCDEFG123 [dev] env=dev apikey=AERSDF123 [stg] env=stg apikey=HIJKLMNO456 [prd] env=prd apikey=PQRSTUV789 ``` The first [default] is used when SDK / CLI is run without a specified profile. To specify a profile, use `AWS_PROFILE` to overrides the default profile for commands that run in that session. ```bash export AWS_PROFILE=stg ``` ### SDK `lunar` package provides functions for using all lunar microservices. For the detailed information related to each function, please refer to [Docs](https://sktaiflow.github.io/lunar-sdk/lunar/). Here is an example for CRUDing channels: ```python import lunar # Environment for Lunar-rec is automatically set with credential file client = lunar.client("channel") # Get list of channels channels = client.get_channels() # Get a channel channel = client.get_channel(id="test_channel") # Create a channel channel = client.create_channel(id="new_channel", experiment_id="new_experiment") # Update(or partial) a channel updated_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 channel client.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()`) ### CLI `lunar` also provides CLI (Command Line Interface) generated by [click](https://click.palletsprojects.com/) package. ```zsh poetry run lunar -h ``` should show something like the below: ``` zsh Usage: lunar [OPTIONS] COMMAND [ARGS]... Options: -h, --help Show this message and exit. Commands: channel Channels on lunar-rec experiment Experiments on lunar-rec recommend Recommendation on lunar-rec ``` Each option also has its own usage instruction. ``` zsh poetry run lunar experiments -h Usage: lunar experiment [OPTIONS] {CREATE|LIST|READ|UPDATE|DELETE} Experiments on lunar-rec Send a request to Lunar Recommendation API (`/v1/experiemnts/`). Return: dict or list(dict) Options: -i, --id TEXT Unique identifier of a channel -b, --buckets ... Bucket list -s, --bucketing-seed TEXT Random seed for bucketing -p, --partial Partial update or not (default: False) -h, --help Show this message and exit. ``` ## Development ### Requirements for development - Python 3.8 - Poetry Installing Python 3.8 with [pyenv](https://github.com/pyenv/pyenv) is recommended. Check [this](https://github.com/pyenv/pyenv#installation). For zsh, ```zsh # Install Xcode command line tools (Only if you don't have it already) xcode-select --install # Install pyenv and its dependencies brew update brew install pyenv openssl readline sqlite3 xz zlib echo 'eval "$(pyenv init --path)"' >> ~/.zshrc eval '"$(pyenv init -)"' >> ~/.zshrc # Restart the terminal # Install Python 3.8 pyenv install 3.8.10 pyenv global 3.8.10 # Restart the terminal # Check if the version is right python -V # Install Poetry curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - poetry config virtualenvs.in-project true ``` should work. ### Python environment ```zsh poetry install ``` If you need additional deps, ```zsh # For production poetry add package_name # For development only poetry add --dev package_name ``` ### Documents generation ```bash rm -rf docs pdoc --html --config show_source_code=False -f -o ./docs lunar ``` %prep %autosetup -n apollo-lunar-2023.3.22 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-apollo-lunar -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Fri May 05 2023 Python_Bot - 2023.3.22-1 - Package Spec generated