Skip to content

Python: allow settings to be created directly #11468

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

Merged
merged 9 commits into from
Apr 11, 2025

Conversation

eavanvalkenburg
Copy link
Member

Motivation and Context

I've always hated having to add the .create to a settings object, this removes that, you can just use the regular init, added benefit is that it has the proper fields in the docstrings for each implemented settings object!

Description

Adds a new method to the base settings class, which takes the prefix and if supplied the env_file and encoding, then calls model_rebuild and then the init.

Contribution Checklist

@eavanvalkenburg eavanvalkenburg requested a review from a team as a code owner April 9, 2025 13:31
@markwallace-microsoft markwallace-microsoft added python Pull requests for the Python Semantic Kernel memory labels Apr 9, 2025
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Apr 9, 2025

Python Unit Test Overview

Tests Skipped Failures Errors Time
3419 5 💤 0 ❌ 0 🔥 1m 31s ⏱️

Copy link
Contributor

@moonbox3 moonbox3 left a comment

Choose a reason for hiding this comment

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

Aside from "hating having to write .create()" what is driving the need to make this change right now?

Will there be an item to track updating the learn site with the new pattern?

@eavanvalkenburg eavanvalkenburg added this pull request to the merge queue Apr 10, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 10, 2025
@eavanvalkenburg eavanvalkenburg added this pull request to the merge queue Apr 10, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 10, 2025
@eavanvalkenburg eavanvalkenburg added this pull request to the merge queue Apr 10, 2025
github-merge-queue bot pushed a commit that referenced this pull request Apr 10, 2025
### Motivation and Context

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->
I've always hated having to add the .create to a settings object, this
removes that, you can just use the regular init, added benefit is that
it has the proper fields in the docstrings for each implemented settings
object!

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
Adds a __new__ method to the base settings class, which takes the prefix
and if supplied the env_file and encoding, then calls model_rebuild and
then the init.

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 10, 2025
@eavanvalkenburg eavanvalkenburg added this pull request to the merge queue Apr 10, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 10, 2025
@eavanvalkenburg eavanvalkenburg added this pull request to the merge queue Apr 10, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 10, 2025
@eavanvalkenburg eavanvalkenburg added this pull request to the merge queue Apr 10, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 10, 2025
@eavanvalkenburg eavanvalkenburg added this pull request to the merge queue Apr 10, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 10, 2025
@moonbox3 moonbox3 enabled auto-merge April 10, 2025 22:15
@moonbox3 moonbox3 added this pull request to the merge queue Apr 10, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 10, 2025
@moonbox3 moonbox3 added this pull request to the merge queue Apr 11, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 11, 2025
@eavanvalkenburg eavanvalkenburg added this pull request to the merge queue Apr 11, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 11, 2025
@eavanvalkenburg eavanvalkenburg added this pull request to the merge queue Apr 11, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 11, 2025
@eavanvalkenburg eavanvalkenburg added this pull request to the merge queue Apr 11, 2025
Merged via the queue into microsoft:main with commit 1285192 Apr 11, 2025
28 checks passed
@eavanvalkenburg eavanvalkenburg deleted the settings_wo_create branch April 11, 2025 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
memory python Pull requests for the Python Semantic Kernel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants