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

Easy way to scrape local functions #685

Open
elijahbenizzy opened this issue Feb 8, 2024 · 0 comments
Open

Easy way to scrape local functions #685

elijahbenizzy opened this issue Feb 8, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@elijahbenizzy
Copy link
Collaborator

elijahbenizzy commented Feb 8, 2024

Can we get all fns that are defined in the local module and insert them into a driver?

Two workarounds for now:

  1. create_temporary_module
  2. __main__ hack
def foo() -> int:
    return 1


from hamilton import driver

if __name__ == '__main__':
    import __main__
    dr = driver.Builder().with_modules(__main__).build()
    print(dr.execute(["foo"]))

Thinking:

driver.Builder().with_local_modules().build()
driver.Builder().with_modules(hamilton.find_local()).build()
@elijahbenizzy elijahbenizzy added the enhancement New feature or request label Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant