From 10b90ab420b96a79d8c1c7d48e3f07cdc2e0df7c Mon Sep 17 00:00:00 2001 From: Liren Tu Date: Tue, 18 Apr 2023 21:54:51 -0700 Subject: [PATCH 01/17] Ignore dist directory --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 7ad641a0c8..5bffd45b87 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ /public/dist __pycache__ build +dist *.egg .vscode/settings.json .ipynb_checkpoints From 408c6bc7b5afd11b3a99cacf082a4fa6edef4c09 Mon Sep 17 00:00:00 2001 From: Liren Tu Date: Tue, 18 Apr 2023 21:55:35 -0700 Subject: [PATCH 02/17] Add ci to run pytest --- .github/workflows/ci.yaml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000000..9b5d595de9 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,30 @@ +name: CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + python-version: ["3.7.1", "3.8", "3.9", "3.10", "3.11"] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + make + python -m pip install pytest pytest_mock + - name: Test with pytest + run: pytest From 6be967e4436b0de94908080964e76024a983b70f Mon Sep 17 00:00:00 2001 From: Liren Tu Date: Tue, 18 Apr 2023 21:57:04 -0700 Subject: [PATCH 03/17] Set fail-fast to false --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9b5d595de9..9a91646ff3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: - fail-fast: true + fail-fast: false matrix: python-version: ["3.7.1", "3.8", "3.9", "3.10", "3.11"] From 97541226c4304879f5cd613de3f581a9aa9248d3 Mon Sep 17 00:00:00 2001 From: Liren Tu Date: Tue, 18 Apr 2023 22:02:01 -0700 Subject: [PATCH 04/17] Update installation commands --- .github/workflows/ci.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9a91646ff3..c5c58c3cd4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,7 +24,10 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - make + python setup.py install + python -m pip install openai[embeddings] + python -m pip install openai[wandb] + python -m pip install openai[datalib] python -m pip install pytest pytest_mock - name: Test with pytest run: pytest From 64f8049e514816adab0eebe04f40beb26ebd50b5 Mon Sep 17 00:00:00 2001 From: Liren Tu Date: Tue, 18 Apr 2023 22:08:23 -0700 Subject: [PATCH 05/17] Update installation command --- .github/workflows/ci.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c5c58c3cd4..ee78bdb7ef 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,10 +24,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python setup.py install - python -m pip install openai[embeddings] - python -m pip install openai[wandb] - python -m pip install openai[datalib] - python -m pip install pytest pytest_mock + python -m pip install -e .[all] - name: Test with pytest run: pytest From 4192972be4be81b4ce8fafcbadda25de7669e611 Mon Sep 17 00:00:00 2001 From: Liren Tu Date: Tue, 18 Apr 2023 22:09:27 -0700 Subject: [PATCH 06/17] Fix test command --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ee78bdb7ef..9da28c46ab 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -26,4 +26,4 @@ jobs: python -m pip install --upgrade pip python -m pip install -e .[all] - name: Test with pytest - run: pytest + run: python -m pytest From e9a54eb4191e2e85e09cf7e0d27802b3b889240c Mon Sep 17 00:00:00 2001 From: Liren Tu Date: Tue, 18 Apr 2023 22:10:57 -0700 Subject: [PATCH 07/17] Add all group in setup.cfg --- setup.cfg | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/setup.cfg b/setup.cfg index 3729647b8d..bf1fed7721 100644 --- a/setup.cfg +++ b/setup.cfg @@ -51,6 +51,11 @@ embeddings = 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 +all = + dev + datalib + wandb + embeddings [options.entry_points] console_scripts = From 8088b2c347a0f7bc90446f24416863452c657bf1 Mon Sep 17 00:00:00 2001 From: Liren Tu Date: Tue, 18 Apr 2023 22:14:43 -0700 Subject: [PATCH 08/17] Remove all group --- .github/workflows/ci.yaml | 2 +- setup.cfg | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9da28c46ab..18e6810912 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,6 +24,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install -e .[all] + python -m pip install -e .[dev,datalib,wandb,embeddings] - name: Test with pytest run: python -m pytest diff --git a/setup.cfg b/setup.cfg index bf1fed7721..3729647b8d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -51,11 +51,6 @@ embeddings = 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 -all = - dev - datalib - wandb - embeddings [options.entry_points] console_scripts = From f6ff0dba41cd0cf936ead2d80ed5f28eba2db70d Mon Sep 17 00:00:00 2001 From: Liren Tu Date: Tue, 18 Apr 2023 22:19:48 -0700 Subject: [PATCH 09/17] Add open api key for testing --- .github/workflows/ci.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 18e6810912..75b548b32d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -27,3 +27,5 @@ jobs: python -m pip install -e .[dev,datalib,wandb,embeddings] - name: Test with pytest run: python -m pytest + env: + OPENAI_API_KEY: {{ secrets.OPENAI_API_KEY }} From 9025f4ba05cf1cdf7b0a95656eac1ff2777bc357 Mon Sep 17 00:00:00 2001 From: Liren Tu Date: Tue, 18 Apr 2023 22:21:01 -0700 Subject: [PATCH 10/17] Fix typo --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 75b548b32d..2e2d31b16e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -28,4 +28,4 @@ jobs: - name: Test with pytest run: python -m pytest env: - OPENAI_API_KEY: {{ secrets.OPENAI_API_KEY }} + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} From 3aebb9ef24dbeaa5ff6cd163284d792af2140274 Mon Sep 17 00:00:00 2001 From: Liren Tu Date: Tue, 18 Apr 2023 22:29:49 -0700 Subject: [PATCH 11/17] Set container --- .github/workflows/ci.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2e2d31b16e..df0c90c683 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,14 +7,16 @@ on: branches: [ "main" ] jobs: - build: - + test: runs-on: ubuntu-latest strategy: fail-fast: false matrix: python-version: ["3.7.1", "3.8", "3.9", "3.10", "3.11"] + container: + image: python:${{ matrix.python_version }} + steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} From 242826e6878861e3b0aa152d387e19ae4f1330a0 Mon Sep 17 00:00:00 2001 From: Liren Tu Date: Tue, 18 Apr 2023 22:33:10 -0700 Subject: [PATCH 12/17] Try alpine --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index df0c90c683..4413407e8a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,7 +15,7 @@ jobs: python-version: ["3.7.1", "3.8", "3.9", "3.10", "3.11"] container: - image: python:${{ matrix.python_version }} + image: python:${{ matrix.python_version }}-alpine steps: - uses: actions/checkout@v3 From 5ff09022574fb776f21ece85897659acacd3c728 Mon Sep 17 00:00:00 2001 From: Liren Tu Date: Tue, 18 Apr 2023 22:34:11 -0700 Subject: [PATCH 13/17] Fix typo --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4413407e8a..49eabb4544 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,7 +15,7 @@ jobs: python-version: ["3.7.1", "3.8", "3.9", "3.10", "3.11"] container: - image: python:${{ matrix.python_version }}-alpine + image: python:${{ matrix.python-version }}-alpine steps: - uses: actions/checkout@v3 From 4af4a1b6281156584683d034ed9ff5abd0425109 Mon Sep 17 00:00:00 2001 From: Liren Tu Date: Tue, 18 Apr 2023 22:35:18 -0700 Subject: [PATCH 14/17] Test image without alpine --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 49eabb4544..d987d5c643 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,7 +15,7 @@ jobs: python-version: ["3.7.1", "3.8", "3.9", "3.10", "3.11"] container: - image: python:${{ matrix.python-version }}-alpine + image: python:${{ matrix.python-version }} steps: - uses: actions/checkout@v3 From 90aa859fdef7b5f1273328aab4fda58e4c847b24 Mon Sep 17 00:00:00 2001 From: Liren Tu Date: Tue, 18 Apr 2023 22:36:38 -0700 Subject: [PATCH 15/17] Remove setup-python step --- .github/workflows/ci.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d987d5c643..c9c4c5497d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -19,10 +19,6 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip From c46adb5ab4814330e9db5387fc70fc20dff99b48 Mon Sep 17 00:00:00 2001 From: Liren Tu Date: Tue, 18 Apr 2023 22:58:34 -0700 Subject: [PATCH 16/17] Fix unit test --- openai/validators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openai/validators.py b/openai/validators.py index 078179a44b..8237bce731 100644 --- a/openai/validators.py +++ b/openai/validators.py @@ -423,7 +423,7 @@ def completions_space_start_validator(df): def add_space_start(x): x["completion"] = x["completion"].apply( - lambda x: ("" if x[0] == " " else " ") + x + lambda x: ("" if x == "" or x[0] == " " else " ") + x ) return x From 8c18ebfb55f2e948ac2136048452f0e04f9051f1 Mon Sep 17 00:00:00 2001 From: Liren Tu Date: Tue, 18 Apr 2023 23:06:02 -0700 Subject: [PATCH 17/17] Add comments about container --- .github/workflows/ci.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c9c4c5497d..32fd9730fb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,6 +14,10 @@ jobs: matrix: python-version: ["3.7.1", "3.8", "3.9", "3.10", "3.11"] + # This job sets up Python versions using Python images instead of + # actions/setup-python because Python 3.7.1 does not exist in + # the GitHub local cache. Once the support for Python 3.7.1 is + # dropped, this job can be simplified to use actions/setup-python. container: image: python:${{ matrix.python-version }}