coolipy


Namecoolipy JSON
Version 0.0.7 PyPI version JSON
download
home_pageNone
SummaryCoolipy - (Un)official Coolify - coolify.io - Python client!
upload_time2025-01-13 22:53:58
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords coolify rest client api client
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Coolipy

**The first (un)official Python client for the [Coolify](https://coolify.io/).**
Coolipy simplifies programmatically interacting with Coolify by providing wrappers around [Coolify API](https://coolify.io/docs/api), enabling you to manage projects, deployments, servers, services, and more with python scripts.

- Lib docs: https://coolipydocs.gabrielbocchini.com.br/
- Coolify API docs: https://coolify.io/docs/api

## Installation

Install Coolipy using pip:

```bash
pip install coolipy
```

## Features
- Manage Coolify projects, servers, applications, deployments and more (everything the Coolify App offers);
- Infra as code;
- 1 dependency: requests>=2.32.3;
- Datamodels for all endpoints;
- Datamodels specific for creation with only the required fields;
- All responses come from Datamodels;

TO DO:

- Async support.


## Lib Assets

- `coolipy.models`: hold all data models used to hold retrieved data. Create methods use models names following the pattern: `<service>ModelCreate`;
- `coolipy.services`: methods used to interact with the Coolify API.
-


# Quick Start Guide/Examples

- Import and Initialize
```python
from coolipy import Coolipy

coolify_client = Coolipy(
    coolify_api_key="your_coolify_api_key",
    coolify_endpoint="your_coolify_instance_address",
)
```

## Example Usage

- Create a Project
```python
my_project = coolify_client.projects.create(project_name="MyProject", project_description="This is MyProject description")
```

The response will be a [CoolipyAPIResponse](https://github.com/gbbocchini/coolipy/blob/main/coolipy/models/coolify_api_response.py) containing the Coolify api response code and `data`, in this case, will be a [ProjectsModel](https://github.com/gbbocchini/coolipy/blob/main/coolipy/models/projects.py).

```bash
>print(my_project)

CoolifyAPIResponse(
    status_code=201,
    data=ProjectsModel(
        name=MyProject,
        description=This is MyProject description,
        id=None,
        uuid='b84skk8c4owskskogko40s44',
        default_environment=None,
        environments=[],
        team_id=None,
        created_at=None,
        updated_at=None
    )
)
```

- List Servers
```python
servers = coolify_client.servers.list()

>print(servers)

CoolifyAPIResponse(
    status_code=200,
    data=[
        ServerModel(
            id=None,
            description="This is the server where Coolify is running on. Don't delete this!",
            name='localhost', ip='host.docker.internal',
            port=22,
            user='root',
            private_key_id=None,
            uuid='gwogk4ssckgw8gwokcswww4o',
            team_id=None,
            sentinel_updated_at=None,
            reated_at=None,
            updated_at=None,
            deleted_at=None,
            high_disk_usage_notification_sent=False,
            log_drain_notification_sent=False,
            swarm_cluster=False,
            validation_logs=None,
            unreachable_count=None,
            unreachable_notification_sent=False,
            proxy=ServerProxyModel(
                type='traefik',
                status=None,
                last_saved_settings=None,
                last_applied_settings=None,
                force_stop=None,
                redirect_enabled=True
            ),
            settings=ServerSettingsModel(
                id=1,
                concurrent_builds=2,
                delete_unused_networks=False,
                delete_unused_volumes=False,
                docker_cleanup_frequency='0 0 * * *',
                docker_cleanup_threshold=80,
                dynamic_timeout=3600,
                force_disabled=False,
                force_docker_cleanup=True,
                generate_exact_labels=False,
                is_build_server=False,
                is_cloudflare_tunnel=False,
                is_jump_server=False,
                is_logdrain_axiom_enabled=False,
                is_logdrain_custom_enabled=False,
                is_logdrain_highlight_enabled=False,
                is_logdrain_newrelic_enabled=False,
                is_metrics_enabled=False,
                is_reachable=True,
                is_sentinel_debug_enabled=False,
                is_sentinel_enabled=False,
                is_swarm_manager=False,
                is_swarm_worker=False,
                is_usable=True,
                sentinel_custom_url='http://host.docker.internal:8000',
                sentinel_metrics_history_days=7,
                sentinel_metrics_refresh_rate_seconds=10,
                sentinel_push_interval_seconds=60,
                sentinel_token='==',
                server_disk_usage_notification_threshold=80,
                server_id=0, server_timezone='UTC',
                 created_at=datetime.datetime(2025, 1, 13, 19, 6, 12, tzinfo=datetime.timezone.utc),
                 updated_at=datetime.datetime(2025, 1, 13, 19, 7, 19, tzinfo=datetime.timezone.utc),
                 logdrain_axiom_api_key=None,
                 logdrain_axiom_dataset_name=None,
                 logdrain_custom_config=None,
                 logdrain_custom_config_parser=None,
                 logdrain_highlight_project_id=None,
                 logdrain_newrelic_base_uri=None,
                 logdrain_newrelic_license_key=None,
                 wildcard_domain=None
            ),
            is_reachable=True,
            is_usable=True
        )
    ]
)
```

- Create a Service
```python
from coolipy.models.service import ServiceModelCreate
from coolipy.constants import COOLIFY_SERVICE_TYPES

service_data = ServiceModelCreate(
    type=COOLIFY_SERVICE_TYPES.glance,
    name="Example Service",
    project_uuid="your_project_uuid",
    server_uuid="your_server_uuid",
    destination_uuid="your_destination_uuid",
    instant_deploy=True,
    environment_name="production"
)
new_service = coolify_client.services.create(service_data)
```

- Create a DB:
```python
from coolipy.models.databases import PostgreSQLModelCreate

postgres_db = PostgreSQLModelCreate(
    project_uuid="your_project_uuid",
    server_uuid="your_server_uuid",
    environment_name="production",
    is_public=False,
    limits_cpu_shares=0,
    limits_cpus=0,
    limits_cpuset=0,
    limits_memory=0,
    limits_memory_reservation=0,
    limits_memory_swap=0,
    limits_memory_swappiness=0,
    instant_deploy=True,
    postgres_user="dbuser",
    postgres_password="password",
    postgres_db="mydatabase",
    name="My PostgreSQL DB",
    postgres_conf="LQ==",  # Example config
    postgres_host_auth_method="-",
    postgres_initdb_args="-"
)

my_database = coolify_client.databases.create(database_model_create=postgres_db)
```

- Create an App
```python
from coolipy.models.applications import ApplicationPrivateGHModelCreate

app_data = ApplicationPrivateGHModelCreate(
    project_uuid="your_project_uuid",
    server_uuid="your_server_uuid",
    environment_name="production",
    ports_exposes="8080",
    github_app_uuid="your_github_app_uuid",
    git_repository="your_github_repo",
    git_branch="main",
    build_pack=COOLIFY_BUILD_PACKS.dockerfile,
    instant_deploy=True,
    name="MyApp"
)

new_app = coolify_client.applications.create(app_data)
```

# Contributing

- Before opening a pull request or issue, take some time to understand if the issue should be treated at
this client level OR the Coolify REST API;
- Create a fork of this repo and then submit a pull request;
- Respect Python PEPs and type inference;
- Test your code or changes introduced and deliver unit tests on the PR;
- No breaking changes unless if necessary due Coolipy REST API change (please provide Coolipy PR/commits of the change).


# License

This project is licensed under the Apache License 2.0. See the [LICENSE](./LICENSE) file for details.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "coolipy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "Gabriel Bocchini <gabrielbocchini@gmail.com>",
    "keywords": "coolify, rest client, api client",
    "author": null,
    "author_email": "Gabriel Bocchini <gabrielbocchini@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/12/c1/9bbd46c55d64f517b19ea6178d412025163d809d55f7ddbad0f44b6ccb87/coolipy-0.0.7.tar.gz",
    "platform": null,
    "description": "# Coolipy\r\n\r\n**The first (un)official Python client for the [Coolify](https://coolify.io/).**\r\nCoolipy simplifies programmatically interacting with Coolify by providing wrappers around [Coolify API](https://coolify.io/docs/api), enabling you to manage projects, deployments, servers, services, and more with python scripts.\r\n\r\n- Lib docs: https://coolipydocs.gabrielbocchini.com.br/\r\n- Coolify API docs: https://coolify.io/docs/api\r\n\r\n## Installation\r\n\r\nInstall Coolipy using pip:\r\n\r\n```bash\r\npip install coolipy\r\n```\r\n\r\n## Features\r\n- Manage Coolify projects, servers, applications, deployments and more (everything the Coolify App offers);\r\n- Infra as code;\r\n- 1 dependency: requests>=2.32.3;\r\n- Datamodels for all endpoints;\r\n- Datamodels specific for creation with only the required fields;\r\n- All responses come from Datamodels;\r\n\r\nTO DO:\r\n\r\n- Async support.\r\n\r\n\r\n## Lib Assets\r\n\r\n- `coolipy.models`: hold all data models used to hold retrieved data. Create methods use models names following the pattern: `<service>ModelCreate`;\r\n- `coolipy.services`: methods used to interact with the Coolify API.\r\n-\r\n\r\n\r\n# Quick Start Guide/Examples\r\n\r\n- Import and Initialize\r\n```python\r\nfrom coolipy import Coolipy\r\n\r\ncoolify_client = Coolipy(\r\n    coolify_api_key=\"your_coolify_api_key\",\r\n    coolify_endpoint=\"your_coolify_instance_address\",\r\n)\r\n```\r\n\r\n## Example Usage\r\n\r\n- Create a Project\r\n```python\r\nmy_project = coolify_client.projects.create(project_name=\"MyProject\", project_description=\"This is MyProject description\")\r\n```\r\n\r\nThe response will be a [CoolipyAPIResponse](https://github.com/gbbocchini/coolipy/blob/main/coolipy/models/coolify_api_response.py) containing the Coolify api response code and `data`, in this case, will be a [ProjectsModel](https://github.com/gbbocchini/coolipy/blob/main/coolipy/models/projects.py).\r\n\r\n```bash\r\n>print(my_project)\r\n\r\nCoolifyAPIResponse(\r\n    status_code=201,\r\n    data=ProjectsModel(\r\n        name=MyProject,\r\n        description=This is MyProject description,\r\n        id=None,\r\n        uuid='b84skk8c4owskskogko40s44',\r\n        default_environment=None,\r\n        environments=[],\r\n        team_id=None,\r\n        created_at=None,\r\n        updated_at=None\r\n    )\r\n)\r\n```\r\n\r\n- List Servers\r\n```python\r\nservers = coolify_client.servers.list()\r\n\r\n>print(servers)\r\n\r\nCoolifyAPIResponse(\r\n    status_code=200,\r\n    data=[\r\n        ServerModel(\r\n            id=None,\r\n            description=\"This is the server where Coolify is running on. Don't delete this!\",\r\n            name='localhost', ip='host.docker.internal',\r\n            port=22,\r\n            user='root',\r\n            private_key_id=None,\r\n            uuid='gwogk4ssckgw8gwokcswww4o',\r\n            team_id=None,\r\n            sentinel_updated_at=None,\r\n            reated_at=None,\r\n            updated_at=None,\r\n            deleted_at=None,\r\n            high_disk_usage_notification_sent=False,\r\n            log_drain_notification_sent=False,\r\n            swarm_cluster=False,\r\n            validation_logs=None,\r\n            unreachable_count=None,\r\n            unreachable_notification_sent=False,\r\n            proxy=ServerProxyModel(\r\n                type='traefik',\r\n                status=None,\r\n                last_saved_settings=None,\r\n                last_applied_settings=None,\r\n                force_stop=None,\r\n                redirect_enabled=True\r\n            ),\r\n            settings=ServerSettingsModel(\r\n                id=1,\r\n                concurrent_builds=2,\r\n                delete_unused_networks=False,\r\n                delete_unused_volumes=False,\r\n                docker_cleanup_frequency='0 0 * * *',\r\n                docker_cleanup_threshold=80,\r\n                dynamic_timeout=3600,\r\n                force_disabled=False,\r\n                force_docker_cleanup=True,\r\n                generate_exact_labels=False,\r\n                is_build_server=False,\r\n                is_cloudflare_tunnel=False,\r\n                is_jump_server=False,\r\n                is_logdrain_axiom_enabled=False,\r\n                is_logdrain_custom_enabled=False,\r\n                is_logdrain_highlight_enabled=False,\r\n                is_logdrain_newrelic_enabled=False,\r\n                is_metrics_enabled=False,\r\n                is_reachable=True,\r\n                is_sentinel_debug_enabled=False,\r\n                is_sentinel_enabled=False,\r\n                is_swarm_manager=False,\r\n                is_swarm_worker=False,\r\n                is_usable=True,\r\n                sentinel_custom_url='http://host.docker.internal:8000',\r\n                sentinel_metrics_history_days=7,\r\n                sentinel_metrics_refresh_rate_seconds=10,\r\n                sentinel_push_interval_seconds=60,\r\n                sentinel_token='==',\r\n                server_disk_usage_notification_threshold=80,\r\n                server_id=0, server_timezone='UTC',\r\n                 created_at=datetime.datetime(2025, 1, 13, 19, 6, 12, tzinfo=datetime.timezone.utc),\r\n                 updated_at=datetime.datetime(2025, 1, 13, 19, 7, 19, tzinfo=datetime.timezone.utc),\r\n                 logdrain_axiom_api_key=None,\r\n                 logdrain_axiom_dataset_name=None,\r\n                 logdrain_custom_config=None,\r\n                 logdrain_custom_config_parser=None,\r\n                 logdrain_highlight_project_id=None,\r\n                 logdrain_newrelic_base_uri=None,\r\n                 logdrain_newrelic_license_key=None,\r\n                 wildcard_domain=None\r\n            ),\r\n            is_reachable=True,\r\n            is_usable=True\r\n        )\r\n    ]\r\n)\r\n```\r\n\r\n- Create a Service\r\n```python\r\nfrom coolipy.models.service import ServiceModelCreate\r\nfrom coolipy.constants import COOLIFY_SERVICE_TYPES\r\n\r\nservice_data = ServiceModelCreate(\r\n    type=COOLIFY_SERVICE_TYPES.glance,\r\n    name=\"Example Service\",\r\n    project_uuid=\"your_project_uuid\",\r\n    server_uuid=\"your_server_uuid\",\r\n    destination_uuid=\"your_destination_uuid\",\r\n    instant_deploy=True,\r\n    environment_name=\"production\"\r\n)\r\nnew_service = coolify_client.services.create(service_data)\r\n```\r\n\r\n- Create a DB:\r\n```python\r\nfrom coolipy.models.databases import PostgreSQLModelCreate\r\n\r\npostgres_db = PostgreSQLModelCreate(\r\n    project_uuid=\"your_project_uuid\",\r\n    server_uuid=\"your_server_uuid\",\r\n    environment_name=\"production\",\r\n    is_public=False,\r\n    limits_cpu_shares=0,\r\n    limits_cpus=0,\r\n    limits_cpuset=0,\r\n    limits_memory=0,\r\n    limits_memory_reservation=0,\r\n    limits_memory_swap=0,\r\n    limits_memory_swappiness=0,\r\n    instant_deploy=True,\r\n    postgres_user=\"dbuser\",\r\n    postgres_password=\"password\",\r\n    postgres_db=\"mydatabase\",\r\n    name=\"My PostgreSQL DB\",\r\n    postgres_conf=\"LQ==\",  # Example config\r\n    postgres_host_auth_method=\"-\",\r\n    postgres_initdb_args=\"-\"\r\n)\r\n\r\nmy_database = coolify_client.databases.create(database_model_create=postgres_db)\r\n```\r\n\r\n- Create an App\r\n```python\r\nfrom coolipy.models.applications import ApplicationPrivateGHModelCreate\r\n\r\napp_data = ApplicationPrivateGHModelCreate(\r\n    project_uuid=\"your_project_uuid\",\r\n    server_uuid=\"your_server_uuid\",\r\n    environment_name=\"production\",\r\n    ports_exposes=\"8080\",\r\n    github_app_uuid=\"your_github_app_uuid\",\r\n    git_repository=\"your_github_repo\",\r\n    git_branch=\"main\",\r\n    build_pack=COOLIFY_BUILD_PACKS.dockerfile,\r\n    instant_deploy=True,\r\n    name=\"MyApp\"\r\n)\r\n\r\nnew_app = coolify_client.applications.create(app_data)\r\n```\r\n\r\n# Contributing\r\n\r\n- Before opening a pull request or issue, take some time to understand if the issue should be treated at\r\nthis client level OR the Coolify REST API;\r\n- Create a fork of this repo and then submit a pull request;\r\n- Respect Python PEPs and type inference;\r\n- Test your code or changes introduced and deliver unit tests on the PR;\r\n- No breaking changes unless if necessary due Coolipy REST API change (please provide Coolipy PR/commits of the change).\r\n\r\n\r\n# License\r\n\r\nThis project is licensed under the Apache License 2.0. See the [LICENSE](./LICENSE) file for details.\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Coolipy - (Un)official Coolify - coolify.io - Python client!",
    "version": "0.0.7",
    "project_urls": {
        "Documentation": "https://coolipydocs.gabrielbocchini.com.br/",
        "Homepage": "https://github.com/gbbocchini/coolipy",
        "Repository": "https://github.com/gbbocchini/coolipy"
    },
    "split_keywords": [
        "coolify",
        " rest client",
        " api client"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fd4ab7dbf1055f7ac177c2981f8f15c89898fbd5485b3495b1e9361c2a83ee27",
                "md5": "dd2a5feff92daec764464fe15374e70d",
                "sha256": "aaa8a1d0b1b2c7bab091e4db1f56cd40306eeec1dc5f85774c9b35e5a319cd77"
            },
            "downloads": -1,
            "filename": "coolipy-0.0.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dd2a5feff92daec764464fe15374e70d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 34352,
            "upload_time": "2025-01-13T22:53:57",
            "upload_time_iso_8601": "2025-01-13T22:53:57.573912Z",
            "url": "https://files.pythonhosted.org/packages/fd/4a/b7dbf1055f7ac177c2981f8f15c89898fbd5485b3495b1e9361c2a83ee27/coolipy-0.0.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "12c19bbd46c55d64f517b19ea6178d412025163d809d55f7ddbad0f44b6ccb87",
                "md5": "35f61551705894aced11e576ed67b986",
                "sha256": "e2e6cfe7182653916cc06f1f075f1c7ca22f9229ae1a075f867b47644a57617e"
            },
            "downloads": -1,
            "filename": "coolipy-0.0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "35f61551705894aced11e576ed67b986",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 27890,
            "upload_time": "2025-01-13T22:53:58",
            "upload_time_iso_8601": "2025-01-13T22:53:58.709903Z",
            "url": "https://files.pythonhosted.org/packages/12/c1/9bbd46c55d64f517b19ea6178d412025163d809d55f7ddbad0f44b6ccb87/coolipy-0.0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-13 22:53:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "gbbocchini",
    "github_project": "coolipy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "coolipy"
}
        
Elapsed time: 1.39049s