cognite-pygen


Namecognite-pygen JSON
Version 1.2.21 PyPI version JSON
download
home_pageNone
SummaryCognite Python SDK Generator
upload_time2025-07-28 10:29:56
maintainerNone
docs_urlNone
authorNone
requires_python<4.0,>=3.10
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            Cognite Python SDK Generator
==========================

[![release](https://img.shields.io/github/actions/workflow/status/cognitedata/pygen/release.yaml?style=for-the-badge)](https://github.com/cognitedata/pygen/actions/workflows/release.yaml)
[![Documentation Status](https://readthedocs.com/projects/cognite-pygen/badge/?version=latest&style=for-the-badge)](https://cognite-pygen.readthedocs-hosted.com/en/latest/?badge=latest)
[![Github](https://shields.io/badge/github-cognite/pygen-green?logo=github&style=for-the-badge)](https://github.com/cognitedata/pygen)
[![PyPI](https://img.shields.io/pypi/v/cognite-pygen?style=for-the-badge)](https://pypi.org/project/cognite-pygen/)
[![Downloads](https://img.shields.io/pypi/dm/cognite-pygen?style=for-the-badge)](https://pypistats.org/packages/cognite-pygen)
[![GitHub](https://img.shields.io/github/license/cognitedata/pygen?style=for-the-badge)](https://github.com/cognitedata/pygen/blob/master/LICENSE)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge)](https://github.com/ambv/black)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json&style=for-the-badge)](https://github.com/astral-sh/ruff)
[![mypy](https://img.shields.io/badge/mypy-checked-000000.svg?style=for-the-badge&color=blue)](http://mypy-lang.org)

This is the Cognite Python SDK Generator, `pygen`. The purpose of this package is to help developers to
work with Cognite Data Fusion's (CDF) Data Models (DM) in Python.

The core functionality is to provide a Python client that matches a data model. This enables the developer for the following
benefits

* Client-side validation of the data before writing it to CDF.
* Autocompletion is matching the data model in the integrated developer environment (IDE). This is important as it enables:
  * Discoverability of a data model through Python.
  * Reduced typing errors in development.
* Keeping the language domain specific for the developer. Instead of working with generic concepts such as instances,
  nodes and edges, the developer can work with the concepts in the data model.

## Documentation

See the [documentation](https://cognite-pygen.readthedocs-hosted.com/en/latest/) for more information.

## Installation

### Without any optional dependencies

To install this package without CLI support:
```bash
pip install cognite-pygen
```

### With optional dependencies

* `cli` This includes CLI support such that you can run the package from the command line.

```bash
pip install cognite-pygen[cli]
```
If using zsh:
```bash
pip install 'cognite-pygen[cli]'
```

## Usage

The goal of the package is to have representations of all the types in a given data model with API calls to *.list()*,
*.apply()*, *.delete()*, and *.retrieve()* individuals for each type.

![image](https://github.com/cognitedata/pygen/assets/60234212/b9942595-424c-4c5e-8a9c-37a43e0a5a7c)

![image](https://github.com/cognitedata/pygen/assets/60234212/70a5f6b0-cec0-4178-93e1-4f9902658638)


## Creating a Python SDK from a Data Model

Given a Data Model with external id `Movie` in the space `movies` in CDF, the following command will generate a Python SDK
```bash
pygen generate --space movies \
    --external-id Movie \
    --version 1 \
    --tenant-id <tenant-id> \
    --client-id <client-id> \
    --client-secret <client-secret> \
    --cdf-cluster <cdf-cluster> \
    --cdf-project <cdf-project>
```

If you are not using Microsoft Entra ID (Azure AD) you need to specify the parameter --token-url, --scopes and --audience instead of --tenant-id.

## Dependencies

### Dependencies for the generated SDK

* [cognite-sdk](https://cognite-sdk-python.readthedocs-hosted.com/en/latest/) This is the basis for all requests to the Cognite Data Fusion API.
* [pydantic](https://docs.pydantic.dev/latest/) This is used for all data classes in the generated SDK.
* [pandas](https://pandas.pydata.org/docs/) This is used for `.to_pandas()` methods in the generated SDK.

### Dependencies for the `pygen`

* [jinja2](https://jinja.palletsprojects.com/en/3.1.x/) This is used for the templating of the generated SDK.
* [inflect](https://pypi.org/project/inflect/) This is used for the singularization/pluralization of words in the generated SDK.
* [typer](https://typer.tiangolo.com/) (Optional) This is used for the CLI of the `pygen` package.
* [black](https://pypi.org/project/black/) (Optional) This is used to format the code generated by the `pygen` package.


## Changelog
Wondering about previous changes to the SDK? Take a look at the [CHANGELOG](https://github.com/cognitedata/pygen/blob/master/docs/CHANGELOG.md).

## Contributing
Want to contribute? Check out [CONTRIBUTING](https://github.com/cognitedata/pygen/blob/master/CONTRIBUTING.md).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "cognite-pygen",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Cognite <support@cognite.com>",
    "download_url": "https://files.pythonhosted.org/packages/fb/6c/2e4a949e637786c2c36d59e8c07726498e7964655bc1877f3f648e016206/cognite_pygen-1.2.21.tar.gz",
    "platform": null,
    "description": "Cognite Python SDK Generator\n==========================\n\n[![release](https://img.shields.io/github/actions/workflow/status/cognitedata/pygen/release.yaml?style=for-the-badge)](https://github.com/cognitedata/pygen/actions/workflows/release.yaml)\n[![Documentation Status](https://readthedocs.com/projects/cognite-pygen/badge/?version=latest&style=for-the-badge)](https://cognite-pygen.readthedocs-hosted.com/en/latest/?badge=latest)\n[![Github](https://shields.io/badge/github-cognite/pygen-green?logo=github&style=for-the-badge)](https://github.com/cognitedata/pygen)\n[![PyPI](https://img.shields.io/pypi/v/cognite-pygen?style=for-the-badge)](https://pypi.org/project/cognite-pygen/)\n[![Downloads](https://img.shields.io/pypi/dm/cognite-pygen?style=for-the-badge)](https://pypistats.org/packages/cognite-pygen)\n[![GitHub](https://img.shields.io/github/license/cognitedata/pygen?style=for-the-badge)](https://github.com/cognitedata/pygen/blob/master/LICENSE)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge)](https://github.com/ambv/black)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json&style=for-the-badge)](https://github.com/astral-sh/ruff)\n[![mypy](https://img.shields.io/badge/mypy-checked-000000.svg?style=for-the-badge&color=blue)](http://mypy-lang.org)\n\nThis is the Cognite Python SDK Generator, `pygen`. The purpose of this package is to help developers to\nwork with Cognite Data Fusion's (CDF) Data Models (DM) in Python.\n\nThe core functionality is to provide a Python client that matches a data model. This enables the developer for the following\nbenefits\n\n* Client-side validation of the data before writing it to CDF.\n* Autocompletion is matching the data model in the integrated developer environment (IDE). This is important as it enables:\n  * Discoverability of a data model through Python.\n  * Reduced typing errors in development.\n* Keeping the language domain specific for the developer. Instead of working with generic concepts such as instances,\n  nodes and edges, the developer can work with the concepts in the data model.\n\n## Documentation\n\nSee the [documentation](https://cognite-pygen.readthedocs-hosted.com/en/latest/) for more information.\n\n## Installation\n\n### Without any optional dependencies\n\nTo install this package without CLI support:\n```bash\npip install cognite-pygen\n```\n\n### With optional dependencies\n\n* `cli` This includes CLI support such that you can run the package from the command line.\n\n```bash\npip install cognite-pygen[cli]\n```\nIf using zsh:\n```bash\npip install 'cognite-pygen[cli]'\n```\n\n## Usage\n\nThe goal of the package is to have representations of all the types in a given data model with API calls to *.list()*,\n*.apply()*, *.delete()*, and *.retrieve()* individuals for each type.\n\n![image](https://github.com/cognitedata/pygen/assets/60234212/b9942595-424c-4c5e-8a9c-37a43e0a5a7c)\n\n![image](https://github.com/cognitedata/pygen/assets/60234212/70a5f6b0-cec0-4178-93e1-4f9902658638)\n\n\n## Creating a Python SDK from a Data Model\n\nGiven a Data Model with external id `Movie` in the space `movies` in CDF, the following command will generate a Python SDK\n```bash\npygen generate --space movies \\\n    --external-id Movie \\\n    --version 1 \\\n    --tenant-id <tenant-id> \\\n    --client-id <client-id> \\\n    --client-secret <client-secret> \\\n    --cdf-cluster <cdf-cluster> \\\n    --cdf-project <cdf-project>\n```\n\nIf you are not using Microsoft Entra ID (Azure AD) you need to specify the parameter --token-url, --scopes and --audience instead of --tenant-id.\n\n## Dependencies\n\n### Dependencies for the generated SDK\n\n* [cognite-sdk](https://cognite-sdk-python.readthedocs-hosted.com/en/latest/) This is the basis for all requests to the Cognite Data Fusion API.\n* [pydantic](https://docs.pydantic.dev/latest/) This is used for all data classes in the generated SDK.\n* [pandas](https://pandas.pydata.org/docs/) This is used for `.to_pandas()` methods in the generated SDK.\n\n### Dependencies for the `pygen`\n\n* [jinja2](https://jinja.palletsprojects.com/en/3.1.x/) This is used for the templating of the generated SDK.\n* [inflect](https://pypi.org/project/inflect/) This is used for the singularization/pluralization of words in the generated SDK.\n* [typer](https://typer.tiangolo.com/) (Optional) This is used for the CLI of the `pygen` package.\n* [black](https://pypi.org/project/black/) (Optional) This is used to format the code generated by the `pygen` package.\n\n\n## Changelog\nWondering about previous changes to the SDK? Take a look at the [CHANGELOG](https://github.com/cognitedata/pygen/blob/master/docs/CHANGELOG.md).\n\n## Contributing\nWant to contribute? Check out [CONTRIBUTING](https://github.com/cognitedata/pygen/blob/master/CONTRIBUTING.md).\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Cognite Python SDK Generator",
    "version": "1.2.21",
    "project_urls": {
        "Changelog": "https://github.com/cognitedata/pygen/releases",
        "Documentation": "https://cognite-pygen.readthedocs-hosted.com/en/latest/",
        "Homepage": "https://cognite-pygen.readthedocs-hosted.com/en/latest/",
        "Repository": "https://github.com/cognitedata/pygen"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "79302551286c781211cae8b184405263acbc9e18e40d7c01dfe0deb0ec25fae6",
                "md5": "503baba3dbfff491ba0e0345f1129102",
                "sha256": "0f904c92b8278553fa5c890d074d59036a33f24b7f16bc0c3d576fdc01356de4"
            },
            "downloads": -1,
            "filename": "cognite_pygen-1.2.21-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "503baba3dbfff491ba0e0345f1129102",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 167116,
            "upload_time": "2025-07-28T10:29:54",
            "upload_time_iso_8601": "2025-07-28T10:29:54.948800Z",
            "url": "https://files.pythonhosted.org/packages/79/30/2551286c781211cae8b184405263acbc9e18e40d7c01dfe0deb0ec25fae6/cognite_pygen-1.2.21-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "fb6c2e4a949e637786c2c36d59e8c07726498e7964655bc1877f3f648e016206",
                "md5": "fb84492942d687962859c3d2c633315a",
                "sha256": "08af5ed158cea7ce28b91aef2ee953933b7ddd62d110f7107913a487f28b8637"
            },
            "downloads": -1,
            "filename": "cognite_pygen-1.2.21.tar.gz",
            "has_sig": false,
            "md5_digest": "fb84492942d687962859c3d2c633315a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 11644152,
            "upload_time": "2025-07-28T10:29:56",
            "upload_time_iso_8601": "2025-07-28T10:29:56.549206Z",
            "url": "https://files.pythonhosted.org/packages/fb/6c/2e4a949e637786c2c36d59e8c07726498e7964655bc1877f3f648e016206/cognite_pygen-1.2.21.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-28 10:29:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cognitedata",
    "github_project": "pygen",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "cognite-pygen"
}
        
Elapsed time: 1.51409s