Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
46 changes: 46 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Publish Python Package

on:
workflow_dispatch:
release:
types: [published]

permissions:
contents: read

jobs:
release-build:
runs-on: ubuntu-latest
# PyPI use trusted publisher
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install uv
uv venv
make dev
- name: Build
run: |
make build
- name: Validate
run: |
WHEEL=$(ls dist/*.whl | head -n 1)
python -m pip install "${WHEEL}[openai,google,anthropic]"
Comment thread
shenoyvvarun marked this conversation as resolved.
Outdated
python -c "from oci_genai_auth.openai import OciOpenAI; from oci_genai_auth.google import OciGoogleGenAI; from oci_genai_auth.anthropic import OciAnthropic; import oci_genai_auth;"
Comment thread
shenoyvvarun marked this conversation as resolved.
Outdated
# - name: Publish to Test PyPI
# run: |
# python -m pip install twine
# twine check dist/*
# twine upload --verbose -r testpypi dist/*
- name: Publish to PyPI
run: |
python -m pip install twine
twine check dist/*
twine upload --verbose dist/*
39 changes: 39 additions & 0 deletions .github/workflows/run-all-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Unit test, format and lint check

on:
workflow_dispatch:
pull_request:
branches: [ "main" ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
Comment thread
shenoyvvarun marked this conversation as resolved.
Outdated
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install uv
uv venv
make dev
- name: Format and Lint
run: |
make check
- name: Test with pytest
run: |
make test
- name: Build
run: |
make build
87 changes: 87 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Mac
.DS_Store

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[codz]
*$py.class


# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST


# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py.cover
.hypothesis/
.pytest_cache/
cover/

# Environments
.env
.envrc
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
.idea/
*.iml

# Visual Studio Code
.vscode/

# Ruff stuff:
.ruff_cache/

# PyPI configuration file
.pypirc

# Demo folder
.demo
2 changes: 0 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
*Detailed instructions on how to contribute to the project, if applicable. Must include section about Oracle Contributor Agreement with link and instructions*

# Contributing to this repository

We welcome your contributions! There are multiple ways to contribute.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2026 Oracle and/or its affiliates.
Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved.

The Universal Permissive License (UPL), Version 1.0

Expand Down
69 changes: 69 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Define the directory containing the source code
SRC_DIR := ./src
TEST_DIR := ./tests
EXAMPLE_DIR := ./examples

# Optional install extras via `make install <extra>` or `make build <extra>`
ifneq (,$(filter install build,$(MAKECMDGOALS)))
EXTRAS := $(filter-out install build,$(MAKECMDGOALS))
comma := ,
empty :=
space := $(empty) $(empty)
EXTRA_LIST := $(subst $(space),$(comma),$(strip $(EXTRAS)))
endif

.PHONY: all
all: test lint build

##@ General

.PHONY: help
help: ## Display this help.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-24s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

##@ Development

.PHONY: install
install: ## Install project dependencies. Example: `make install openai`
ifneq ($(strip $(EXTRA_LIST)),)
uv pip install --editable ".[${EXTRA_LIST}]"
else
uv pip install --editable .
endif

ifneq ($(strip $(EXTRAS)),)
.PHONY: $(EXTRAS)
$(EXTRAS):
@:
endif

.PHONY: dev
dev: ## Install development dependencies.
uv pip install ".[dev]"

.PHONY: test
test: ## Run tests.
uv run --no-project --no-reinstall pytest $(TEST_DIR) --cov --cov-config=.coveragerc -vv -s

.PHONY: clean
clean: ## Remove build artifacts.
rm -rf build dist *.egg-info .pytest_cache .coverage

.PHONY: format
format: ## Format code using ruff.
uv run --no-project --no-reinstall isort $(SRC_DIR) $(TEST_DIR) $(EXAMPLE_DIR)
uv run --no-project --no-reinstall ruff format $(SRC_DIR) $(TEST_DIR) $(EXAMPLE_DIR); uv run --no-project --no-reinstall ruff check --fix $(SRC_DIR) $(TEST_DIR) $(EXAMPLE_DIR)

.PHONY: lint
lint: ## Run linters using ruff.
uv run --no-project --no-reinstall ruff format --diff $(SRC_DIR) $(TEST_DIR)
uv run --no-project --no-reinstall mypy $(SRC_DIR) $(TEST_DIR)

.PHONY: check
check: format lint ## Run format and lint.

##@ Build

.PHONY: build
build: ## Build the application.
uv build
Loading
Loading