Skip to content

add pipeline for tests example #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
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
42 changes: 42 additions & 0 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This is a basic workflow to help you get started with Actions

name: dev workflow

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ main ]
pull_request:
branches: [ main ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "test"
test:
# The type of runner that the job will run on
strategy:
matrix:
python-versions: [3.7, 3.8, 3.9, "3.10"]
os: [ubuntu-18.04, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-versions }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[dev]

- name: test with pytest
run:
pytest openai/tests
8 changes: 5 additions & 3 deletions openai/tests/asyncio/test_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
# FILE TESTS
async def test_file_upload():
result = await openai.File.acreate(
file=io.StringIO(json.dumps({"text": "test file data"})),
purpose="search",
file=io.StringIO(
json.dumps({"prompt": "test file data", "completion": "tada"})
),
purpose="fine-tune",
)
assert result.purpose == "search"
assert result.purpose == "fine-tune"
assert "id" in result

result = await openai.File.aretrieve(id=result.id)
Expand Down
2 changes: 1 addition & 1 deletion openai/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "0.26.3"
VERSION = "0.26.4"
10 changes: 3 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
[project]
license = {file = "LICENSE"}
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[tool.black]
target-version = ['py36']
Expand Down
65 changes: 65 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
[metadata]
name = openai
version = attr: openai.version.VERSION
description = Python client library for the OpenAI API
long_description = file: README.md
long_description_content_type = text/markdown
author = OpenAI
author_email = support@openai.com
url = https://github.com/openai/openai-python
license_files = LICENSE
classifiers =
Programming Language :: Python :: 3
License :: OSI Approved :: MIT License
Operating System :: OS Independent

[options]
packages = find:
python_requires = >=3.7.1
zip_safe = True
include_package_data = True
install_requires =
requests >= 2.20 # to get the patch for CVE-2018-18074
tqdm # Needed for progress bars
typing_extensions; python_version<"3.8" # Needed for type hints for mypy
aiohttp # Needed for async support

[options.extras_require]
dev =
black ~= 21.6b0
pytest == 6.*
pytest-asyncio
pytest-mock
datalib =
numpy
pandas >= 1.2.3 # Needed for CLI fine-tuning data preparation tool
pandas-stubs >= 1.1.0.11 # Needed for type hints for mypy
openpyxl >= 3.0.7 # Needed for CLI fine-tuning data preparation tool xlsx format
wandb =
wandb
numpy
pandas >= 1.2.3 # Needed for CLI fine-tuning data preparation tool
pandas-stubs >= 1.1.0.11 # Needed for type hints for mypy
openpyxl >= 3.0.7 # Needed for CLI fine-tuning data preparation tool xlsx format
embeddings =
scikit-learn >= 1.0.2 # Needed for embedding utils, versions >= 1.1 require python 3.8
tenacity >= 8.0.1
matplotlib
sklearn
plotly
numpy
pandas >= 1.2.3 # Needed for CLI fine-tuning data preparation tool
pandas-stubs >= 1.1.0.11 # Needed for type hints for mypy
openpyxl >= 3.0.7 # Needed for CLI fine-tuning data preparation tool xlsx format

[options.entry_points]
console_scripts =
openai = openai._openai_scripts:main

[options.package_data]
openai = py.typed

[options.packages.find]
exclude =
tests
tests.*
68 changes: 2 additions & 66 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,67 +1,3 @@
import os
from setuptools import setup

from setuptools import find_packages, setup

version_contents = {}
version_path = os.path.join(
os.path.abspath(os.path.dirname(__file__)), "openai/version.py"
)
with open(version_path, "rt") as f:
exec(f.read(), version_contents)

with open("README.md", "r") as fh:
long_description = fh.read()


DATA_LIBRARIES = [
# These libraries are optional because of their size. See `openai/datalib.py`.
"numpy",
"pandas>=1.2.3", # Needed for CLI fine-tuning data preparation tool
"pandas-stubs>=1.1.0.11", # Needed for type hints for mypy
"openpyxl>=3.0.7", # Needed for CLI fine-tuning data preparation tool xlsx format
]

setup(
name="openai",
description="Python client library for the OpenAI API",
long_description=long_description,
long_description_content_type="text/markdown",
version=version_contents["VERSION"],
install_requires=[
"requests>=2.20", # to get the patch for CVE-2018-18074
"tqdm", # Needed for progress bars
'typing_extensions;python_version<"3.8"', # Needed for type hints for mypy
"aiohttp", # Needed for async support
],
extras_require={
"dev": ["black~=21.6b0", "pytest==6.*", "pytest-asyncio", "pytest-mock"],
"datalib": DATA_LIBRARIES,
"wandb": [
"wandb",
*DATA_LIBRARIES,
],
"embeddings": [
"scikit-learn>=1.0.2", # Needed for embedding utils, versions >= 1.1 require python 3.8
"tenacity>=8.0.1",
"matplotlib",
"sklearn",
"plotly",
*DATA_LIBRARIES,
],
},
python_requires=">=3.7.1",
entry_points={
"console_scripts": [
"openai=openai._openai_scripts:main",
],
},
packages=find_packages(exclude=["tests", "tests.*"]),
package_data={
"openai": [
"py.typed",
]
},
author="OpenAI",
author_email="support@openai.com",
url="https://github.com/openai/openai-python",
)
setup()