Skip to content

Comments

feat: treat empty run_id string as equivalent to None#1435

Merged
SAKURA-CAT merged 3 commits intomainfrom
feat/run-id-empty-as-none
Jan 30, 2026
Merged

feat: treat empty run_id string as equivalent to None#1435
SAKURA-CAT merged 3 commits intomainfrom
feat/run-id-empty-as-none

Conversation

@ShaohonChen
Copy link
Contributor

Description

This PR updates the handling of the id parameter in swanlab.init() and the SWANLAB_RUN_ID environment variable to treat empty strings ("") as equivalent to None.

🎯 PRs Should Target Issues

None

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @ShaohonChen, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the swanlab library by standardizing the treatment of empty strings for run IDs. It ensures that an empty string provided as a run ID is consistently interpreted as None, improving the robustness and predictability of ID validation within the swanlab.init function. The changes are supported by updated unit tests, confirming the intended behavior.

Highlights

  • Run ID Handling: The check_run_id_format function now explicitly treats an empty string ("") as equivalent to None when validating run IDs, aligning with the intent to simplify ID management.
  • Code Refactoring: The swanlab.init function has been refactored to call check_run_id_format earlier in its execution flow, ensuring consistent validation of the id parameter and removing a redundant check.
  • Test Updates: Unit tests have been updated to reflect the new behavior, specifically modifying test_run_id_format_empty_string to assert that an empty string run_id correctly results in None.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request successfully updates the logic to treat an empty run_id string as equivalent to None. The changes are well-implemented across the data SDK, formatter, and tests. The refactoring in swanlab/data/sdk.py simplifies the code, and the corresponding test case in test/unit/test_formatter.py is correctly updated. I have a minor suggestion to make the code in swanlab/formatter.py more idiomatic.

@SAKURA-CAT SAKURA-CAT merged commit 6f07a98 into main Jan 30, 2026
5 checks passed
@SAKURA-CAT SAKURA-CAT added the 💪 enhancement New feature or request label Jan 30, 2026
@SAKURA-CAT SAKURA-CAT deleted the feat/run-id-empty-as-none branch January 30, 2026 13:35
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

Successfully merging this pull request may close these issues.

2 participants