Level 5 / Project 05 - Plugin Style Transformer¶
Home: README
Learn Your Way¶
| Read | Build | Watch | Test | Review | Visualize | Try |
|---|---|---|---|---|---|---|
| — | This project | — | — | Flashcards | — | Browser |
Estimated time: 70 minutes
Focus¶
- extensible transform dispatch
Why this project exists¶
This project gives you level-appropriate practice in a realistic operations context. Goal: run the baseline, alter behavior, break one assumption, recover safely, and explain the fix.
Run (copy/paste)¶
Use <repo-root> as the folder containing this repository's README.md.
cd <repo-root>/projects/level-5/05-plugin-style-transformer
python project.py --input data/sample_input.json --output data/transformed.json --plugins uppercase,trim_whitespace,add_timestamp
pytest -q
Expected terminal output¶
Expected artifacts¶
data/transformed.json- Passing tests
- Updated
notes.md
Checkpoint: Baseline code runs and all tests pass. Commit your work before continuing.
Alter it (required) — Extension¶
- Write a new plugin class that reverses string values and register it in the registry.
- Add a
--list-pluginsflag that prints all registered plugin names and exits. - Add execution order tracking so each record shows which plugins were applied.
- Re-run script and tests.
Break it (required) — Core¶
- Request a plugin name that does not exist in the registry (e.g.
--plugins nonexistent). - Pass an input file where a record is missing the fields your plugins expect.
- Capture the first failing test or visible bad output.
Fix it (required) — Core¶
- Raise a clear error listing available plugins when a requested one is not found.
- Make plugins skip fields that are missing rather than crashing.
- Add tests for unknown plugin names and missing fields.
- Re-run until output and tests are deterministic.
Checkpoint: All modifications done, tests still pass. Good time to review your changes.
Explain it (teach-back)¶
- How does the plugin registry pattern decouple new transforms from the core pipeline?
- What is the role of the
TransformPluginbase class? - Why does
apply_pluginsiterate plugins in order? - Where do you see plugin architectures in real systems (webpack, pytest, Flask extensions)?
Mastery check¶
You can move on when you can: - run baseline without docs, - explain one core function line-by-line, - break and recover in one session, - keep tests passing after your change.
Related Concepts¶
Stuck? Ask AI¶
If you are stuck after trying for 20 minutes, use one of these prompts:
- "I am working on Plugin Style Transformer. I got this error: [paste error]. Can you explain what this error means without giving me the fix?"
- "I am trying to build a plugin system where new transforms can be registered without modifying existing code. Can you explain the registry pattern with a simple example?"
- "Can you explain how to use a dictionary to dispatch different functions based on a string key?"
| ← Prev | Home | Next → |
|---|---|---|