DSGT-DLP / Deep-Learning-Playground

Web Application where people new to Deep Learning can input a dataset and toy around with basic Pytorch modules without writing any code
MIT License
26 stars 8 forks source link

Sweep: implement depcheck as a github action #895

Closed karkir0003 closed 1 year ago

karkir0003 commented 1 year ago

Problem: We have instances where we install a frontend library with yarn, but then we don't actually end up using it in our code. We should try to keep our frontend package size as small as possible and keep only the essentials to make our builds run faster

Solution: Use depcheck to create a Github Action that validates that there are no frontend libraries in yarn.lock that really don't get used.

We currently don't have depcheck implemented. Your job is to implement it

Branch Setup:

git checkout nextjs
git pull origin nextjs
git checkout -b depcheck-sweep-action
sweep-ai[bot] commented 1 year ago

Here's the PR! https://github.com/DSGT-DLP/Deep-Learning-Playground/pull/900.

⚡ Sweep Free Trial: I used GPT-4 to create this ticket. You have 4 GPT-4 tickets left for the month and 2 for the day. For more GPT-4 tickets, visit our payment portal.To get Sweep to recreate this ticket, leave a comment prefixed with "sweep:" or edit the issue.


Step 1: 🔍 Code Search

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I looked at (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/DSGT-DLP/Deep-Learning-Playground/blob/2d8f3b88ceb218a735a9eb53ef9f1d46f26741ba/yarn.lock#L1-L2 https://github.com/DSGT-DLP/Deep-Learning-Playground/blob/2d8f3b88ceb218a735a9eb53ef9f1d46f26741ba/frontend/src/common/redux/userLogin.ts#L229-L426 https://github.com/DSGT-DLP/Deep-Learning-Playground/blob/2d8f3b88ceb218a735a9eb53ef9f1d46f26741ba/README.md#L1-L168 https://github.com/DSGT-DLP/Deep-Learning-Playground/blob/2d8f3b88ceb218a735a9eb53ef9f1d46f26741ba/frontend/src/pages/about.tsx#L112-L206 https://github.com/DSGT-DLP/Deep-Learning-Playground/blob/2d8f3b88ceb218a735a9eb53ef9f1d46f26741ba/README.md#L71-L159

Step 2: 🧐 Snippet Analysis

From looking through the relevant snippets, I decided to make the following modifications:

File Path Proposed Changes
.github/workflows/main.yml Add a new job for depcheck that runs depcheck on the frontend codebase.
README.md Add instructions on how to run depcheck locally and interpret the results.
package.json Add a new script for running depcheck locally.
.github/workflows/depcheck.yml Define the depcheck workflow with steps to install depcheck and run it on the frontend codebase.

Step 3: 📝 Planning

I have created a plan for writing the pull request. I am now working my plan and coding the required changes to address this issue. Here is the planned pull request:

Implement depcheck as a GitHub Action sweep/depcheck-sweep-action

Description

This PR implements depcheck as a GitHub Action in order to validate that there are no unused frontend libraries in the yarn.lock file. The goal is to reduce the package size and improve build times by removing unnecessary dependencies.

Summary of Changes

  • Added a new job for depcheck in the .github/workflows/main.yml file to run depcheck on the frontend codebase.
  • Created a new file, .github/workflows/depcheck.yml, to define the depcheck workflow with installation and execution steps.
  • Modified the README.md file to include instructions on running depcheck locally and interpreting the results.
  • Added a new script in the package.json file for running depcheck locally.

Please review and merge this PR to implement depcheck as a GitHub Action.


Step 4: ⌨️ Coding

File Instructions Progress
.github/workflows/main.yml Add a new job for depcheck that runs depcheck on the frontend codebase. ✅ Commit ffb8687
README.md Add instructions on how to run depcheck locally and interpret the results. ✅ Commit 0cce35a
package.json Add a new script for running depcheck locally. ✅ Commit 0cce35a
.github/workflows/depcheck.yml Define the depcheck workflow with steps to install depcheck and run it on the frontend codebase. ✅ Commit bbb7d3c I have finished coding the issue. I am now reviewing it for completeness.

Step 5: 🔁 Code Review

Here are the my self-reviews of my changes at sweep/depcheck-sweep-action_1.

Here is the 1st review

  • In the .github/workflows/main.yml file, there is a duplicate step for installing frontend dependencies. Please remove one of the duplicate steps.
  • Additionally, please ensure that all files end with a newline character. The .github/workflows/main.yml file is missing a newline character at the end.

I finished incorporating these changes.


To recreate the pull request, leave a comment prefixed with "sweep:" or edit the issue. Join Our Discord

karkir0003 commented 1 year ago

We currently don't have depcheck implemented. Your job is to implement it

karkir0003 commented 1 year ago

sweep: We currently don't have depcheck implemented. Your job is to implement it via github action. You don't need to reinvent depcheck from scratch (it's an existing library). You need to simply incorporate it in a new github action yml file