Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ omit =
.venv/*
*/tests/*
*/__main__.py
instill/protogen/*

[report]

Expand Down
4 changes: 0 additions & 4 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ Before delving into the details to come up with your first PR, please familiaris

To confirm these system dependencies are configured correctly:

```shell
make doctor
```

#### Installation

Fetch git submodules:
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ jobs:
with:
poetry-version: 2.1.2

- name: Check dependencies
run: make doctor

- uses: actions/cache@v4
with:
path: .venv
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
python-version: "3.12"

- uses: Gr1N/setup-poetry@v8

- name: Check dependencies
run: make doctor
- uses: abatilo/actions-poetry@v4
with:
poetry-version: 2.1.2

- uses: actions/cache@v3
with:
Expand Down
32 changes: 7 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ PYTEST_OPTIONS += --cov-report=xml
endif
PYTEST_RERUN_OPTIONS := --last-failed --exitfirst

.PHONY: test
test: test-all ## Run unit and integration tests

.PHONY: test-unit
test-unit: install
@ ( mv $(FAILURES) $(FAILURES).bak || true ) > /dev/null 2>&1
Expand All @@ -79,23 +76,8 @@ ifndef DISABLE_COVERAGE
poetry run coveragespace update unit
endif

.PHONY: test-int
test-int: install
@ if test -e $(FAILURES); then poetry run pytest tests $(PYTEST_RERUN_OPTIONS); fi
@ rm -rf $(FAILURES)
poetry run pytest tests $(PYTEST_OPTIONS)
ifndef DISABLE_COVERAGE
poetry run coveragespace update integration
endif

.PHONY: test-all
test-all: install
@ if test -e $(FAILURES); then poetry run pytest $(PACKAGE) tests $(PYTEST_RERUN_OPTIONS); fi
@ rm -rf $(FAILURES)
poetry run pytest $(PACKAGE) tests $(PYTEST_OPTIONS)
ifndef DISABLE_COVERAGE
poetry run coveragespace update overall
endif
.PHONY: test
test: test-unit

.PHONY: read-coverage
read-coverage:
Expand All @@ -105,18 +87,18 @@ read-coverage:

.PHONY: format
format: install
poetry run isort $(PACKAGE) tests notebooks
poetry run black $(PACKAGE) tests notebooks
poetry run isort $(PACKAGE) notebooks
poetry run black $(PACKAGE) notebooks
@ echo

.PHONY: check
check: install format ## Run formatters, linters, and static analysis
ifdef CI
git diff --exit-code
endif
poetry run mypy $(PACKAGE) tests
poetry run pylint $(PACKAGE) tests --rcfile=.pylint.ini
poetry run pydocstyle $(PACKAGE) tests
poetry run mypy $(PACKAGE)
poetry run pylint $(PACKAGE) --rcfile=.pylint.ini
poetry run pydocstyle $(PACKAGE)

# DOCUMENTATION ###############################################################

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Instill Core Python SDK

[![Unix Build Status](https://img.shields.io/github/actions/workflow/status/instill-ai/python-sdk/build.yml?branch=main&label=linux)](https://github.com/instill-ai/python-sdk/actions) [![Coverage Status](https://img.shields.io/codecov/c/gh/instill-ai/python-sdk)](https://codecov.io/gh/instill-ai/python-sdk) [![PyPI License](https://img.shields.io/pypi/l/instill-sdk.svg?color=lightgreen)](https://pypi.org/project/instill-sdk) [![PyPI Version](https://img.shields.io/pypi/v/instill-sdk.svg?color=lightgreen)](https://pypi.org/project/instill-sdk) [![PyPI Downloads](https://img.shields.io/pypi/dm/instill-sdk.svg?color=lightgreen)](https://pypistats.org/packages/instill-sdk)
[![Unix Build Status](https://img.shields.io/github/actions/workflow/status/instill-ai/python-sdk/build.yml?branch=main&label=linux)](https://github.com/instill-ai/python-sdk/actions) [![Coverage Status](https://img.shields.io/codecov/c/gh/instill-ai/python-sdk)](https://codecov.io/gh/instill-ai/python-sdk) [![PyPI License](https://img.shields.io/pypi/l/instill-sdk.svg?color=blue)](https://pypi.org/project/instill-sdk) [![PyPI Version](https://img.shields.io/pypi/v/instill-sdk.svg?color=blue)](https://pypi.org/project/instill-sdk) [![PyPI Downloads](https://img.shields.io/pypi/dm/instill-sdk.svg?color=blue)](https://pypistats.org/packages/instill-sdk)

> [!IMPORTANT]
> **This SDK tool is under active development**
Expand Down Expand Up @@ -103,7 +103,7 @@ hosts:
If you do not like the idea of having to create a config file, you can also setup your target instance by doing the following at the very beginning of your script.

```python
from instill.configuration import global_config
from instill.config import global_config

global_config.set_default(
url="api.instill-ai.com",
Expand Down
1 change: 0 additions & 1 deletion instill/clients/constant.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ def load(self) -> None:
return
try:
with open(path, "r", encoding="utf-8") as c:
self._config = _Config.validate(yaml.load(c, Loader=yaml.FullLoader))
self._config = _Config.model_validate(
yaml.load(c, Loader=yaml.FullLoader)
)
except Exception as e:
raise BaseException(f"Invalid configuration file at '{path}'") from e

Expand All @@ -60,7 +62,7 @@ def save(self) -> None:
with open(path, "w", encoding="utf-8") as c:
yaml.dump(
json.loads(
self._config.json(
self._config.model_dump_json(
exclude_none=True,
)
),
Expand Down
25 changes: 0 additions & 25 deletions instill/helpers/test.py

This file was deleted.

5 changes: 0 additions & 5 deletions instill/resources/const.py

This file was deleted.

3 changes: 0 additions & 3 deletions instill/resources/errors.py

This file was deleted.

13 changes: 10 additions & 3 deletions instill/resources/model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# pylint: disable=no-member,wrong-import-position,no-name-in-module
"""Model resource module."""

# pylint: disable=no-member

from typing import Optional

import instill.protogen.model.model.v1alpha.model_definition_pb2 as model_definition_interface
Expand Down Expand Up @@ -54,13 +57,17 @@ def resource(self):
return self._resource

@resource.setter
def resource(self, resource: model_interface.Model):
def resource(
self, resource: Optional[model_interface.Model]
): # pylint: disable=no-member
self._resource = resource

def _update(self):
self.resource = self.client.model.get_model(model_name=self.resource.id).model

def get_definition(self) -> model_definition_interface.ModelDefinition:
def get_definition(
self,
) -> model_definition_interface.ModelDefinition: # pylint: disable=no-member
return self.resource.model_definition

def delete(self, silent: bool = False):
Expand Down
9 changes: 7 additions & 2 deletions instill/resources/pipeline.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# pylint: disable=no-member,wrong-import-position,no-name-in-module
"""Pipeline resource module."""

# pylint: disable=no-name-in-module,no-member

from typing import Optional, Tuple, Union

import grpc
Expand Down Expand Up @@ -68,7 +71,9 @@ def resource(self):
return self._resource

@resource.setter
def resource(self, resource: pipeline_interface.Pipeline):
def resource(
self, resource: Optional[pipeline_interface.Pipeline]
): # pylint: disable=no-member
self._resource = resource

def _update(self):
Expand Down
7 changes: 1 addition & 6 deletions instill/resources/resource.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
"""Base resource interface module."""

# pylint: disable=no-member,wrong-import-position
from abc import ABC, abstractmethod


class Resource(ABC):
"""Base interface class for creating resources.

Args:
ABC (abc.ABCMeta): std abstract class
"""
"""Base interface class for creating resources."""

@property
@abstractmethod
Expand Down
2 changes: 1 addition & 1 deletion instill/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"""Unit tests for the package."""
"""Integration tests for the package."""
Loading