question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"ploomber scaffold" should create missing modules when scaffolding functions

See original GitHub issue

If ploomber scaffold finds a pipeline.yaml it checks all tasks[*].sources and creates files for all tasks whose source is missing. e.g.,

tasks:
    - source: some_module.some_function
      product: output.csv

If some_module.py exists, ploomber scaffold adds a function definition there. However, if it doesn’t, it fails.

Calling the command should create all necessary modules. Note that this could be a nested module. e.g.,

tasks:
    - source: some_module.submodule.function
      product: output.csv

This must create some_module/ (directory), some_module/__init__.py, and some_module/submodule.py, the call the already implemented logic to create a function inside some_module/submodule.py.

loader.create implements the file creation logic: https://github.com/ploomber/ploomber/blob/ac915ea998f4da0177204f2189f8f608f3404fc6/src/ploomber/scaffold/__init__.py#L42

add tests here: https://github.com/ploomber/ploomber/blob/master/tests/cli/test_scaffold.py

Tasks

  • Implement ‘skip’ logic to DAGSpec and TAskSpec: passing lazy_import='skip' should not perform any dotted paths validation and add tests with lazy_import='skip'
  • Implement ploomber scaffold feature that creates missing modules
  • Rename lazy_import flag (not sure about what would be a good name, maybe import_mode?)

Please open a PR with scaffold-functions as the base branch after finishing any of the three tasks above so we can review it and move to the next one.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:15 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
fferegrinocommented, Nov 30, 2021
1reaction
fferegrinocommented, Nov 22, 2021

Cool!

Read more comments on GitHub >

github_iconTop Results From Across the Web

User-Guide - Scaffolding projects - Ploomber documentation
This is a guide on ploomber scaffold . For API docs see Create new project. You can quickly create new projects using the...
Read more >
Release 0.21.8dev ploomber
You can quickly create new projects using the scaffold command: ... The ploomber.testing.sql module implements convenient functions to test your tables.
Read more >
Release 0.19.5dev ploomber
You can quickly create new projects using the scaffold command: ... The ploomber.testing.sql module implements convenient functions to test ...
Read more >
User-Guide - Jupyter integration - Ploomber documentation
The fastest way to get started is to use the ploomber scaffold command, which creates a base project, check out the guide to...
Read more >
User-Guide - Downloading templates - Ploomber documentation
Experiment grid + Mlflow: Create a grid of experiments and track them ... If no template suits your needs, use the ploomber scaffold...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found