Skip to content

Conversation

@Xuwznln
Copy link
Collaborator

@Xuwznln Xuwznln commented Oct 12, 2025

Summary by Sourcery

Standardize CI workflows to run all conda and pip operations within the unilab environment, remove auto-activating base, and enhance the verify_installation.py script with a new --auto-install mode and improved argument parsing.

Enhancements:

  • Add --auto-install option to the installation verification script and propagate the flag to environment checks
  • Standardize conda commands in CI workflows to explicitly target the unilab environment with -n unilab and use conda run for pip/python invocations

CI:

  • Remove auto-activate-base and update the GitHub Actions conda-pack-build workflow to specify the unilab environment for install, list, update, and verification steps

Chores:

  • Clean up and reorder imports in unilabos/app/main.py
  • Improve type annotations in verify_installation.py

TablewareBox and others added 30 commits August 3, 2025 11:21
* delete deprecated mock devices

* rename categories

* combine chromatographic devices

* rename rviz simulation nodes

* organic virtual devices

* parse vessel_id

* run registry completion before merge

---------

Co-authored-by: Xuwznln <[email protected]>
feat: report publish topic when error
fix: startup slow
Xuwznln and others added 26 commits October 11, 2025 03:38
Update conda-pack-build.yml
Add create_zip_archive.py
* Add LaiYu Liquid device integration and tests

Introduce LaiYu Liquid device implementation, including backend, controllers, drivers, configuration, and resource files. Add hardware connection, tip pickup, and simplified test scripts, as well as experiment and registry configuration for LaiYu Liquid. Documentation and .gitignore for the device are also included.

* feat(LaiYu_Liquid): 重构设备模块结构并添加硬件文档

refactor: 重新组织LaiYu_Liquid模块目录结构
docs: 添加SOPA移液器和步进电机控制指令文档
fix: 修正设备配置中的最大体积默认值
test: 新增工作台配置测试用例
chore: 删除过时的测试脚本和配置文件

* add

* 重构: 将 LaiYu_Liquid.py 重命名为 laiyu_liquid_main.py 并更新所有导入引用

- 使用 git mv 将 LaiYu_Liquid.py 重命名为 laiyu_liquid_main.py
- 更新所有相关文件中的导入引用
- 保持代码功能不变,仅改善命名一致性
- 测试确认所有导入正常工作

* 修复: 在 core/__init__.py 中添加 LaiYuLiquidBackend 导出

- 添加 LaiYuLiquidBackend 到导入列表
- 添加 LaiYuLiquidBackend 到 __all__ 导出列表
- 确保所有主要类都可以正确导入

* 修复大小写文件夹名字
* Update prcxi driver & fix transfer_liquid mix_times

* fix: correct mix_times type

* Update liquid_handler registry

* test: prcxi.py
add auto install during one-key installation
@sourcery-ai
Copy link

sourcery-ai bot commented Oct 12, 2025

Reviewer's Guide

This PR revises the GitHub Actions conda-pack workflow to explicitly target the “unilab” environment by adding environment flags to all install, update, and listing commands; enhances the local verification script with an argparse-driven --auto-install mode, improved type hints, and user guidance; and refactors import ordering in the main app entry point for clarity.

Sequence diagram for enhanced verification with --auto-install option

sequenceDiagram
    participant User as actor User
    participant Script as verify_installation.py
    participant Argparse as argparse
    participant EnvCheck as check_environment
    User->>Script: Run script with [--auto-install]
    Script->>Argparse: Parse arguments
    Argparse-->>Script: args.auto_install
    Script->>Script: Print mode (auto-install or verify only)
    Script->>EnvCheck: check_environment(auto_install=args.auto_install)
    EnvCheck-->>Script: Result (pass/fail)
    Script->>User: Print verification result
    Note over Script,User: If missing packages and not auto-install, print hint to use --auto-install
Loading

Class diagram for updated verify_installation.py script

classDiagram
    class verify_installation {
        +main()
    }
    class argparse {
        +ArgumentParser
        +add_argument()
        +parse_args()
    }
    class check_environment {
        +check_environment(auto_install: bool, show_details: bool)
    }
    verify_installation --> argparse : uses
    verify_installation --> check_environment : calls
Loading

File-Level Changes

Change Details Files
Explicitly target the “unilab” conda environment in the CI workflow
  • Removed auto-activate-base flag
  • Added “-n unilab” to mamba install and update commands
  • Prefixed conda list/search and pip steps with environment flags or conda run
.github/workflows/conda-pack-build.yml
Enhance verification script with auto-install option and type annotations
  • Introduced argparse with --auto-install flag
  • Propagated args.auto_install to environment checks and added user hint
  • Updated type hint for union types and added # type: ignore comments
  • Documented new option in script usage
scripts/verify_installation.py
Refactor imports in application entrypoint for modularization
  • Removed unused top-level imports
  • Moved graphio and resource_tracker imports inside main()
  • Reordered config imports after path setup
unilabos/app/main.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `scripts/verify_installation.py:136-140` </location>
<code_context>
def main():
    """Run all verification checks."""
    # Parse command line arguments
    parser = argparse.ArgumentParser(
        description="Verify UniLabOS installation",
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    parser.add_argument(
        "--auto-install",
        action="store_true",
        help="Automatically install missing packages",
    )
    args = parser.parse_args()

    print("=" * 60)
    print("UniLabOS Installation Verification")
    print("=" * 60)
    if args.auto_install:
        print("Mode: Auto-install missing packages")
    else:
        print("Mode: Verification only")
    print()

    all_passed = True

    # Check Python version
    print("Checking Python version...")
    if not check_python_version():
        all_passed = False
    print()

    # Check ROS2 rclpy
    print("Checking ROS2 rclpy...")
    if not check_package("rclpy", "ROS2 rclpy"):
        all_passed = False
    print()

    # Run environment checker from unilabos
    print("Checking UniLabOS and dependencies...")
    try:
        from unilabos.utils.environment_check import check_environment

        print(f"  {CHECK_MARK} UniLabOS installed")

        # Check environment with optional auto-install
        # Set show_details=False to suppress detailed Chinese output that may cause encoding issues
        env_check_passed = check_environment(auto_install=args.auto_install, show_details=False)

        if env_check_passed:
            print(f"  {CHECK_MARK} All required packages available")
        else:
            print(f"  {CROSS_MARK} Some optional packages are missing")
            if not args.auto_install:
                print("  Hint: Run with --auto-install to automatically install missing packages")
    except ImportError:
        print(f"  {CROSS_MARK} UniLabOS not installed")
        all_passed = False
    except Exception as e:
        print(f"  {CROSS_MARK} Environment check failed: {str(e)}")
    print()

    # Summary
    print("=" * 60)
    print("Verification Summary")
    print("=" * 60)

    if all_passed:
        print(f"\n{CHECK_MARK} All checks passed! Your UniLabOS installation is ready.")
        print("\nNext steps:")
        print("  1. Review the documentation: docs/user_guide/launch.md")
        print("  2. Try the examples: docs/boot_examples/")
        print("  3. Configure your devices: unilabos_data/startup_config.json")
        return 0
    else:
        print(f"\n{CROSS_MARK} Some checks failed. Please review the errors above.")
        print("\nTroubleshooting:")
        print("  1. Ensure you're in the correct conda environment: conda activate unilab")
        print("  2. Check the installation documentation: docs/user_guide/installation.md")
        print("  3. Try reinstalling: pip install .")
        return 1

</code_context>

<issue_to_address>
**suggestion (code-quality):** Use named expression to simplify assignment and conditional ([`use-named-expression`](https://docs.sourcery.ai/Reference/Default-Rules/refactorings/use-named-expression/))

```suggestion
        if env_check_passed := check_environment(
            auto_install=args.auto_install, show_details=False
        ):
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Xuwznln Xuwznln closed this Oct 12, 2025
@Xuwznln Xuwznln deleted the dev-test branch October 12, 2025 17:59
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.

9 participants