Skip to content

Commit df566eb

Browse files
committed
[Feature] Adding support for oci-genai-auth-python.
Signed-off-by: Varun Shenoy <varun.vinayak.shenoy@oracle.com>
1 parent 002b86d commit df566eb

73 files changed

Lines changed: 3672 additions & 3 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Publish Python Package
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types: [published]
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
release-build:
13+
runs-on: ubuntu-latest
14+
# PyPI use trusted publisher
15+
permissions:
16+
id-token: write
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Set up Python 3
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.11"
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
python -m pip install uv
27+
uv venv
28+
make dev
29+
- name: Build
30+
run: |
31+
make build
32+
- name: Validate
33+
run: |
34+
WHEEL=$(ls dist/*.whl | head -n 1)
35+
python -m pip install "${WHEEL}[openai,google,anthropic]"
36+
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;"
37+
# - name: Publish to Test PyPI
38+
# run: |
39+
# python -m pip install twine
40+
# twine check dist/*
41+
# twine upload --verbose -r testpypi dist/*
42+
- name: Publish to PyPI
43+
run: |
44+
python -m pip install twine
45+
twine check dist/*
46+
twine upload --verbose dist/*
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+
name: Unit test, format and lint check
5+
6+
on:
7+
workflow_dispatch:
8+
pull_request:
9+
branches: [ "main" ]
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
python-version: ["3.9", "3.10", "3.11", "3.12"]
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v3
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
python -m pip install uv
29+
uv venv
30+
make dev
31+
- name: Format and Lint
32+
run: |
33+
make check
34+
- name: Test with pytest
35+
run: |
36+
make test
37+
- name: Build
38+
run: |
39+
make build

.gitignore

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Mac
2+
.DS_Store
3+
4+
# Byte-compiled / optimized / DLL files
5+
__pycache__/
6+
*.py[codz]
7+
*$py.class
8+
9+
10+
# Distribution / packaging
11+
.Python
12+
build/
13+
develop-eggs/
14+
dist/
15+
downloads/
16+
eggs/
17+
.eggs/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
23+
wheels/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
31+
# Unit test / coverage reports
32+
htmlcov/
33+
.tox/
34+
.nox/
35+
.coverage
36+
.coverage.*
37+
.cache
38+
nosetests.xml
39+
coverage.xml
40+
*.cover
41+
*.py.cover
42+
.hypothesis/
43+
.pytest_cache/
44+
cover/
45+
46+
# Environments
47+
.env
48+
.envrc
49+
.venv
50+
env/
51+
venv/
52+
ENV/
53+
env.bak/
54+
venv.bak/
55+
56+
# mkdocs documentation
57+
/site
58+
59+
# mypy
60+
.mypy_cache/
61+
.dmypy.json
62+
dmypy.json
63+
64+
# Pyre type checker
65+
.pyre/
66+
67+
# pytype static type analyzer
68+
.pytype/
69+
70+
# Cython debug symbols
71+
cython_debug/
72+
73+
# PyCharm
74+
.idea/
75+
*.iml
76+
77+
# Visual Studio Code
78+
.vscode/
79+
80+
# Ruff stuff:
81+
.ruff_cache/
82+
83+
# PyPI configuration file
84+
.pypirc
85+
86+
# Demo folder
87+
.demo

CONTRIBUTING.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
*Detailed instructions on how to contribute to the project, if applicable. Must include section about Oracle Contributor Agreement with link and instructions*
2-
31
# Contributing to this repository
42

53
We welcome your contributions! There are multiple ways to contribute.

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2026 Oracle and/or its affiliates.
1+
Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved.
22

33
The Universal Permissive License (UPL), Version 1.0
44

Makefile

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Define the directory containing the source code
2+
SRC_DIR := ./src
3+
TEST_DIR := ./tests
4+
EXAMPLE_DIR := ./examples
5+
6+
# Optional install extras via `make install <extra>` or `make build <extra>`
7+
ifneq (,$(filter install build,$(MAKECMDGOALS)))
8+
EXTRAS := $(filter-out install build,$(MAKECMDGOALS))
9+
comma := ,
10+
empty :=
11+
space := $(empty) $(empty)
12+
EXTRA_LIST := $(subst $(space),$(comma),$(strip $(EXTRAS)))
13+
endif
14+
15+
.PHONY: all
16+
all: test lint build
17+
18+
##@ General
19+
20+
.PHONY: help
21+
help: ## Display this help.
22+
@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)
23+
24+
##@ Development
25+
26+
.PHONY: install
27+
install: ## Install project dependencies. Example: `make install openai`
28+
ifneq ($(strip $(EXTRA_LIST)),)
29+
uv pip install --editable ".[${EXTRA_LIST}]"
30+
else
31+
uv pip install --editable .
32+
endif
33+
34+
ifneq ($(strip $(EXTRAS)),)
35+
.PHONY: $(EXTRAS)
36+
$(EXTRAS):
37+
@:
38+
endif
39+
40+
.PHONY: dev
41+
dev: ## Install development dependencies.
42+
uv pip install ".[dev]"
43+
44+
.PHONY: test
45+
test: ## Run tests.
46+
uv run --no-project --no-reinstall pytest $(TEST_DIR) --cov --cov-config=.coveragerc -vv -s
47+
48+
.PHONY: clean
49+
clean: ## Remove build artifacts.
50+
rm -rf build dist *.egg-info .pytest_cache .coverage
51+
52+
.PHONY: format
53+
format: ## Format code using ruff.
54+
uv run --no-project --no-reinstall isort $(SRC_DIR) $(TEST_DIR) $(EXAMPLE_DIR)
55+
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)
56+
57+
.PHONY: lint
58+
lint: ## Run linters using ruff.
59+
uv run --no-project --no-reinstall ruff format --diff $(SRC_DIR) $(TEST_DIR)
60+
uv run --no-project --no-reinstall mypy $(SRC_DIR) $(TEST_DIR)
61+
62+
.PHONY: check
63+
check: format lint ## Run format and lint.
64+
65+
##@ Build
66+
67+
.PHONY: build
68+
build: ## Build the application.
69+
uv build

0 commit comments

Comments
 (0)