frogml


Namefrogml JSON
Version 0.9.0 PyPI version JSON
download
home_pageNone
SummaryFrogML is a powerful and flexible Python library designed to provide advanced ML model and dataset management capabilities by seamlessly integrating JFrog Artifactory as the primary model store and leveraging the JFrog ML Platform.
upload_time2024-11-28 08:33:33
maintainerNone
docs_urlNone
authorJFrog
requires_python<3.13,>=3.9
licenseApache-2.0
keywords mlops
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Frog ML SDK (FrogML)

## Table of Contents

- [Overview](#overview)
- [Working with FrogML](#working-with-frogml)
   - [Login via Environment Variables](#login-via-environment-variables)
- [Upload ML Model to Artifactory](#upload-ml-model-to-artifactory)
- [Download ML Model from Artifactory](#download-ml-model-from-artifactory)
- [Download Model Information from Artifactory](#download-model-information-from-artifactory)
- [Testing](#testing)
  - [Locally Run Integration Tests Using Artifactory](#locally-run-integration-tests-using-artifactory)
- [Linters](#linters)
  - [Fix Spaces and Line Breaks With](#fix-spaces-and-line-breaks-with)
  - [Fix Formatting With](#fix-formatting-with)

## Overview

FrogML is a powerful and flexible Python library designed to provide advanced ML model and dataset management capabilities by seamlessly integrating JFrog Artifactory as the primary model store and leveraging the JFrog ML Platform.

## Working with FrogML

To use FrogML with Artifactory, authenticate the FrogML client against Artifactory. Currently, FrogML supports login via environment variables only.

The credentials retrieval order is as follows:
1. [Login via Environment Variables](#login-via-environment-variables)

### Login via Environment Variables

You can authenticate the FrogML client using the following environment variables:

- `JF_URL` - Your JFrog platform domain, e.g., `http://myorg.jfrog.io`
- `JF_ACCESS_TOKEN` - Your Artifactory token for this domain. To generate a token, log in to Artifactory, navigate to your FrogML repository, and click "Set Me Up."

After setting these environment variables, you can log in and use FrogML.

## Upload ML Model to Artifactory

You can upload a model to a FrogML repository using FrogML.
Currently, FrogML supports file-type models only. You can upload a model with a specified version, namespace, properties, dependencies, and code archive.
This function uses checksum upload, assigning a SHA-2 value to each model for retrieval from storage. If the binary content cannot be reused, the smart upload mechanism performs a regular upload instead.
After uploading the model, FrogML generates a file named `model-info.json` that contains the model name and its related files and dependencies.

The `version` parameter is optional. If not specified, Artifactory will set the version as the timestamp at upload time in UTC format: `yyyy-MM-dd-HH-mm-ss`.
Additionally, you can add properties to the model in Artifactory to categorize and label it.
The function `upload_model_version` returns an instance of `FrogMlModelVersion`, which includes the model's name, version, and namespace.

The following example shows how to upload a model to Artifactory:

> **Note**  
> The parameters `version`, `properties`, `dependencies`, and `code_dir` are optional.

Upload a model with a specified version, properties, dependencies, and code directory:

```python
import frogml

repository = "repository-name"
name = "model-name"
namespace = "namespace"
version = "version-1"
properties = {"key1": "value1"}
dependencies = ["pandas==1.2.3"]
code_dir = "full/path/to/code/dir"
full_source_path = "/full/path/to/serialized/model.type"
frogml.files.log_model(
  source_path=full_source_path,
  repository=repository,
  model_name=name,
  namespace=namespace,
  version=version,
  properties=properties,
  dependencies=dependencies,
  code_dir=code_dir,
)
```

**Dependencies**

FrogML SDK supports four types of dependencies:
1. `requirements.txt`
2. `poetry`
3. `conda`
4. Explicit versions

To use `requirements.txt`, `conda`, or `poetry`, the `dependencies` parameter should be a list of strings, each representing the path to the file.
For explicit versions, each string should represent a package. For example:

```python
dependencies = ["pandas==1.2.3", "numpy==1.2.3"]
```

## Download ML Model from Artifactory

The example below shows how to download a model from Artifactory using the FrogML SDK:

```python
import frogml

repository = "repository-name"
name = "model-name"
namespace = "namespace"
version = "version-1"
full_target_path = "full/path/to/target/path"

frogml.files.load_model(
    repository=repository,
    namespace=namespace,
    model_name=name,
    version=version,
    target_path=full_target_path,
)
```

> **Note**  
> Dependencies and code archives cannot be downloaded.

## Download Model Information from Artifactory

The example below shows how to download model information from Artifactory using the FrogML SDK:

```python
import frogml

repository = "repository-name"
name = "model-name"
namespace = "namespace"
version = "version-1"

frogml.files.get_model_info(repository=repository, model_name=name, namespace=namespace, version=version)
```

## Testing

### Locally Run Unit Tests

To run integration tests locally with Artifactory, use the command:

```bash
make test
```

#### Run Integration Tests Using remote Artifactory

```bash
make integration-test base-url=<remote-artifactory-base-url>
```

### Locally Run Integration Tests

To run integration tests locally with Artifactory, use the command:

currently local image is not available out of the box. so inorder to use it:
1. need to have access to the repo21
2. once the image is up and running need to inject license
3. login to the artifactory and check the box: "ENABLE TOKEN GENERATION VIA API"

```bash
make integration-test --
```

## Linters

### Fix Spaces and Line Breaks With
```
make lint
```

### Fix Formatting With
```
make format
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "frogml",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.13,>=3.9",
    "maintainer_email": null,
    "keywords": "mlops",
    "author": "JFrog",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/82/61/1e641ae3c16abd82713f37307634c0b3f3f01bf34c9c11faf7772479c0db/frogml-0.9.0.tar.gz",
    "platform": null,
    "description": "\n# Frog ML SDK (FrogML)\n\n## Table of Contents\n\n- [Overview](#overview)\n- [Working with FrogML](#working-with-frogml)\n   - [Login via Environment Variables](#login-via-environment-variables)\n- [Upload ML Model to Artifactory](#upload-ml-model-to-artifactory)\n- [Download ML Model from Artifactory](#download-ml-model-from-artifactory)\n- [Download Model Information from Artifactory](#download-model-information-from-artifactory)\n- [Testing](#testing)\n  - [Locally Run Integration Tests Using Artifactory](#locally-run-integration-tests-using-artifactory)\n- [Linters](#linters)\n  - [Fix Spaces and Line Breaks With](#fix-spaces-and-line-breaks-with)\n  - [Fix Formatting With](#fix-formatting-with)\n\n## Overview\n\nFrogML is a powerful and flexible Python library designed to provide advanced ML model and dataset management capabilities by seamlessly integrating JFrog Artifactory as the primary model store and leveraging the JFrog ML Platform.\n\n## Working with FrogML\n\nTo use FrogML with Artifactory, authenticate the FrogML client against Artifactory. Currently, FrogML supports login via environment variables only.\n\nThe credentials retrieval order is as follows:\n1. [Login via Environment Variables](#login-via-environment-variables)\n\n### Login via Environment Variables\n\nYou can authenticate the FrogML client using the following environment variables:\n\n- `JF_URL` - Your JFrog platform domain, e.g., `http://myorg.jfrog.io`\n- `JF_ACCESS_TOKEN` - Your Artifactory token for this domain. To generate a token, log in to Artifactory, navigate to your FrogML repository, and click \"Set Me Up.\"\n\nAfter setting these environment variables, you can log in and use FrogML.\n\n## Upload ML Model to Artifactory\n\nYou can upload a model to a FrogML repository using FrogML.\nCurrently, FrogML supports file-type models only. You can upload a model with a specified version, namespace, properties, dependencies, and code archive.\nThis function uses checksum upload, assigning a SHA-2 value to each model for retrieval from storage. If the binary content cannot be reused, the smart upload mechanism performs a regular upload instead.\nAfter uploading the model, FrogML generates a file named `model-info.json` that contains the model name and its related files and dependencies.\n\nThe `version` parameter is optional. If not specified, Artifactory will set the version as the timestamp at upload time in UTC format: `yyyy-MM-dd-HH-mm-ss`.\nAdditionally, you can add properties to the model in Artifactory to categorize and label it.\nThe function `upload_model_version` returns an instance of `FrogMlModelVersion`, which includes the model's name, version, and namespace.\n\nThe following example shows how to upload a model to Artifactory:\n\n> **Note**  \n> The parameters `version`, `properties`, `dependencies`, and `code_dir` are optional.\n\nUpload a model with a specified version, properties, dependencies, and code directory:\n\n```python\nimport frogml\n\nrepository = \"repository-name\"\nname = \"model-name\"\nnamespace = \"namespace\"\nversion = \"version-1\"\nproperties = {\"key1\": \"value1\"}\ndependencies = [\"pandas==1.2.3\"]\ncode_dir = \"full/path/to/code/dir\"\nfull_source_path = \"/full/path/to/serialized/model.type\"\nfrogml.files.log_model(\n  source_path=full_source_path,\n  repository=repository,\n  model_name=name,\n  namespace=namespace,\n  version=version,\n  properties=properties,\n  dependencies=dependencies,\n  code_dir=code_dir,\n)\n```\n\n**Dependencies**\n\nFrogML SDK supports four types of dependencies:\n1. `requirements.txt`\n2. `poetry`\n3. `conda`\n4. Explicit versions\n\nTo use `requirements.txt`, `conda`, or `poetry`, the `dependencies` parameter should be a list of strings, each representing the path to the file.\nFor explicit versions, each string should represent a package. For example:\n\n```python\ndependencies = [\"pandas==1.2.3\", \"numpy==1.2.3\"]\n```\n\n## Download ML Model from Artifactory\n\nThe example below shows how to download a model from Artifactory using the FrogML SDK:\n\n```python\nimport frogml\n\nrepository = \"repository-name\"\nname = \"model-name\"\nnamespace = \"namespace\"\nversion = \"version-1\"\nfull_target_path = \"full/path/to/target/path\"\n\nfrogml.files.load_model(\n    repository=repository,\n    namespace=namespace,\n    model_name=name,\n    version=version,\n    target_path=full_target_path,\n)\n```\n\n> **Note**  \n> Dependencies and code archives cannot be downloaded.\n\n## Download Model Information from Artifactory\n\nThe example below shows how to download model information from Artifactory using the FrogML SDK:\n\n```python\nimport frogml\n\nrepository = \"repository-name\"\nname = \"model-name\"\nnamespace = \"namespace\"\nversion = \"version-1\"\n\nfrogml.files.get_model_info(repository=repository, model_name=name, namespace=namespace, version=version)\n```\n\n## Testing\n\n### Locally Run Unit Tests\n\nTo run integration tests locally with Artifactory, use the command:\n\n```bash\nmake test\n```\n\n#### Run Integration Tests Using remote Artifactory\n\n```bash\nmake integration-test base-url=<remote-artifactory-base-url>\n```\n\n### Locally Run Integration Tests\n\nTo run integration tests locally with Artifactory, use the command:\n\ncurrently local image is not available out of the box. so inorder to use it:\n1. need to have access to the repo21\n2. once the image is up and running need to inject license\n3. login to the artifactory and check the box: \"ENABLE TOKEN GENERATION VIA API\"\n\n```bash\nmake integration-test --\n```\n\n## Linters\n\n### Fix Spaces and Line Breaks With\n```\nmake lint\n```\n\n### Fix Formatting With\n```\nmake format\n```\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "FrogML is a powerful and flexible Python library designed to provide advanced ML model and dataset management capabilities by seamlessly integrating JFrog Artifactory as the primary model store and leveraging the JFrog ML Platform.",
    "version": "0.9.0",
    "project_urls": null,
    "split_keywords": [
        "mlops"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6af1ff91becddb3ecb25bc2bfe1aa2d1161161151e6cfca890c9c0d113b775c3",
                "md5": "384dafb838a57453b0d1b0d21cf503c0",
                "sha256": "28e2afde8fcc73d5db50a1c43d1f25559c29a83fb6c349d34adb72f1d54b1fcb"
            },
            "downloads": -1,
            "filename": "frogml-0.9.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "384dafb838a57453b0d1b0d21cf503c0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.13,>=3.9",
            "size": 23676,
            "upload_time": "2024-11-28T08:33:32",
            "upload_time_iso_8601": "2024-11-28T08:33:32.288297Z",
            "url": "https://files.pythonhosted.org/packages/6a/f1/ff91becddb3ecb25bc2bfe1aa2d1161161151e6cfca890c9c0d113b775c3/frogml-0.9.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "82611e641ae3c16abd82713f37307634c0b3f3f01bf34c9c11faf7772479c0db",
                "md5": "6ed14c6490a5fceb9f51163c22823c3e",
                "sha256": "1e892b9040030b32d81f23292a5712360f4df716e640a30226d7b0e93a3d1be8"
            },
            "downloads": -1,
            "filename": "frogml-0.9.0.tar.gz",
            "has_sig": false,
            "md5_digest": "6ed14c6490a5fceb9f51163c22823c3e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.13,>=3.9",
            "size": 29645,
            "upload_time": "2024-11-28T08:33:33",
            "upload_time_iso_8601": "2024-11-28T08:33:33.512771Z",
            "url": "https://files.pythonhosted.org/packages/82/61/1e641ae3c16abd82713f37307634c0b3f3f01bf34c9c11faf7772479c0db/frogml-0.9.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-28 08:33:33",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "frogml"
}
        
Elapsed time: 0.34526s