Skip to content
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

Umshini: update environments to use OpenAI 1.0.0 API, add CI testing #98

Merged
merged 111 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
d3476d8
Merge pull request #77 from Farama-Foundation/dev
elliottower Nov 13, 2023
4a7398e
Add python-publish workflow to automate pypi releases
elliottower Nov 13, 2023
f478d00
Merge pull request #78 from elliottower/pypi-publish-workflow
elliottower Nov 13, 2023
41a2bb8
Add pre-commit hooks and fix basic things (flake8, spelling)
elliottower Nov 13, 2023
c7c0110
Add auto formatter for docstrings
elliottower Nov 13, 2023
9159c34
Add pre-commit CI
elliottower Nov 14, 2023
17ff398
Add deptry to testing extra because it is used for pre-commit and isn…
elliottower Nov 14, 2023
5d3e2be
Add ignore deptry to pyproject.toml so it doesn't error on itself
elliottower Nov 14, 2023
aca85ad
Add basic pytest CI because there are already unit tests in tests folder
elliottower Nov 14, 2023
96f921d
Skip failing tests
elliottower Nov 14, 2023
b16041c
Fix deptry errors
elliottower Nov 14, 2023
836c308
Update chess v5 to chess v6, pz version, importorskips for hf transfo…
elliottower Nov 14, 2023
3f13663
pre-commit
elliottower Nov 14, 2023
37aa069
Add testing deps to all
elliottower Nov 14, 2023
75106c0
Fix pettingzoo deps
elliottower Nov 14, 2023
da49744
Add specifi tests/ folder to pytest calls because it seems CI workflo…
elliottower Nov 14, 2023
c9bfd75
Add import checks to see if openai or anthropic keys are present and …
elliottower Nov 14, 2023
99e3c9c
Add extra openai checks for other failing tests
elliottower Nov 14, 2023
bec6a85
Update tests to properly skip, add experimental windows CI, remove co…
elliottower Nov 14, 2023
707742e
Except errors from invalid actions for pettingzoo tests
elliottower Nov 15, 2023
5facc95
Change requirements to not use openspiel as it fails for windows install
elliottower Nov 15, 2023
854518f
Fix windows distribution test using wrong forwardslash separator
elliottower Nov 15, 2023
7cf3167
Make version done dynamically in init, access for windows to install …
elliottower Nov 15, 2023
b9a2c8c
Change name from linux-test to windows test
elliottower Nov 15, 2023
276b394
Add pre-commit hooks and CI tests for windows, mac, linux (#79)
elliottower Nov 15, 2023
e1827f1
Fix gradio version because API has changed
elliottower Nov 15, 2023
4aebb78
Specify requirements for anthropic and gradio to avoid breaking changes
elliottower Nov 15, 2023
0b2fc47
Gradio and anthropic versions fix (#80)
elliottower Nov 15, 2023
d9acd80
Fix minor bug with agent id
andrewtanJS Nov 15, 2023
5d97a8d
Umshini: fix minor bug with agent id (#82)
elliottower Nov 15, 2023
b3f650e
Bump version number
elliottower Nov 16, 2023
80615ee
Bump version number to 0.1.13 (#83)
elliottower Nov 16, 2023
a1e6e5f
Create CONTRIBUTING.md
elliottower Nov 16, 2023
25d099e
Create CONTRIBUTING.md (#84)
elliottower Nov 16, 2023
a223693
Add wheel publishing for macos and windows
elliottower Nov 16, 2023
6fd1676
Add wheel publishing for macos and windows (#85)
elliottower Nov 16, 2023
10e736b
Filter out transformer 'pytorch tensorflow not found' message, update…
elliottower Nov 17, 2023
f8f49e4
pre-commit
elliottower Nov 17, 2023
c63d208
Suppress`transformers` "Models won't be available" message, update Um…
elliottower Nov 17, 2023
15bc2f2
Bump version number for hotfix 0.1.13.1
elliottower Nov 17, 2023
df5f142
Bump version number for hotfix 0.1.13.1 (#88)
elliottower Nov 17, 2023
d038f02
Use most recent upload and download artefact versions (node v12 depre…
elliottower Nov 17, 2023
057d184
Update upload-artifact and download-artifact versions (deprecated nod…
elliottower Nov 17, 2023
bc1a0f2
Remove extra platforms as this library is pure python, none-any wheel…
elliottower Nov 17, 2023
42920e9
Python-publish: remove extra platforms (pure python library, will bui…
elliottower Nov 17, 2023
15affcc
Fix [all] requirement to use gradio less than 4.0, remove extra newli…
elliottower Nov 18, 2023
ac7fa00
Fix [all] requirement to use gradio less than 4.0 (#91)
elliottower Nov 18, 2023
006df1e
Update version to 0.1.13.2
elliottower Nov 18, 2023
0624a9b
Update version to 0.1.13.2 (#92)
elliottower Nov 18, 2023
468b18c
Hard code gradio and pydantic versions (working locally now)
elliottower Nov 18, 2023
54fa85f
Hard code gradio and pydantic versions (gradio working locally now) (…
elliottower Nov 18, 2023
41bfa57
Bump version to 0.1.13.3
elliottower Nov 18, 2023
679ca3a
Bump version to 0.1.13.3 (#94)
elliottower Nov 18, 2023
76b510b
Update to use openai 1.0.0 API
elliottower Nov 20, 2023
7b708bd
Add exception to account for OpenAIError on import and client initial…
elliottower Nov 20, 2023
e3282fa
Update OpenAI backend to use 1.0.0 API (errors in local testing) (#95)
ZhengyaoJiang Nov 20, 2023
37ace76
Bump version number (fix HF space)
elliottower Nov 20, 2023
7975a20
Bump version number (fix HF space) (#96)
elliottower Nov 20, 2023
74549a8
Bug fix: fix error for openai backend: Choice is not subscriptable.
Nov 21, 2023
9a05a4d
Merge remote-tracking branch 'origin/main' into openai-backend-fix
Nov 21, 2023
8c8b977
Update Umshini environments to use new OpenAI 1.0.0 API, clean up code
elliottower Nov 21, 2023
075ba5d
Add workflows for automated CI testing of Umshini environments
elliottower Nov 21, 2023
8dc87e7
Fix environment variable names for AzureOpenAI workflow
elliottower Nov 21, 2023
e0d6c8f
Add test_umshini_environments file and exclude by default from pytest…
elliottower Nov 21, 2023
1f0b534
Remove coverage due to errors
elliottower Nov 21, 2023
13456f6
Fix typos
elliottower Nov 21, 2023
f883c17
Add missing dependency colorama
elliottower Nov 21, 2023
c6fa050
Remove old client='' for langchain examples (hasn't been around for a…
elliottower Nov 21, 2023
f8aedda
Restore backup mdoel code from Umshini environments (gpt-35-turbo ins…
elliottower Nov 21, 2023
8dd2df6
Add checks that the env vars are done correctly
elliottower Nov 21, 2023
ec3f135
Remove xvfb because not needed for these tests
elliottower Nov 21, 2023
075b41e
Fix logic for env variable checks
elliottower Nov 21, 2023
1ef8b82
Fix wording slightly
elliottower Nov 21, 2023
581c1b8
Change umshini env test to only install dependencies for it
elliottower Nov 21, 2023
9bd5153
Remove pytest xdist because it might mess up env vars
elliottower Nov 21, 2023
8a0bd35
Add testing req as well as umshini for umshini tests
elliottower Nov 21, 2023
b0df5ae
Add pettingzoo classic reqs to umshini as well, not ideal but have to…
elliottower Nov 21, 2023
a0388fe
Remove unittest skipif because it seems to not work properly for umsh…
elliottower Nov 21, 2023
6ac655b
Specify httpx version as there's an OpenAI issue in CI with 0.25 version
elliottower Nov 21, 2023
897dcf2
Add explicit openai_api_key param, shouldn't change it but maybe
elliottower Nov 21, 2023
40520de
Specify openai version as most recent seems to break it
elliottower Nov 21, 2023
481511e
Loosen restriction on bardapi (requests subdependency which messes th…
elliottower Nov 21, 2023
4850e28
Make regular tests go first to see if they work
elliottower Nov 21, 2023
0864ed1
Make same requirements for azure and regular openai workflows for con…
elliottower Nov 21, 2023
b753370
Add test debugging statements to see if the key is available in pytho…
elliottower Nov 21, 2023
43ffe63
Use to make environment variables visible to python
elliottower Nov 22, 2023
1a207d5
Use env var instead of secret directly in bash
elliottower Nov 22, 2023
e4344ca
Add troubleshooting to test if deployment is visible
elliottower Nov 22, 2023
a0ca659
Add same troubleshooting and echoing to in other workflow
elliottower Nov 22, 2023
10ac5c3
Install dependencies first before doing environment variables
elliottower Nov 22, 2023
d203cab
Add env to individual tests as well
elliottower Nov 22, 2023
f9aabd4
Make secrets case sensitive allcaps to match on GitHub
elliottower Nov 22, 2023
8fd75d1
Change name to OPENAI_API_KEY for env var
elliottower Nov 22, 2023
6a1a667
Add printing to regular openai ci
elliottower Nov 22, 2023
ba2ce6a
Test
elliottower Nov 22, 2023
a17c688
Add more testing
elliottower Nov 22, 2023
8d8843f
Test secret
elliottower Nov 22, 2023
80651de
test secret
elliottower Nov 22, 2023
b622940
Test secret fix typo
elliottower Nov 22, 2023
759cce7
Change where env is defined?
elliottower Nov 22, 2023
63bde2f
Remove test secret part
elliottower Nov 22, 2023
823d738
Remove test secret part
elliottower Nov 22, 2023
8e7b299
Remove all testing/debug, only run on merge to master
elliottower Nov 22, 2023
cb0cb2a
Revert unnecessary changes which were made for testing
elliottower Nov 22, 2023
49f1874
Openai backend fix (#97)
elliottower Nov 22, 2023
4d283ab
Merge remote-tracking branch 'upstream/main' into umshini-openai-v1-u…
elliottower Nov 22, 2023
7e8bee1
Merge master
elliottower Nov 22, 2023
f5e2f43
Add on pull request target to test the CIs without merging to master
elliottower Nov 22, 2023
419491a
Fix syntax
elliottower Nov 22, 2023
99b8712
Fix syntax to run regularly in this PR
elliottower Nov 22, 2023
4990b55
Make workflow trigger on pushes to main and dev
elliottower Nov 22, 2023
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
38 changes: 38 additions & 0 deletions .github/workflows/environments-test-azure-openai.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
---
name: Environments Test (AzureOpenAI)

on:
push:
branches: [ main, dev ]

permissions:
contents: read


jobs:
environment-test-azure-openai:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.11' ]
env:
OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
OPENAI_API_TYPE: azure
AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }}
OPENAI_API_VERSION: 2023-05-15
AZURE_DEPLOYMENT: gpt-4
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -e '.[all]'
- name: Umshini Environments Test
run: |
python -c 'import os; print("AZURE_OPENAI_API_KEY visible in os.environ:", os.getenv("AZURE_OPENAI_API_KEY"))'
pytest -v tests/unit/test_umshini_environments.py
39 changes: 39 additions & 0 deletions .github/workflows/environments-test-openai.yml
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://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
---
name: Environments Test (OpenAI)

on:
push:
branches: [ main, dev ]

permissions:
contents: read

env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_API_TYPE: openai

jobs:
environment-test-openai:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.11' ]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -e '.[all]'
- name: Regular Environments Test
run: |
python -c 'import os; print("OPENAI_API_KEY visible in os.environ:", os.getenv("OPENAI_API_KEY"))'
pytest -v tests
- name: Umshini Environments Test
run: |
python -c 'import os; print("OPENAI_API_KEY visible in os.environ:", os.getenv("OPENAI_API_KEY"))'
pytest -v tests/unit/test_umshini_environments.py
37 changes: 37 additions & 0 deletions .github/workflows/linux-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
---
name: Linux tests

on:
pull_request:
push:
branches: [main]

permissions:
contents: read

jobs:
linux-test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11' ]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get install python3-opengl xvfb
pip install -e '.[all]'
- name: Source distribution test
run: |
python -m pip install --upgrade build
python -m build --sdist
pip install dist/*.tar.gz
- name: Release Test
run: |
xvfb-run -s "-screen 0 1024x768x24" pytest -v -n auto tests/
36 changes: 36 additions & 0 deletions .github/workflows/macos-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
---
name: MacOS tests

on:
pull_request:
push:
branches: [main]

permissions:
contents: read

jobs:
macos-test:
runs-on: macos-11
strategy:
matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11' ]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -e '.[all]'
- name: Source distribution test
run: |
python -m pip install --upgrade build
python -m build --sdist
pip install dist/*.tar.gz
- name: Release Test
run: |
pytest -v -n auto tests/
25 changes: 25 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# https://pre-commit.com
# This GitHub Action assumes that the repo contains a valid .pre-commit-config.yaml file.
---
name: pre-commit
on:
pull_request:
push:
branches: [main]

permissions:
contents: read

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- run: pip install pre-commit
- run: pip install -e '.[all]'
- run: pre-commit --version
- run: pre-commit install
- run: pre-commit run --all-files
65 changes: 65 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: build-publish

on:
release:
types: [published]

jobs:
build-wheels:
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
matrix:
include:
- os: ubuntu-latest
python: 38
platform: manylinux_x86_64
- os: ubuntu-latest
python: 39
platform: manylinux_x86_64
- os: ubuntu-latest
python: 310
platform: manylinux_x86_64
- os: ubuntu-latest
python: 311
platform: manylinux_x86_64

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: python -m pip install --upgrade setuptools wheel
- name: Build wheels
run: python setup.py sdist bdist_wheel
- name: Store wheels
uses: actions/upload-artifact@v3
with:
path: dist

publish:
runs-on: ubuntu-latest
needs:
- build-wheels
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- name: Download dists
uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
36 changes: 36 additions & 0 deletions .github/workflows/windows-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
---
name: Windows tests

on:
pull_request:
push:
branches: [main]

permissions:
contents: read

jobs:
windows-test:
runs-on: windows-latest
strategy:
matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11' ]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -e '.[all]'
- name: Source distribution test
run: |
python -m pip install --upgrade build
python -m build --sdist
pip install dist/chatarena-$(python -c "import chatarena; print(chatarena.__version__)").tar.gz
- name: Release Test
run: |
pytest -v -n auto tests
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,4 @@ cython_debug/
.DS_Store
hf-spaces/
etc/
.conda
.conda
84 changes: 84 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-symlinks
- id: destroyed-symlinks
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: check-ast
- id: check-added-large-files
- id: check-merge-conflict
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: detect-private-key
- id: debug-statements
- id: mixed-line-ending
args: [ "--fix=lf" ]
- repo: https://github.com/python/black
rev: 23.11.0
hooks:
- id: black
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
args:
- --skip=*.css,*.js,*.map,*.scss,*.svg
- --ignore-words-list=magent
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
args:
- '--per-file-ignores=*/__init__.py:F401,experiments/ai_council.py:E501,chatarena/backends/hf_transformers.py:F401'
- --extend-ignore=E203
- --max-complexity=205
- --max-line-length=300
- --show-source
- --statistics
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
args: ["--profile", "black"]
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
args: ["--py38-plus"]
# - repo: https://github.com/pycqa/pydocstyle
# rev: 6.3.0
# hooks:
# - id: pydocstyle
# args:
# - --source
# - --explain
# - --convention=google
# - --count
# - --add-ignore=D100,D107,D101,D102,D103,D105,D212,D417,D403,D415,D200
# exclude: "__init__.py$"
# additional_dependencies: ["tomli"]
- repo: https://github.com/DanielNoord/pydocstringformatter
rev: v0.7.3
hooks:
- id: pydocstringformatter
# - repo: local
# hooks:
# - id: pyright
# name: pyright
# entry: pyright
# language: node
# pass_filenames: false
# types: [python]
# additional_dependencies: ["pyright"]
# args:
# - --project=pyproject.toml
- repo: https://github.com/fpgmaas/deptry.git
rev: "0.12.0"
hooks:
- id: deptry
Loading