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
Lite wheel optimization #7855
Lite wheel optimization #7855
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-builds.s3.amazonaws.com/8e8adcc3cbb3c875538e38b8eb151386fc081c1e/gradio-4.28.3-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@8e8adcc3cbb3c875538e38b8eb151386fc081c1e#subdirectory=client/python" |
🦄 change detectedThis Pull Request includes changes to the following packages.
With the following changelog entry.
Maintainers or the PR author can modify the PR title to modify this entry.
|
153384f
to
aef053f
Compare
Found that this step triggers building the package, including copying gradio/.github/actions/install-all-deps/action.yml Lines 77 to 83 in 72661e3
and these are needed by |
Now I think ignoring the |
40f7248
to
571823b
Compare
The functional test failed because this |
.github/workflows/publish.yml
Outdated
pnpm --filter @gradio/client --filter @gradio/lite build | ||
- name: Package Lite NPM package |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be better if the NPM package created in this step will be published in the following step as it's guaranteed that the NPM-published file is exactly same as what we can check from the uploaded artifacts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't we already building part of this in the install-deps
workflow above?
We should keep the builds together where possible, I think moving this tot he install deps action would make the most sense. Then we can have access to these assets in a variety of workflows if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean we should move pnpm pack
to this part building Lite in the install-frontend-deps
?
(Is it ok that the "install-*-deps" action is also responsible for building and packaging things which sounds not intuitive? ah, ok, the "deps" here includes js/*
packages which need to be built per run)
gradio/.github/actions/install-frontend-deps/action.yml
Lines 54 to 60 in 024b44c
- name: Build frontend lite | |
if: inputs.build_lite == 'true' | |
shell: bash | |
run: | | |
. venv/bin/activate | |
python -m pip install build | |
pnpm --filter @gradio/app build:lite |
.github/workflows/publish.yml
Outdated
@@ -3,6 +3,9 @@ on: | |||
push: | |||
branches: | |||
- main | |||
pull_request: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pngwn Do you think it's ok to run this workflow on each PR as we discussed (while it's now failing as https://github.com/gradio-app/gradio/actions/runs/8477858436/job/23229330151?pr=7855)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, we can only run the publish when we want to trigger the publish workflow, this will also fail for third part contributions as they won't have access to secrets. We need to expose the assets in one of the other workflows, the deploy space workflow is probably the most appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to expose the assets in one of the other workflows, the deploy space workflow is probably the most appropriate.
OK, so you mean
- to move
pnpm pack
to the install-deps action - and to use it from deploy-spaces workflow then expose the artifacts
?
(Same question: is it ok to add such steps to the deploy-space workflow without renaming it?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. And yeah it's fine to add it to the deploy space workflow without renaming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, so I applied the changes but pnpm pack
is not added to the install-deps action as it's now only needed in one place.
@whitphx is this ready to be reviewed or still a draft? |
@abidlabs Oh yes it's to be reviewed thanks, but not ready to merge: I want opinions about the comments above. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few comments that we need to address before we can merge this.
.github/workflows/publish.yml
Outdated
@@ -3,6 +3,9 @@ on: | |||
push: | |||
branches: | |||
- main | |||
pull_request: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, we can only run the publish when we want to trigger the publish workflow, this will also fail for third part contributions as they won't have access to secrets. We need to expose the assets in one of the other workflows, the deploy space workflow is probably the most appropriate.
.github/workflows/publish.yml
Outdated
pnpm --filter @gradio/client --filter @gradio/lite build | ||
- name: Package Lite NPM package |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't we already building part of this in the install-deps
workflow above?
We should keep the builds together where possible, I think moving this tot he install deps action would make the most sense. Then we can have access to these assets in a variety of workflows if needed.
06f4313
to
7b21225
Compare
eb89816
to
4a4f18d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to merge @whitphx !
650d9bd
to
d1c006e
Compare
This reverts commit d1c006e.
@pngwn Can you approve this PR if you are ok because the merge is blocked? |
…loy-spaces workflow so the frontend is built in it and frontend build is removed from the 'Build pr package' step
…ploy-spaces because they are done in the install-all-deps action
Removed some steps from the |
This reverts commit c812b12.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks @whitphx! Sorry for all the back and forth on this one!
* Add `pull_request.branches.main` as a trigger of the `publish` workflow * [WIP] Comment out the publish steps * Package and upload the NPM package for debug * Skip the copy_frontend.py hook in the Lite build * add changeset * [WIP] Show gradio files * [WIP] Show gradio files * Comment out installing the gradio and gradio_client libraries * Restore installing gradio_client because it's used by `python js/_website/generate_jsons/generate.py` that follows * Restore installing gradio because it's used by `python js/_website/generate_jsons/generate.py` that follows * Add code * Revert "[WIP] Show gradio files" This reverts commit e15fef2. * Build the gradio wheel with the custom lite target * add changeset * Revert "[WIP] Show gradio files" This reverts commit aef053f. * Revert "Skip the copy_frontend.py hook in the Lite build" This reverts commit ca296d0. * Update .github/actions/install-frontend-deps/action.yml for hatch installation * [WIP] Fix test-functional.yml and .github/actions/install-all-deps/action.yml to call the setup actions in this branch * Revert "[WIP] Fix test-functional.yml and .github/actions/install-all-deps/action.yml to call the setup actions in this branch" This reverts commit 571823b. * Comment-in lines in publish.yml * Move Lite build from publish.yml to deploy-spaces.yml * Use the build_lite option of install-all-deps instead of running the build command * [TMP] Change the branch of action files * Fix the hatch Lite build setting * Return pnpm pack to deploy-space * Revert "[TMP] Change the branch of action files" This reverts commit fe4e1c8. * Remove dependencies for lite build * [TMP] Change the branch of action files * Revert "Remove dependencies for lite build" This reverts commit 856a858. * Install packaging>=23.2 * [TMP] Show packaging version * Fix pip install * Fix * Uninstall packaging once * Use `pip install -U` instead of uninstalling the exiting version * Revert "[TMP] Show packaging version" This reverts commit 910b6bb. * Add `-U` flag * Set packaging version as >=23.2 * Revert the changes on pip install * Set packaging version as >=23.2 in requirements.txt * Revert "Set packaging version as >=23.2" This reverts commit 8aa77c8. * Fix hook name * Revert "Set packaging version as >=23.2 in requirements.txt" This reverts commit fbd605c. * Revert "Revert the changes on pip install" This reverts commit 81ff38a. * Add comments * Revert "[TMP] Change the branch of action files" This reverts commit 0d6aa48. * Revert the trigger of .github/workflows/deploy-spaces.yml * Remove unused `node_auth_token` and `npm_token` inputs from the `install-all-deps` action * [TMP] Trigger CI based on this PR * Remove packging installation * Revert "Remove packging installation" This reverts commit 4a4f18d. * Revert "[TMP] Trigger CI based on this PR" This reverts commit 6cea830. --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com> Co-authored-by: freddyaboulton <alfonsoboulton@gmail.com>
Description
Resolves #7853