Skip to content

Commit

Permalink
Merge branch 'trunk' into gh/pin-urllib3
Browse files Browse the repository at this point in the history
  • Loading branch information
gordonhart committed May 9, 2023
2 parents 0094a1f + 1590494 commit 4b821d7
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 42 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ parameters:
default: "3.9"

jobs:
kolena-client-ci:
kolena-ci:
parameters:
python-version:
type: string
Expand All @@ -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
Expand Down Expand Up @@ -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" ]
64 changes: 42 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'..."
Expand All @@ -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/[email protected]
with:
repo_token: ${{ secrets.RELEASE_TOKEN }}
Expand Down
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
</p>

<p align='center'>
<a href="https://pypi.python.org/pypi/kolena-client"><img src="https://img.shields.io/pypi/v/kolena-client" /></a>
<a href="https://www.apache.org/licenses/LICENSE-2.0"><img src="https://img.shields.io/pypi/l/kolena-client" /></a>
<a href="https://docs.kolena.io"><img src="https://img.shields.io/badge/docs-Tutorial%20%26%20Usage-6434c1" /></a>
<a href="https://app.kolena.io/api/developer/docs/html/index.html"><img src="https://img.shields.io/badge/docs-API%20Reference-6434c1" /></a>
<a href="https://codecov.io/gh/kolenaIO/kolena-client" >
<img src="https://codecov.io/gh/kolenaIO/kolena-client/branch/trunk/graph/badge.svg?token=8WOY5I8SF1"/>
</a>
<a href="https://pypi.python.org/pypi/kolena"><img src="https://img.shields.io/pypi/v/kolena" /></a>
<a href="https://www.apache.org/licenses/LICENSE-2.0"><img src="https://img.shields.io/pypi/l/kolena" /></a>
<a href="https://github.com/kolenaIO/kolena"><img src="https://img.shields.io/github/checks-status/kolenaIO/kolena/trunk" /></a>
<a href="https://codecov.io/gh/kolenaIO/kolena" ><img src="https://codecov.io/gh/kolenaIO/kolena/branch/trunk/graph/badge.svg?token=8WOY5I8SF1"/></a>
<a href="https://docs.kolena.io"><img src="https://img.shields.io/badge/resource-docs-6434c1" /></a>
</p>

---
Expand All @@ -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.
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

# -- Project information -----------------------------------------------------

project = "kolena-client"
project = "kolena"
copyright = f"{datetime.now().year} Kolena. All rights reserved"
author = "Kolena Engineering <[email protected]>"

Expand Down
4 changes: 2 additions & 2 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -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::
Expand Down
2 changes: 1 addition & 1 deletion kolena/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#
# (robots do not like this file)

__name__ = "kolena-client"
__name__ = "kolena"
__version__: str


Expand Down
6 changes: 4 additions & 2 deletions kolena/_utils/krequests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
Expand Down

0 comments on commit 4b821d7

Please sign in to comment.