shaped


Nameshaped JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://github.com/shaped-ai/shaped-cli
SummaryCLI and SDK tools for interacting with the Shaped API.
upload_time2025-01-06 18:25:34
maintainerNone
docs_urlNone
authorShaped Team
requires_python<3.12,>=3.8
licenseNone
keywords shaped-ai
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python SDK

## Installation

### Local Development

```sh
pip install -e .
```

### Pip Installation

```sh
pip install shaped
```

## Rank

```python
import shaped

api_key = 'your_api_key' 
client = shaped.Client(api_key=api_key)

api_response = client.rank(
    model_name="amazon_beauty_product_recommendations",
    user_id="A2FRWMTWYJUK7P",
    return_metadata=True,
    item_ids=['B01AHSUT8M', 'B00GW7H5EY', 'B01GLA54SA', 'B0016PKWK6', 'B00PJD7KPG', 'B00BCI8OP2', 'B004FK7R02'],
)
print(api_response)
```

## Retrieve
```python
import shaped

api_key = 'your_api_key' 
client = shaped.Client(api_key=api_key)

api_response = client.retrieve(
    model_name="amazon_beauty_product_recommendations",
)
print(api_response)
```

## Similar Items
```python
import shaped

api_key = 'your_api_key' 
client = shaped.Client(api_key=api_key)

api_response = client.similar_items(
    model_name="amazon_beauty_product_recommendations", 
    item_id="B000FOI48G",
)
print(api_response)
```

## Similar Users
```python
import shaped

api_key = 'your_api_key' 
client = shaped.Client(api_key=api_key)

api_response = client.similar_users(
    model_name="amazon_beauty_product_recommendations", 
    user_id="A2FRWMTWYJUK7P",
)
print(api_response)
```

## Complement Items
```python
import shaped

api_key = 'your_api_key' 
client = shaped.Client(api_key=api_key)

api_response = client.complement_items(
    model_name="amazon_beauty_product_recommendations", 
    item_ids=['B000URXP6E', 'B0012Y0ZG2'],
)
print(api_response)
```

## Maintainer Notes

To recreate the autogenerated code:

1. `brew install openapi-generator`
2. Copy across `openapi.yaml` from the `shaped-docs` repository to `~` 
1. Change `-g python` to the language you want to generate
1. Change `-o python/` to the directory you want to output to
3. Navigate to `~` and run the command:

### Python
```bash
openapi-generator generate -g python -i openapi.yaml -o python/ -p packageName=shaped.autogen --global-property models,apis,apiDocs=false,modelDocs=false,modelTests=false,apiTests=false,supportingFiles=api_client.py:api_response.py:configuration.py:exceptions.py:rest.py:__init__.py
```

### Node.js
```bash
openapi-generator generate -i openapi.yaml -g javascript -o nodejs/src -c config.yaml --global-property models,apis,apiDocs=false,modelDocs=false,modelTests=false,apiTests=false,supportingFiles=ApiClient.js
```

## Testing
`pytest python/tests/test_rank.py --api-key 'api_key'`
`npm test`
---

# Shaped CLI

CLI for interactions with the Shaped API.

## Installing the Shaped CLI

```
pip install shaped
```

## Initialize

```
shaped init --api-key <API_KEY>
```

## Model API

### Create Model (File)

```
shaped create-model --file <PATH_TO_FILE>
```

### Create Model (STDIN)

```
cat $(PATH_TO_FILE) | shaped create-model
```

### List Models

```
shaped list-models
```

### View Model

```
shaped view-model --model-name <MODEL_NAME>
```

## Delete Model

```
shaped delete-model --model-name <MODEL_NAME>
```

## Dataset API

### Create Dataset

```
shaped create-dataset --file <PATH_TO_FILE>
```

### List Datasets

```
shaped list-datasets
```

### Dataset Insert

```
shaped dataset-insert --dataset-name <DATASET_NAME> --file <DATAFRAME_FILE> --type <FILE_TYPE> 
```

## Delete dataset

```
shaped delete-dataset --dataset-name <DATASET_NAME>
```

## Rank API

### Rank

```
shaped rank --model-name <MODEL_NAME> --user-id <USER_ID>
```

### Similar Items

```
shaped similar --model-name <MODEL_NAME> --item-id <ITEM_ID>
```

### Similar Users

```
shaped similar --model-name <MODEL_NAME> --user-id <USER_ID>
```

# Development

## Installing the Shaped CLI from Test PyPI

Upon all pushes to main branch, a new version of the CLI is published to Test PyPI. To install the latest version of the CLI from Test PyPI, run the following commands:

```bash
conda create -n cli-dev python=3.9
conda activate cli-dev
export PACKAGE_VERSION={} # Specify the version you want to install
pip install --extra-index-url https://test.pypi.org/simple/ shaped-cli==$PACKAGE_VERSION
```

## Releasing a new CLI version to PyPI

To release a new version of the CLI to PyPI, open a PR changing the version of the package in `setup.py`, following [Semantic Versioning](https://semver.org) principles, e.g. `0.1.1`.

CircleCI will generate an approval prompt when this branch is merged to main, and upon approval will publish to PyPI.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/shaped-ai/shaped-cli",
    "name": "shaped",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.12,>=3.8",
    "maintainer_email": null,
    "keywords": "shaped-ai",
    "author": "Shaped Team",
    "author_email": "support@shaped.ai",
    "download_url": "https://files.pythonhosted.org/packages/14/a0/f12c11a305edeb10f4ae9962b001bc5172c199db1b42f2921cecf5d22fff/shaped-1.0.1.tar.gz",
    "platform": null,
    "description": "# Python SDK\n\n## Installation\n\n### Local Development\n\n```sh\npip install -e .\n```\n\n### Pip Installation\n\n```sh\npip install shaped\n```\n\n## Rank\n\n```python\nimport shaped\n\napi_key = 'your_api_key' \nclient = shaped.Client(api_key=api_key)\n\napi_response = client.rank(\n    model_name=\"amazon_beauty_product_recommendations\",\n    user_id=\"A2FRWMTWYJUK7P\",\n    return_metadata=True,\n    item_ids=['B01AHSUT8M', 'B00GW7H5EY', 'B01GLA54SA', 'B0016PKWK6', 'B00PJD7KPG', 'B00BCI8OP2', 'B004FK7R02'],\n)\nprint(api_response)\n```\n\n## Retrieve\n```python\nimport shaped\n\napi_key = 'your_api_key' \nclient = shaped.Client(api_key=api_key)\n\napi_response = client.retrieve(\n    model_name=\"amazon_beauty_product_recommendations\",\n)\nprint(api_response)\n```\n\n## Similar Items\n```python\nimport shaped\n\napi_key = 'your_api_key' \nclient = shaped.Client(api_key=api_key)\n\napi_response = client.similar_items(\n    model_name=\"amazon_beauty_product_recommendations\", \n    item_id=\"B000FOI48G\",\n)\nprint(api_response)\n```\n\n## Similar Users\n```python\nimport shaped\n\napi_key = 'your_api_key' \nclient = shaped.Client(api_key=api_key)\n\napi_response = client.similar_users(\n    model_name=\"amazon_beauty_product_recommendations\", \n    user_id=\"A2FRWMTWYJUK7P\",\n)\nprint(api_response)\n```\n\n## Complement Items\n```python\nimport shaped\n\napi_key = 'your_api_key' \nclient = shaped.Client(api_key=api_key)\n\napi_response = client.complement_items(\n    model_name=\"amazon_beauty_product_recommendations\", \n    item_ids=['B000URXP6E', 'B0012Y0ZG2'],\n)\nprint(api_response)\n```\n\n## Maintainer Notes\n\nTo recreate the autogenerated code:\n\n1. `brew install openapi-generator`\n2. Copy across `openapi.yaml` from the `shaped-docs` repository to `~` \n1. Change `-g python` to the language you want to generate\n1. Change `-o python/` to the directory you want to output to\n3. Navigate to `~` and run the command:\n\n### Python\n```bash\nopenapi-generator generate -g python -i openapi.yaml -o python/ -p packageName=shaped.autogen --global-property models,apis,apiDocs=false,modelDocs=false,modelTests=false,apiTests=false,supportingFiles=api_client.py:api_response.py:configuration.py:exceptions.py:rest.py:__init__.py\n```\n\n### Node.js\n```bash\nopenapi-generator generate -i openapi.yaml -g javascript -o nodejs/src -c config.yaml --global-property models,apis,apiDocs=false,modelDocs=false,modelTests=false,apiTests=false,supportingFiles=ApiClient.js\n```\n\n## Testing\n`pytest python/tests/test_rank.py --api-key 'api_key'`\n`npm test`\n---\n\n# Shaped CLI\n\nCLI for interactions with the Shaped API.\n\n## Installing the Shaped CLI\n\n```\npip install shaped\n```\n\n## Initialize\n\n```\nshaped init --api-key <API_KEY>\n```\n\n## Model API\n\n### Create Model (File)\n\n```\nshaped create-model --file <PATH_TO_FILE>\n```\n\n### Create Model (STDIN)\n\n```\ncat $(PATH_TO_FILE) | shaped create-model\n```\n\n### List Models\n\n```\nshaped list-models\n```\n\n### View Model\n\n```\nshaped view-model --model-name <MODEL_NAME>\n```\n\n## Delete Model\n\n```\nshaped delete-model --model-name <MODEL_NAME>\n```\n\n## Dataset API\n\n### Create Dataset\n\n```\nshaped create-dataset --file <PATH_TO_FILE>\n```\n\n### List Datasets\n\n```\nshaped list-datasets\n```\n\n### Dataset Insert\n\n```\nshaped dataset-insert --dataset-name <DATASET_NAME> --file <DATAFRAME_FILE> --type <FILE_TYPE> \n```\n\n## Delete dataset\n\n```\nshaped delete-dataset --dataset-name <DATASET_NAME>\n```\n\n## Rank API\n\n### Rank\n\n```\nshaped rank --model-name <MODEL_NAME> --user-id <USER_ID>\n```\n\n### Similar Items\n\n```\nshaped similar --model-name <MODEL_NAME> --item-id <ITEM_ID>\n```\n\n### Similar Users\n\n```\nshaped similar --model-name <MODEL_NAME> --user-id <USER_ID>\n```\n\n# Development\n\n## Installing the Shaped CLI from Test PyPI\n\nUpon all pushes to main branch, a new version of the CLI is published to Test PyPI. To install the latest version of the CLI from Test PyPI, run the following commands:\n\n```bash\nconda create -n cli-dev python=3.9\nconda activate cli-dev\nexport PACKAGE_VERSION={} # Specify the version you want to install\npip install --extra-index-url https://test.pypi.org/simple/ shaped-cli==$PACKAGE_VERSION\n```\n\n## Releasing a new CLI version to PyPI\n\nTo release a new version of the CLI to PyPI, open a PR changing the version of the package in `setup.py`, following [Semantic Versioning](https://semver.org) principles, e.g. `0.1.1`.\n\nCircleCI will generate an approval prompt when this branch is merged to main, and upon approval will publish to PyPI.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "CLI and SDK tools for interacting with the Shaped API.",
    "version": "1.0.1",
    "project_urls": {
        "Homepage": "https://github.com/shaped-ai/shaped-cli"
    },
    "split_keywords": [
        "shaped-ai"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "406e99717e32d06e54c28f2fa47762955471902ee209dea640524b18c430ec04",
                "md5": "48d4a9e04ec36b9bf6eaf827b87c5c93",
                "sha256": "98171e28d958efc1e28f1b7a1ab723dc72353c76de424f0209c3a7cd03509e7a"
            },
            "downloads": -1,
            "filename": "shaped-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "48d4a9e04ec36b9bf6eaf827b87c5c93",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.12,>=3.8",
            "size": 165776,
            "upload_time": "2025-01-06T18:25:33",
            "upload_time_iso_8601": "2025-01-06T18:25:33.341848Z",
            "url": "https://files.pythonhosted.org/packages/40/6e/99717e32d06e54c28f2fa47762955471902ee209dea640524b18c430ec04/shaped-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "14a0f12c11a305edeb10f4ae9962b001bc5172c199db1b42f2921cecf5d22fff",
                "md5": "f53b58750283d62bf048cc399640840f",
                "sha256": "3221c07f4944baef3fde27c40afc005d5145fd30e48d3c02e342a5202ff78eb5"
            },
            "downloads": -1,
            "filename": "shaped-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "f53b58750283d62bf048cc399640840f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.12,>=3.8",
            "size": 57941,
            "upload_time": "2025-01-06T18:25:34",
            "upload_time_iso_8601": "2025-01-06T18:25:34.886442Z",
            "url": "https://files.pythonhosted.org/packages/14/a0/f12c11a305edeb10f4ae9962b001bc5172c199db1b42f2921cecf5d22fff/shaped-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-06 18:25:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "shaped-ai",
    "github_project": "shaped-cli",
    "github_not_found": true,
    "lcname": "shaped"
}
        
Elapsed time: 0.46568s