From c18acf77ce11a025ce195f20f8bbdd4c36dec542 Mon Sep 17 00:00:00 2001 From: Darin <86675935+darinkishore@users.noreply.github.com> Date: Fri, 22 Dec 2023 16:08:29 -0800 Subject: [PATCH 1/8] feat: add GitHub Actions workflow to build the package This commit adds a new GitHub Actions workflow file, `build_package.yml`, which is responsible for building the package. The workflow is triggered on pushes to the `main` branch and pull requests. It runs on the latest version of Ubuntu. The workflow uses Poetry version 1.6.1. It sets up the Python environment using the specified Python version (3.9 in this case). It also caches the Poetry installation and the virtual environment to improve build times. The workflow installs the project dependencies using Poetry and then builds the package. It also tests installing the built package and tests importing the package. The commit also includes the addition of a `pyproject.toml` file. This file specifies the build system requirements, project metadata, Python version compatibility, and project dependencies. The dependencies include various packages such as `backoff`, `joblib`, `openai`, `pandas`, `regex`, `ujson`, `tqdm`, `datasets`, `requests`, and `optuna`. Optional dependencies are also specified for packages like `pinecone-client`, `qdrant-client`, `fastembed`, `chromadb`, and `marqo`. Additionally, there are dependencies for building the documentation using Sphinx. The `pyproject.toml` file also includes project metadata such as the project name, version, description, authors, license, and homepage. The purpose of these changes is to automate the package build process and specify the project dependencies and metadata in a standardized way. --- .github/workflows/build_package.yml | 57 ++++++++++++++ pyproject.toml | 117 ++++++++++++++++++++++++++++ 2 files changed, 174 insertions(+) create mode 100644 .github/workflows/build_package.yml create mode 100644 pyproject.toml diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml new file mode 100644 index 0000000000..23fc4b28f9 --- /dev/null +++ b/.github/workflows/build_package.yml @@ -0,0 +1,57 @@ +name: Build Package + +# Build package on its own without additional pip install + +on: + push: + branches: + - main + pull_request: + +env: + POETRY_VERSION: "1.6.1" + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.9"] + steps: + - uses: actions/checkout@v3 + - name: Set up python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Load cached Poetry installation + id: cached-poetry + uses: actions/cache@v3 + with: + path: ~/.local # the path depends on the OS + key: poetry-0 # increment to reset cache + - name: Install Poetry + if: steps.cached-poetry.outputs.cache-hit != 'true' + uses: snok/install-poetry@v1 + - name: Load cached venv + id: cached-poetry-dependencies + uses: actions/cache@v3 + with: + path: .venv + key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} + - name: Install dependencies + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + run: poetry install --no-root + - name: Debug + run: | + pwd + ls -la + - name: Build + shell: bash + run: poetry build + - name: Test installing built package + shell: bash + run: python -m pip install . + - name: Test import + shell: bash + working-directory: ${{ vars.RUNNER_TEMP }} + run: python -c "import dspy" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000000..945bd5dd75 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,117 @@ +[build-system] +requires = ["setuptools>=40.8.0", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "dspy-ai" +version = "2.0.8" +description = "DSPy" +readme = "README.md" +authors = [{name = "Omar Khattab", email = "okhattab@stanford.edu"}] +license = {text = "MIT License"} +requires-python = ">=3.9, <3.12" +classifiers = [ + "Development Status :: 3 - Alpha", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: MIT License", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python :: 3", # removed 3.8 + "Programming Language :: Python :: 3.9", +] +dependencies = [ + "backoff~=2.2.1", + "joblib~=1.3.2", + "openai~=0.28.1", + "pandas~=2.1.1", + "regex~=2023.10.3", + "ujson~=5.8.0", + "tqdm~=4.66.1", + "datasets~=2.14.6", + "requests~=2.31.0", + "optuna~=3.4.0", +] + +[project.optional-dependencies] +pinecone = ["pinecone-client~=2.2.4"] +qdrant = ["qdrant-client~=1.6.2", "fastembed~=0.1.0"] +chromadb = ["chromadb~=0.4.14"] +marqo = ["marqo"] +docs = [ + "sphinx>=4.3.0", + "furo>=2023.3.27", + "docutils<0.17", + "m2r2", + "myst-parser", + "myst-nb", + "sphinx-autobuild", + "sphinx_rtd_theme", + "pydantic<2.0.0", + "autodoc_pydantic", + "sphinx-reredirects>=0.1.2", + "sphinx-automodapi==0.16.0" +] + +[project.urls] +homepage = "https://github.com/stanfordnlp/dsp" + +[tool.poetry] +name = "dspy" +version = "2.0.8" +description = "DSPy" +authors = ["Omar Khattab "] +license = "MIT" +readme = "README.md" +homepage = "https://github.com/stanfordnlp/dsp" +documentation = "https://dspy-ai.readthedocs.io" +repository = "https://github.com/stanfordnlp/dsp" +keywords = ["dsp", "ai", "signal processing"] + +[tool.poetry.dependencies] +python = ">=3.9,<3.12" +backoff = "^2.2.1" +joblib = "^1.3.2" +openai = "^0.28.1" +pandas = "^2.1.1" +regex = "^2023.10.3" +ujson = "^5.8.0" +tqdm = "^4.66.1" +datasets = "^2.14.6" +requests = "^2.31.0" +optuna = "^3.4.0" +pinecone-client = {version = "^2.2.4", optional = true} +qdrant-client = {version = "^1.6.2", optional = true} +fastembed = {version = "^0.1.0", optional = true} +chromadb = {version = "^0.4.14", optional = true} +marqo = {version = "*", optional = true} +sphinx = {version = ">=4.3.0", optional = true} +furo = {version = ">=2023.3.27", optional = true} +docutils = {version = "<0.17", optional = true} +m2r2 = {version = "*", optional = true} +myst-parser = {version = "*", optional = true} +myst-nb = {version = "*", optional = true} +sphinx-autobuild = {version = "*", optional = true} +sphinx_rtd_theme = {version = "*", optional = true} +pydantic = {version = "*", optional = true} +autodoc_pydantic = {version = "*", optional = true} +sphinx-reredirects = {version = "^0.1.2", optional = true} +sphinx-automodapi = {version = "0.16.0", optional = true} + +[tool.poetry.extras] +pinecone = ["pinecone-client"] +qdrant = ["qdrant-client", "fastembed"] +chromadb = ["chromadb"] +marqo = ["marqo"] +docs = [ + "sphinx", + "furo", + "docutils", + "m2r2", + "myst-parser", + "myst-nb", + "sphinx-autobuild", + "sphinx_rtd_theme", + "pydantic", + "autodoc_pydantic", + "sphinx-reredirects", + "sphinx-automodapi" +] \ No newline at end of file From e29eac9a12bef6feea361f9f16aca17408563077 Mon Sep 17 00:00:00 2001 From: Darin <86675935+darinkishore@users.noreply.github.com> Date: Fri, 22 Dec 2023 16:12:21 -0800 Subject: [PATCH 2/8] chore(build_package.yml): remove debug step from the workflow --- .github/workflows/build_package.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index 23fc4b28f9..cbbee86667 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml @@ -41,10 +41,6 @@ jobs: - name: Install dependencies if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' run: poetry install --no-root - - name: Debug - run: | - pwd - ls -la - name: Build shell: bash run: poetry build From fa3f075bc40319a7ebe647e41a529e7c0e1453d1 Mon Sep 17 00:00:00 2001 From: Darin <86675935+darinkishore@users.noreply.github.com> Date: Fri, 22 Dec 2023 16:17:49 -0800 Subject: [PATCH 3/8] chore(build_package.yml): remove caching of Poetry installation and venv to simplify workflow and improve reliability fix(build_package.yml): fix missing newline at end of file to adhere to coding conventions --- .github/workflows/build_package.yml | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index cbbee86667..062eb7bf71 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml @@ -23,23 +23,9 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - name: Load cached Poetry installation - id: cached-poetry - uses: actions/cache@v3 - with: - path: ~/.local # the path depends on the OS - key: poetry-0 # increment to reset cache - name: Install Poetry - if: steps.cached-poetry.outputs.cache-hit != 'true' uses: snok/install-poetry@v1 - - name: Load cached venv - id: cached-poetry-dependencies - uses: actions/cache@v3 - with: - path: .venv - key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} - name: Install dependencies - if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' run: poetry install --no-root - name: Build shell: bash @@ -50,4 +36,4 @@ jobs: - name: Test import shell: bash working-directory: ${{ vars.RUNNER_TEMP }} - run: python -c "import dspy" + run: python -c "import dspy" \ No newline at end of file From 73f1161d41a89c42b61c2e61ee33c464459f7936 Mon Sep 17 00:00:00 2001 From: Darin <86675935+darinkishore@users.noreply.github.com> Date: Fri, 22 Dec 2023 16:18:05 -0800 Subject: [PATCH 4/8] chore(build_package.yml): add newline at the end of the file for consistency with other files in the repository --- .github/workflows/build_package.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index 062eb7bf71..b77651c495 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml @@ -36,4 +36,5 @@ jobs: - name: Test import shell: bash working-directory: ${{ vars.RUNNER_TEMP }} - run: python -c "import dspy" \ No newline at end of file + run: python -c "import dspy" + \ No newline at end of file From aaca529ad76fcd54d15f8297cbd2ca00b7ddde40 Mon Sep 17 00:00:00 2001 From: Darin <86675935+darinkishore@users.noreply.github.com> Date: Sat, 6 Jan 2024 22:11:52 +0000 Subject: [PATCH 5/8] Update build_package.yml --- .github/workflows/build_package.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index b77651c495..138e421580 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml @@ -33,8 +33,12 @@ jobs: - name: Test installing built package shell: bash run: python -m pip install . - - name: Test import + - name: Test import dspy shell: bash working-directory: ${{ vars.RUNNER_TEMP }} run: python -c "import dspy" - \ No newline at end of file + - name: Test import dsp + shell: bash + working-directory: ${{ vars.RUNNER_TEMP }} + run: python -c "import dsp" + From 64ac9c2a6256349e77a1e0d4a6b7f5b251cc8e40 Mon Sep 17 00:00:00 2001 From: Darin <86675935+darinkishore@users.noreply.github.com> Date: Sat, 6 Jan 2024 22:15:08 +0000 Subject: [PATCH 6/8] Update pyproject.toml --- pyproject.toml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 945bd5dd75..04acd7ccab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,7 +52,7 @@ docs = [ ] [project.urls] -homepage = "https://github.com/stanfordnlp/dsp" +homepage = "https://github.com/stanfordnlp/dspy" [tool.poetry] name = "dspy" @@ -61,10 +61,12 @@ description = "DSPy" authors = ["Omar Khattab "] license = "MIT" readme = "README.md" -homepage = "https://github.com/stanfordnlp/dsp" -documentation = "https://dspy-ai.readthedocs.io" -repository = "https://github.com/stanfordnlp/dsp" -keywords = ["dsp", "ai", "signal processing"] +homepage = "https://github.com/stanfordnlp/dspy" +repository = "https://github.com/stanfordnlp/dspy" +# documentation = "https://dspy-ai.readthedocs.io" +keywords = ["dspy", "ai", "language models", "llm", "openai", "huggingface", "RAG", "retrieval", "llama", "optimization", "pytorch", "autogen"] +# may be a bit much + [tool.poetry.dependencies] python = ">=3.9,<3.12" @@ -114,4 +116,4 @@ docs = [ "autodoc_pydantic", "sphinx-reredirects", "sphinx-automodapi" -] \ No newline at end of file +] From 3af177689e39ebd493152bfb52a5a30875063ee5 Mon Sep 17 00:00:00 2001 From: Omar Khattab Date: Fri, 12 Jan 2024 16:40:33 -0800 Subject: [PATCH 7/8] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 04acd7ccab..e8d0770cc3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "dspy-ai" -version = "2.0.8" +version = "2.1.1" description = "DSPy" readme = "README.md" authors = [{name = "Omar Khattab", email = "okhattab@stanford.edu"}] From 7e91442a303dd7a901bc9eab885ad5b3b46c91a7 Mon Sep 17 00:00:00 2001 From: Omar Khattab Date: Fri, 12 Jan 2024 16:41:49 -0800 Subject: [PATCH 8/8] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e8d0770cc3..ac712706d6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,7 +64,7 @@ readme = "README.md" homepage = "https://github.com/stanfordnlp/dspy" repository = "https://github.com/stanfordnlp/dspy" # documentation = "https://dspy-ai.readthedocs.io" -keywords = ["dspy", "ai", "language models", "llm", "openai", "huggingface", "RAG", "retrieval", "llama", "optimization", "pytorch", "autogen"] +keywords = ["dspy", "ai", "language models", "llm", "openai"] # may be a bit much