Skip to content
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

Initialize hooks in Jupyter notebooks #33

Closed
mtrivedi50 opened this issue Aug 31, 2023 · 0 comments · Fixed by #39
Closed

Initialize hooks in Jupyter notebooks #33

mtrivedi50 opened this issue Aug 31, 2023 · 0 comments · Fixed by #39
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@mtrivedi50
Copy link
Contributor

Is your feature request related to a problem? Please describe.
When developing task code, users may want to experiment and test the code in a Jupyter notebook prior to running it in the project. This enables a faster development feedback loop (i.e., users can rapidly test iterations of code in a notebook rather than modifying and re-running tasks after every change).

Describe the solution you'd like
I'd like to add a function initialize_hooks() that works as follows:

  • When inside a Prism project directory, the initialize_hooks function parses the prism_project.py file for a profile. If a profile doesn't exist, then it throws an error. If a profile does exist, then it parses the profile
  • After parsing the profile, the function instantiates all the adapters contained therein.
  • The hooks function should return an instance of the prism.infra.hooks.PrismHooks class. Users can use the methods of this class in their Jupyter notebook.
  • Here's what the function definition should look like
def initialize_hooks(project_dir: Optional[Path] = None):
    """
    Initialize hooks within a Prism project

    args:
        project_dir: Prism project directory. If `None`, then assume the current working
            directory is inside a Prism project. Default is `None`
    returns:
        hooks: instance of prism.infra.hooks.PrismHooks class
    """
  • Here's what the output should look like in a notebook:
image

Describe alternatives you've considered
N/A - open to hearing suggestions!

Additional context
This shouldn't require a ton of net-new code. The assignee should be able to accomplish this with a lot of the existing classes and structures.

@mtrivedi50 mtrivedi50 added enhancement New feature or request good first issue Good for newcomers labels Aug 31, 2023
@mtrivedi50 mtrivedi50 linked a pull request Oct 26, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant