-
Notifications
You must be signed in to change notification settings - Fork 907
Description
Dear ml5 community,
I'm submitting a new issue. Please see the details below.
→ Step 1: Describe the issue 📝
Did you find a bug? Want to suggest an idea for feature?
Suggesting an idea. Please let me know your thoughts! Feel free to tag anyone that you'd like to make sure sees this.
→ Step 2: Screenshots or Relevant Documentation 🖼
Here's some helpful screenshots and/or documentation of the new feature
Context:
I'm in the process of thinking about ways to simplify the devops process for the ml5 library, working with @joeyklee! Part of the process of getting to a simpler devops process is simplifying the development workflow overall. I think that consolidating these two repos may be a step towards a simpler development workflow.
There are few challenges with the current separation of repos:
- Difficulty coordinating the release of features and examples: Currently, the release of examples and features must be coordinated manually. For example, if I add a new GAN model to the core library, I'd need to have it launch in a new release of the core library and then subsequently update the examples repo. While developing a new feature for the ml5-library, it's typical to create a simple example to test out the functionality and ensure that it works anyway, so it'd likely be helpful to have a monorepo where examples and core functionality can be developed, tested, and released at the same time.
- Unclear Separation of Issues: Many of the issues that are submitted to the ml5-examples repo are related to bugs with core functionality in the library OR are asking for help on specific projects. Additionally, issues that are actually detailing problems with the examples are often fixed by improvements to the core library. Overall, this makes issue management a bit more challenging becuase problems/questions are duplicated. From a library user perspective, there's two sources of truth for information and support.
Proposed Approach:
- Create a new folder in the ml5-library repo called
examples/
. Inside of it, place the examples for each of the models inside, accounting for the pure JS and p5 versions of the examples (i.e.ml5-library/examples/p5js/FeatureExtractor/FeatureExtractor_Image_Classification/
).- Alternatively, example code could live in
ml5-library/src/UNET/examples/p5js/
and we could update the build system to collate only these directories into an examples distribution folder.
- Alternatively, example code could live in
- Create a new Netlify project to serve the examples online (e.g. examples.ml5js.org) and trigger builds when new changes are pushed to the release branch. If a build process is required for the examples, specify a build script for the examples in Netlify and tell Netlify to serve the resulting
dist_examples/
folder. - Optional/Extension: Setup the example HTML templates such that they point to the local
dist/
folder to reference the local development copy of the ml5-library to make it easier to do manual testing with the examples. See thread here for ideas.
I'll be submitting a few PRs to switch our examples away from referencing a specific version of the ml5 library via UNPKG, but if we want to continue to support specific version numbers in imports we could:
- Edit index.html files to use a template parameter when specifying the ml5 version in the src tag. See HTML-Webpack-Plugin documentation here.
- Update the build process to create a new
dist_examples/
folder which contains the processed examples code. Edit the build process to use the version of the core ml5-library specified in the package.json file (e.g. 0.4.3) to replace the HTML template parameters in the template HTML files.
Pros:
- Consolidating the ml5-library repo and the ml5-examples repo means that we remove an additional repo to handle in the devops workflow. Rather than needing to make updates to version numbers across two repos, we can focus on only a single large repo.
- Putting the examples in the core ml5-library repo potentially makes it easier to update examples as library features changes, while also keeping the release of these changes in sync. For example, if a function name gets deprecated in the core library, the example can be updated and merged into the development branch. Updates to the public examples website will only occur when the changes are merged into the release branch.
- If we want, this approach still allows us to maintain an explicitly specified version number within imports of the ml5 library used in examples.
- Remove GitHub Pages deployment from the overall DevOps workflow and centers everything around Netlify resources.
- Optional Extension: Putting examples in the core ml5-library repo could be used to improve the manual testing workflow. Build systems can be set up to allow people who are working on changes to the core library code to easily open the examples to verify that the changes haven’t caused any noticeable regressions in user-perceptible functionality.
Cons:
- There’s community, discussions, and history built up around the ml5-examples repo that may be lost/disrupted if we archive this repository
- Maintaining examples in the core library repo may add some bloat to the ml5-library development codebase and could also add more noise to the issues (i.e. more issues on the ml5-library repo about specific examples)
- People looking at the repo for the first time and hoping to copy the example HTML file from the GitHub may struggle with the Webpack template parameters in the example HTML file because they don’t know to replace it with a specific ml5 version.
- @joeyklee explains that most people are looking at this code through the web editor, so this will probably not be a major issue.