From 1590494a433a0fe6f9b0f1e094022e1cc3f1f4ad Mon Sep 17 00:00:00 2001
From: Gordon Hart
Date: Tue, 9 May 2023 12:09:18 -0400
Subject: [PATCH] Rename to 'kolena' (#6)
* Update all references of 'kolena-client' to just 'kolena'
* Add codecov badge; use requests_toolbelt user_agent
* Build and publish kolena-client packages to PyPI, CodeArtifact for backwards compatibility
* See if ice blue works well on badge
* Revert back to violet
* Add checks status badge
* Update badge ordering
* Add trunk CodeArtifact publish
* Update badges to point to 'kolena' repository
* Run sed once on multiple files
---
.circleci/config.yml | 8 ++---
.github/workflows/build.yml | 64 ++++++++++++++++++++++++-------------
README.md | 17 +++++-----
docs/source/conf.py | 2 +-
docs/source/index.rst | 4 +--
kolena/__init__.py | 2 +-
kolena/_utils/krequests.py | 6 ++--
pyproject.toml | 4 +--
8 files changed, 64 insertions(+), 43 deletions(-)
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 66deb2ab7..dd61dac60 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -9,7 +9,7 @@ parameters:
default: "3.9"
jobs:
- kolena-client-ci:
+ kolena-ci:
parameters:
python-version:
type: string
@@ -22,13 +22,13 @@ jobs:
steps:
- checkout
- restore_cache:
- key: &kolena-client-ci-cache kolena-client-ci-cache-<< parameters.python-version >>-{{ checksum "pyproject.toml" }}
+ key: &kolena-ci-cache kolena-ci-cache-<< parameters.python-version >>-{{ checksum "pyproject.toml" }}
- run: |
poetry config experimental.new-installer false
poetry config installer.max-workers 10
poetry install --no-ansi
- save_cache:
- key: *kolena-client-ci-cache
+ key: *kolena-ci-cache
paths:
- /home/circleci/project/.poetry/virtualenvs
- poetry.lock
@@ -64,7 +64,7 @@ jobs:
workflows:
ci:
jobs:
- - kolena-client-ci:
+ - kolena-ci:
matrix:
parameters:
python-version: [ "3.7", "3.8", "3.9", "3.10" ]
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ce2c745ac..e2d54069c 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -5,13 +5,12 @@ on:
branches:
- does-not-exist
# TODO: uncomment once repository tags are set up properly
- # - trunk
# tags:
# - "*"
jobs:
build:
- name: Build and publish kolena-client Python package and documentation
+ name: Build and publish kolena Python package and documentation
env:
ASSET_BUCKET: kolena-client-assets
runs-on: ubuntu-latest
@@ -21,39 +20,46 @@ jobs:
steps:
- name: Check out the repo
uses: actions/checkout@v3
+
- uses: actions/setup-python@v4
with:
python-version: 3.9
+
- name: Configure AWS credentials
- uses: aws-actions/configure-aws-credentials@v1
+ uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
+
- name: Install Poetry
run: pip install poetry==1.2.2
+
- name: Fetch tags to enable autoversioning
run: git fetch --prune --unshallow --tags
- - name: Update kolena-client package version to PEP 440-compliant dev tag
- if: github.ref_type != 'tag'
- run: |
- LATEST_TAG=$(git describe --tags --abbrev=0)
- COMMITS_SINCE_TAG=$(git rev-list $LATEST_TAG..HEAD --count)
- poetry version $LATEST_TAG.dev$COMMITS_SINCE_TAG
- - name: Update kolena-client package version to PEP 440-compliant production release tag
- if: github.ref_type == 'tag'
+
+ - name: Update kolena package version to PEP 440-compliant production release tag
run: poetry version $(git describe --tags --abbrev=0)
+
- name: Install dependencies
run: poetry install
+
- name: Run pre-commit checks
run: poetry run pre-commit run -a
- - name: Build client Python package
+
+ - name: Build 'kolena' Python package
run: poetry build --format=sdist
+
+ - name: Build 'kolena-client' package for backwards compatibility
+ run: |
+ # update first instance of 'kolena' to 'kolena-client' in pyproject.toml, kolena/__init__.py (package name)
+ sed -i '0,/kolena/{s/kolena/kolena-client/}' pyproject.toml kolena/__init__.py
+ poetry build --format=sdist
+
- name: Build client documentation and push to S3
- if: github.ref_type == 'tag'
run: |
./render.sh
- VERSION=$(poetry run python3 -c "import importlib.metadata; print(importlib.metadata.version('kolena-client'))")
+ VERSION=$(poetry run python3 -c "import kolena; print(kolena.__version__)")
BUCKET_PATH="s3://$ASSET_BUCKET/docs/$VERSION"
echo "pushing documentation to '$BUCKET_PATH'..."
@@ -65,19 +71,33 @@ jobs:
aws s3 rm --recursive "$BUCKET_PATH"
aws s3 sync ./build "$BUCKET_PATH"
working-directory: ./docs
- - name: Install twine for package distribution
+
+ - name: Push kolena, kolena-client dists to Test PyPI
+ uses: pypa/gh-action-pypi-publish@release/v1
+ with:
+ password: ${{ secrets.TEST_PYPI_API_TOKEN }}
+ repository-url: https://test.pypi.org/legacy/
+
+ - name: Push kolena, kolena-client dists to PyPI
+ uses: pypa/gh-action-pypi-publish@release/v1
+ with:
+ password: ${{ secrets.PYPI_API_TOKEN }}
+
+ - name: Install twine for package distribution on CodeArtifact
run: pip3 install twine
- - name: Push client dist to trunk CodeArtifact
+
+ - name: Push kolena-client dist to trunk CodeArtifact for backwards compatibility
run: |
aws codeartifact login --tool twine --domain trunk --domain-owner 328803196297 --repository kolena-client
- twine upload --skip-existing --repository codeartifact ./dist/*
- - name: Push client dist to production CodeArtifact
- if: github.ref_type == 'tag'
+ twine upload --skip-existing --repository codeartifact ./dist/kolena_client*
+ working-directory: ${{ env.working-directory }}
+
+ - name: Push kolena-client dist to production CodeArtifact for backwards compatibility
run: |
aws codeartifact login --tool twine --domain production --domain-owner 328803196297 --repository kolena-client
- twine upload --skip-existing --repository codeartifact ./dist/*
- - name: Create GitHub release with kolena-client build as artifact
- if: github.ref_type == 'tag'
+ twine upload --skip-existing --repository codeartifact ./dist/kolena_cilent*
+
+ - name: Create GitHub release with kolena build as artifact
uses: marvinpinto/action-automatic-releases@v1.2.1
with:
repo_token: ${{ secrets.RELEASE_TOKEN }}
diff --git a/README.md b/README.md
index 2106b4465..dfc6cbed1 100644
--- a/README.md
+++ b/README.md
@@ -3,13 +3,11 @@
-
-
-
-
-
-
-
+
+
+
+
+
---
@@ -22,10 +20,11 @@ model behaviors and take the mystery out of model development. Kolena helps you:
- Meaningfully communicate model capabilities
- Automate model testing and deployment workflows
-`kolena-client` is the Python client library for programmatic interaction with Kolena.
+This `kolena` package contains the Python client library for programmatic interaction with the Kolena ML testing
+platform.
## Documentation
Visit [docs.kolena.io](https://docs.kolena.io/) for tutorial and usage documentation and the
-[API Reference](https://app.kolena.io/api/developer/docs/html/index.html) for detailed `kolena-client` typing and
+[API Reference](https://app.kolena.io/api/developer/docs/html/index.html) for detailed `kolena` typing and
function documentation.
diff --git a/docs/source/conf.py b/docs/source/conf.py
index 2b37aec14..27597bbc2 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -22,7 +22,7 @@
# -- Project information -----------------------------------------------------
-project = "kolena-client"
+project = "kolena"
copyright = f"{datetime.now().year} Kolena. All rights reserved"
author = "Kolena Engineering "
diff --git a/docs/source/index.rst b/docs/source/index.rst
index 0b6d5e351..4d57d3215 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -1,9 +1,9 @@
-.. kolena-client documentation master file, created by
+.. kolena documentation master file, created by
sphinx-quickstart on Thu Sep 30 16:33:40 2021.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
-API Reference: ``kolena-client``
+API Reference: ``kolena``
================================
.. toctree::
diff --git a/kolena/__init__.py b/kolena/__init__.py
index 21b8f48c8..2871144e2 100644
--- a/kolena/__init__.py
+++ b/kolena/__init__.py
@@ -19,7 +19,7 @@
#
# (robots do not like this file)
-__name__ = "kolena-client"
+__name__ = "kolena"
__version__: str
diff --git a/kolena/_utils/krequests.py b/kolena/_utils/krequests.py
index 0ba8cdaed..47e64a651 100644
--- a/kolena/_utils/krequests.py
+++ b/kolena/_utils/krequests.py
@@ -17,9 +17,11 @@
import requests
from requests import HTTPError
+from requests_toolbelt import user_agent
from requests_toolbelt.adapters import socket_options
-from kolena import __version__ as version
+from kolena import __name__ as client_name
+from kolena import __version__ as client_version
from kolena._utils.endpoints import get_endpoint
from kolena._utils.state import get_client_state
from kolena._utils.state import kolena_initialized
@@ -58,7 +60,7 @@ def _with_default_kwargs(**kwargs: Any) -> Dict[str, Any]:
"Content-Type": "application/json",
"Authorization": f"Bearer {client_state.jwt_token}",
"X-Request-ID": uuid.uuid4().hex,
- "User-Agent": f"kolena-client/{version}",
+ "User-Agent": user_agent(client_name, client_version),
}
return {
**default_kwargs,
diff --git a/pyproject.toml b/pyproject.toml
index 55821dec3..00db00a23 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,5 +1,5 @@
[tool.poetry]
-name = "kolena-client"
+name = "kolena"
version = "0.999.0"
description = "Client for Kolena's machine learning (ML) testing and debugging platform."
authors = ["Kolena Engineering "]
@@ -32,7 +32,7 @@ pandera = ">=0.9.0"
pydantic = ">=1.8"
dacite = ">=1.6"
requests = ">=2.20"
-requests-toolbelt = "^0.9.1"
+requests-toolbelt = ">=0.9"
importlib-metadata = { version = "<5.0", python = "<3.8" }
tqdm = ">=4,<5"
Pillow = "^9.1.1"