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

Drivers Config Context Manager #1162

Merged
merged 1 commit into from
Sep 11, 2024
Merged

Conversation

collindutter
Copy link
Member

@collindutter collindutter commented Sep 9, 2024

Describe your changes

Added ability to use Drivers Configs as Context Managers for temporarily setting the default Drivers.

Issue ticket number and link

NA


📚 Documentation preview 📚: https://griptape--1162.org.readthedocs.build//1162/

@collindutter collindutter force-pushed the feature/driver-config-context branch 4 times, most recently from 6442f96 to ad0c28b Compare September 9, 2024 18:27
@collindutter collindutter marked this pull request as ready for review September 9, 2024 18:27
Copy link
Member

@vachillo vachillo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is cool. maybe the docs example be updated to show creating a custom DriversConfig and using that as a context manager?

Comment on lines 62 to 69
def __exit__(self, type, value, traceback) -> None: # noqa: ANN001, A002
from griptape.configs import Defaults

Defaults.drivers_config = self._old_drivers_config

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably should add self._old_drivers_config = None

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Copy link

codecov bot commented Sep 9, 2024

Codecov Report

Attention: Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
griptape/configs/drivers/base_drivers_config.py 91.66% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zachgiordano I think this example may be doing too much for what we're trying to illustrate.

What do you think about instead beefing up the existing custom example? @vachillo what do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds good to me

@collindutter collindutter force-pushed the feature/driver-config-context branch 2 times, most recently from a25bd38 to aaf4528 Compare September 9, 2024 20:00
vachillo
vachillo previously approved these changes Sep 9, 2024
dylanholmes
dylanholmes previously approved these changes Sep 11, 2024
Copy link
Contributor

@dylanholmes dylanholmes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Just what I needed!

@collindutter collindutter dismissed stale reviews from vachillo and dylanholmes via 64e0342 September 11, 2024 21:16
@collindutter collindutter force-pushed the feature/driver-config-context branch from 94453c7 to 64e0342 Compare September 11, 2024 21:16
@collindutter collindutter force-pushed the feature/driver-config-context branch from 64e0342 to 99e3b99 Compare September 11, 2024 21:24
@collindutter collindutter merged commit c6d2f9e into dev Sep 11, 2024
15 checks passed
@collindutter collindutter deleted the feature/driver-config-context branch September 11, 2024 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants