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
23 changes: 23 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: 2
updates:

# Docker
- package-ecosystem: docker
directory: "/"
schedule:
interval: "monthly"
open-pull-requests-limit: 25

# Python
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "monthly"
open-pull-requests-limit: 25

# GitHub Actions
- package-ecosystem: "github-actions"
directory: ".github/workflows"
schedule:
interval: "monthly"
open-pull-requests-limit: 25
37 changes: 37 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "CodeQL"

on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
push:
# run workflow when merging to main or develop
branches:
- main
- develop

jobs:
CodeQL-Build:
# CodeQL runs on ubuntu-latest, windows-latest, and macos-latest
runs-on: ubuntu-latest

permissions:
# required for all workflows
security-events: write

steps:
- name: Checkout repository
uses: actions/checkout@v5

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
# Override language selection by uncommenting this and choosing your languages
with:
languages: python

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
52 changes: 52 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: KBase SDK Base Client Tests

on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
push:
# run workflow when merging to main or develop
branches:
- main
- develop

jobs:

base_client_tests:
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- python-version: "3.12"

steps:

- name: Repo checkout
uses: actions/checkout@v5

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- name: Install uv
uses: astral-sh/setup-uv@v6

- name: Install dependencies
shell: bash
run: |
export UV_PROJECT_ENVIRONMENT="${pythonLocation}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is this set and why is it needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's set by the GHA machinery. It tells uv to install everything to the system vs. a venv.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use it in dockerfiles frequently

uv sync --locked

- name: Run tests
shell: bash
run: PYTHONPATH=src pytest --cov=src --cov-report=xml test

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be uv run pytest...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the export above this works


- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
##########################################
# READ BEFORE ALTERING THIS FILE
#
# Only files specific to this repo or that will be generated as part of using this repo should
# be ignored here. Files that are specific to particular development environments or users
# should be ignored in the global gitignore to ignore for all repos, or in .git/info/exclude
# to ignore for just this repo.
#
# Examples of appropriate files for each location:
# This file:
# python pyc files
# python cache files
# test configuration and output, including coverage data
#
# Global gitignore
# Eclipse .settings, .project, and .pyproject files
# Mac .DS_store files
# VSCode .vscode directory
#
# .git/info/exclude
# Temporary code / notes while exploring new repo features
# Personal data used for manual testing
#
##########################################

/.pytest_cache/
__pycache__
/.venv/
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# KBase SDK base client

This repo contains the base client code that all other SDK clients depend on. It's generally
expected that users don't directly interact with it, but it can be useful for cases where
a compiled client isn't available.

## Installation

```
pip install kbase-sdk-baseclient
```

## Usage

The client is not intended for general use, and power users should be easily able to inspect the
code and tests to determine proper useage.

## Development

### Adding and releasing code

* Adding code
* All code additions and updates must be made as pull requests directed at the develop branch.
* All tests must pass and all new code must be covered by tests.
* All new code must be documented appropriately
* Pydocs
* General documentation if appropriate
* Release notes
* Releases
* The main branch is the stable branch. Releases are made from the develop branch to the main
branch.
* Update the version in `sdk_baseclient.py` and `pyproject.toml`.
* Tag the version in git and github.
* Create a github release.

### Testing

```
uv sync --dev # only required on first run or when the uv.lock file changes
PYTHONPATH=src uv run pytest test
```
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.1.0

* Initial release
38 changes: 38 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[project]
name = "kbase-sdk-baseclient"
version = "0.1.0"
description = "Base client for the KBase SDK"
readme = "README.md"
authors = [{ name = "KBase Development Team" }]
requires-python = ">=3.12"
license = { text = "MIT" }
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
dependencies = [
"requests>=2.32.5",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["src/kbase"]

[dependency-groups]
dev = [
"ipython==9.6.0",
"pytest==8.4.2",
"pytest-cov==7.0.0",
]

[project.urls]
Homepage = "https://github.com/kbase/kb_sdk_baseclient"
Repository = "https://github.com/kbase/kb_sdk_baseclient"
Issues = "https://github.com/kbase/kb_sdk_baseclient/issues"

[tool.uv]
package = true
10 changes: 10 additions & 0 deletions src/kbase/sdk_baseclient.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""
The base client for all SDK clients.
"""


__version__ = "0.1.0"


class SDKBaseClient:
""" The base client. """
8 changes: 8 additions & 0 deletions test/test_sdk_baseclient.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from kbase import sdk_baseclient


_VERSION = "0.1.0"


def test_version():
assert sdk_baseclient.__version__ == _VERSION
Loading