From 67de9c7a1c2f1b663bfec5c28f4b20e180d415ad Mon Sep 17 00:00:00 2001 From: Mathijs de Bruin Date: Fri, 25 Oct 2024 13:37:25 +0100 Subject: [PATCH] Build fixups (#1462) * (Ironically) ignore build script during package publication: - Avoids platform-specific wheels. - Ensures build script is not included in sdist. * Remove legacy Node package build, now that poetry is leading. * Run builds also for PR's to release branches. The road to hell is paved with dirty workarounds. --- .github/workflows/ci.yaml | 4 ++-- .github/workflows/publish.yaml | 3 +++ backend/README.md | 4 ++-- package.json | 3 +-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9f171f0aab..b2c6d7dda3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -4,9 +4,9 @@ on: workflow_call: workflow_dispatch: pull_request: - branches: [main, dev] + branches: [main, dev, 'release/**'] push: - branches: [main, dev] + branches: [main, dev, 'release/**'] permissions: read-all diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 6c6a0523b3..5e420edea9 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -34,6 +34,9 @@ jobs: name: Install Python, poetry and Python dependencies with: poetry-working-directory: ${{ env.BACKEND_DIR }} + - name: Build Python distribution + run: poetry self add poetry-plugin-ignore-build-script && poetry build --ignore-build-script + working-directory: ${{ env.BACKEND_DIR }} - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: diff --git a/backend/README.md b/backend/README.md index ffd682b9af..ab9aab12c1 100644 --- a/backend/README.md +++ b/backend/README.md @@ -18,7 +18,7 @@ Chainlit is an open-source async Python framework which allows developers to bui Full documentation is available [here](https://docs.chainlit.io). You can ask Chainlit related questions to [Chainlit Help](https://help.chainlit.io/), an app built using Chainlit! -> [!NOTE] +> [!NOTE] > Check out [Literal AI](https://literalai.com), our product to monitor and evaluate LLM applications! It works with any Python or TypeScript applications and [seamlessly](https://docs.chainlit.io/data-persistence/overview) with Chainlit by adding a `LITERAL_API_KEY` in your project. > > Chainlit is developed and maintained by the Literal AI team, which is currently focused on expanding the capabilities of Literal AI. While we continue to support and maintain Chainlit, we are also committed to enabling the community to contribute, particularly in areas like integrations and data layers. @@ -43,7 +43,7 @@ If this opens the `hello app` in your browser, you're all set! The latest in-development version can be installed straight from GitHub with: ```sh -pip install git+https://github.com/Chainlit/chainlit.git@dokterbob/build_frontend_on_poetry_build#subdirectory=backend/ +pip install git+https://github.com/Chainlit/chainlit.git#subdirectory=backend/ ``` (Requires Node and pnpm installed on the system.) diff --git a/package.json b/package.json index 24a3288f98..4d1d2b640a 100644 --- a/package.json +++ b/package.json @@ -25,8 +25,7 @@ "formatUi": "cd frontend && pnpm run format", "lintPython": "cd backend && poetry run mypy chainlit/ tests/", "formatPython": "black `git ls-files | grep '.py$'` && isort --profile=black .", - "buildUi": "cd libs/react-client && pnpm run build && cd ../copilot && pnpm run build && cd ../../frontend && pnpm run build", - "build": "pnpm run buildUi && (mkdir -p backend/chainlit/frontend && cp -R frontend/dist backend/chainlit/frontend) && (mkdir -p backend/chainlit/copilot && cp -R libs/copilot/dist backend/chainlit/copilot) && (cd backend && poetry build)" + "buildUi": "cd libs/react-client && pnpm run build && cd ../copilot && pnpm run build && cd ../../frontend && pnpm run build" }, "pnpm": { "overrides": {