Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.

Faster#411

Merged
NickCao merged 7 commits intomainfrom
faster
Apr 17, 2025
Merged

Faster#411
NickCao merged 7 commits intomainfrom
faster

Conversation

@NickCao
Copy link
Copy Markdown
Collaborator

@NickCao NickCao commented Apr 17, 2025

Summary by CodeRabbit

  • Refactor
    • Streamlined and reorganized import statements across multiple modules and packages for improved modularity and clarity.
    • Updated code examples and documentation to reflect new import paths.
    • Removed top-level exports from several package modules, requiring direct imports from submodules.
  • New Features
    • Introduced new synchronous and asynchronous context managers for environment-based client creation.
  • Bug Fixes
    • None.
  • Documentation
    • Updated documentation and README files to use the new import paths in code examples.
  • Chores
    • Removed redundant or obsolete code and exports from several modules.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 17, 2025

Walkthrough

This change refactors import statements across numerous modules, scripts, and documentation files throughout the codebase. Imports are updated to reference more granular submodules, removing broad or aggregated imports from higher-level modules. Several __init__.py files are cleared of their previous re-exports, eliminating top-level exports and requiring direct imports from submodules. Additionally, the env context manager is moved from jumpstarter.common.utils to a new jumpstarter.utils.env module, with documentation and test files updated accordingly. No functional logic or control flow is altered; only import paths and module boundaries are reorganized.

Changes

Files / Paths Change Summary
jumpstarter_cli_common/__init__.py, jumpstarter/jumpstarter/config/__init__.py, jumpstarter/jumpstarter/streams/__init__.py, jumpstarter_cli/__init__.py Removed all contents and exports from these __init__.py files; modules no longer re-export any entities.
jumpstarter_cli_admin/*.py, jumpstarter_cli_driver/*.py, jumpstarter_cli/*.py, jumpstarter_kubernetes/*.py, jumpstarter/jumpstarter/config/*.py, jumpstarter/jumpstarter/driver/base.py, jumpstarter/jumpstarter/exporter/session.py, jumpstarter/jumpstarter/client/base.py, jumpstarter/jumpstarter/client/core.py, jumpstarter/jumpstarter/common/streams.py Refactored import statements to use explicit submodule imports instead of top-level or aggregated imports.
jumpstarter/jumpstarter/common/utils.py Removed env and env_async context managers; now imports and re-exports env from jumpstarter.utils.env.
jumpstarter/jumpstarter/utils/env.py New module providing env_async and env context managers for client creation based on environment variables.
jumpstarter-driver-network/adapters/novnc.py, jumpstarter-driver-network/adapters/portforward.py Changed import of forward_stream to reference jumpstarter.streams.common.
Documentation files (docs/source/api-reference/drivers/dbus.md, proxy.md, README.md in various driver packages) Updated import examples for ExporterConfigV1Alpha1DriverInstance to use the new submodule import path.
Test files (*_test.py) Updated imports to use explicit submodule paths for configuration and common entities.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant EnvContext (jumpstarter.utils.env)
    participant Client

    User->>EnvContext: enter env() context manager
    EnvContext->>EnvContext: Read JUMPSTARTER_HOST from environment
    EnvContext->>EnvContext: Get permission flags (_allow_from_env)
    EnvContext->>Client: Create client from host/path
    EnvContext-->>User: yield Client
    User->>EnvContext: exit env() context manager
    EnvContext->>Client: Close client (if needed)
Loading

Possibly related PRs

Suggested reviewers

  • mangelajo
  • kirkbrauer

Poem

In the warren where imports roam,
Each bunny hops to their submodule home.
No more exports from the burrow’s gate,
Now every path is up-to-date!
The env is fresh, the streams are clear,
Refactored code—spring’s finally here!
🐇✨

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4cf4e48 and 2004d3f.

📒 Files selected for processing (1)
  • packages/jumpstarter/conftest.py (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/jumpstarter/conftest.py
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: e2e
  • GitHub Check: pytest-matrix (3.13)
  • GitHub Check: pytest-matrix (3.12)
  • GitHub Check: pytest-matrix (3.11)
  • GitHub Check: build-and-push-image (jumpstarter-dev/jumpstarter-utils Dockerfile.utils)
  • GitHub Check: build-and-push-image (jumpstarter-dev/jumpstarter Dockerfile)
  • GitHub Check: build-and-push-image (jumpstarter-dev/jumpstarter-dev .devfile/Containerfile)
  • GitHub Check: build-and-push-image (jumpstarter-dev/jumpstarter-devspace .devfile/Containerfile.client)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 17, 2025

Deploy Preview for jumpstarter-docs ready!

Name Link
🔨 Latest commit 5d0ded7
🔍 Latest deploy log https://app.netlify.com/sites/jumpstarter-docs/deploys/68013d0ca7dab60008aa2ea6
😎 Deploy Preview https://deploy-preview-411--jumpstarter-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
packages/jumpstarter/jumpstarter/utils/env.py (1)

11-32: Good implementation of async context manager.

The env_async implementation correctly handles:

  • Environment variable checking with clear error messaging
  • Permission handling via _allow_from_env()
  • Proper resource cleanup in the finally block
  • Well-documented function purpose

Consider adding type hints to the function parameters and return type for better code maintainability.

-async def env_async(portal, stack):
+async def env_async(portal: BlockingPortal, stack: ExitStack):
packages/jumpstarter-kubernetes/jumpstarter_kubernetes/exporters.py (1)

12-13: Modularized configuration imports
Imports now come directly from jumpstarter.config.common and jumpstarter.config.exporter instead of the aggregated jumpstarter.config, improving clarity and reducing namespace noise.

Consider aliasing the imported ObjectMeta (e.g., from jumpstarter.config.common import ObjectMeta as ConfigObjectMeta) to distinguish it from V1ObjectMeta and avoid potential confusion.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 38c41ea and 4cf4e48.

📒 Files selected for processing (48)
  • conftest.py (1 hunks)
  • docs/source/api-reference/drivers/dbus.md (1 hunks)
  • docs/source/api-reference/drivers/proxy.md (1 hunks)
  • packages/jumpstarter-cli-admin/jumpstarter_cli_admin/__init__.py (1 hunks)
  • packages/jumpstarter-cli-admin/jumpstarter_cli_admin/create.py (2 hunks)
  • packages/jumpstarter-cli-admin/jumpstarter_cli_admin/create_test.py (1 hunks)
  • packages/jumpstarter-cli-admin/jumpstarter_cli_admin/delete.py (2 hunks)
  • packages/jumpstarter-cli-admin/jumpstarter_cli_admin/delete_test.py (1 hunks)
  • packages/jumpstarter-cli-admin/jumpstarter_cli_admin/get.py (1 hunks)
  • packages/jumpstarter-cli-admin/jumpstarter_cli_admin/import_res.py (2 hunks)
  • packages/jumpstarter-cli-admin/jumpstarter_cli_admin/import_res_test.py (1 hunks)
  • packages/jumpstarter-cli-admin/jumpstarter_cli_admin/install.py (1 hunks)
  • packages/jumpstarter-cli-admin/jumpstarter_cli_admin/print.py (1 hunks)
  • packages/jumpstarter-cli-common/jumpstarter_cli_common/__init__.py (0 hunks)
  • packages/jumpstarter-cli-common/jumpstarter_cli_common/config.py (1 hunks)
  • packages/jumpstarter-cli-driver/jumpstarter_cli_driver/__init__.py (1 hunks)
  • packages/jumpstarter-cli-driver/jumpstarter_cli_driver/driver.py (1 hunks)
  • packages/jumpstarter-cli/jumpstarter_cli/__init__.py (0 hunks)
  • packages/jumpstarter-cli/jumpstarter_cli/config_client.py (1 hunks)
  • packages/jumpstarter-cli/jumpstarter_cli/config_exporter.py (1 hunks)
  • packages/jumpstarter-cli/jumpstarter_cli/create.py (1 hunks)
  • packages/jumpstarter-cli/jumpstarter_cli/delete.py (1 hunks)
  • packages/jumpstarter-cli/jumpstarter_cli/get.py (1 hunks)
  • packages/jumpstarter-cli/jumpstarter_cli/j.py (1 hunks)
  • packages/jumpstarter-cli/jumpstarter_cli/jmp.py (1 hunks)
  • packages/jumpstarter-cli/jumpstarter_cli/login.py (1 hunks)
  • packages/jumpstarter-cli/jumpstarter_cli/run.py (1 hunks)
  • packages/jumpstarter-cli/jumpstarter_cli/shell.py (1 hunks)
  • packages/jumpstarter-cli/jumpstarter_cli/update.py (1 hunks)
  • packages/jumpstarter-driver-network/jumpstarter_driver_network/adapters/novnc.py (1 hunks)
  • packages/jumpstarter-driver-network/jumpstarter_driver_network/adapters/portforward.py (1 hunks)
  • packages/jumpstarter-driver-opendal/README.md (1 hunks)
  • packages/jumpstarter-driver-sdwire/README.md (1 hunks)
  • packages/jumpstarter-driver-uboot/README.md (1 hunks)
  • packages/jumpstarter-driver-ustreamer/README.md (1 hunks)
  • packages/jumpstarter-kubernetes/jumpstarter_kubernetes/clients.py (1 hunks)
  • packages/jumpstarter-kubernetes/jumpstarter_kubernetes/exporters.py (1 hunks)
  • packages/jumpstarter/jumpstarter/client/base.py (1 hunks)
  • packages/jumpstarter/jumpstarter/client/core.py (1 hunks)
  • packages/jumpstarter/jumpstarter/common/streams.py (1 hunks)
  • packages/jumpstarter/jumpstarter/common/utils.py (1 hunks)
  • packages/jumpstarter/jumpstarter/config/__init__.py (0 hunks)
  • packages/jumpstarter/jumpstarter/config/client_config_test.py (1 hunks)
  • packages/jumpstarter/jumpstarter/config/user_config_test.py (1 hunks)
  • packages/jumpstarter/jumpstarter/driver/base.py (1 hunks)
  • packages/jumpstarter/jumpstarter/exporter/session.py (1 hunks)
  • packages/jumpstarter/jumpstarter/streams/__init__.py (0 hunks)
  • packages/jumpstarter/jumpstarter/utils/env.py (1 hunks)
💤 Files with no reviewable changes (4)
  • packages/jumpstarter-cli/jumpstarter_cli/init.py
  • packages/jumpstarter/jumpstarter/config/init.py
  • packages/jumpstarter/jumpstarter/streams/init.py
  • packages/jumpstarter-cli-common/jumpstarter_cli_common/init.py
🧰 Additional context used
🧬 Code Graph Analysis (16)
conftest.py (1)
packages/jumpstarter/jumpstarter/config/exporter.py (2)
  • ExporterConfigV1Alpha1 (72-175)
  • ExporterConfigV1Alpha1DriverInstance (34-69)
packages/jumpstarter-kubernetes/jumpstarter_kubernetes/exporters.py (2)
packages/jumpstarter/jumpstarter/config/common.py (1)
  • ObjectMeta (13-15)
packages/jumpstarter/jumpstarter/config/exporter.py (1)
  • ExporterConfigV1Alpha1 (72-175)
packages/jumpstarter-cli/jumpstarter_cli/jmp.py (2)
packages/jumpstarter-cli-common/jumpstarter_cli_common/alias.py (1)
  • AliasedGroup (4-46)
packages/jumpstarter-cli-common/jumpstarter_cli_common/version.py (1)
  • version (49-56)
packages/jumpstarter-cli-driver/jumpstarter_cli_driver/driver.py (1)
packages/jumpstarter-cli-common/jumpstarter_cli_common/table.py (1)
  • make_table (1-31)
packages/jumpstarter-cli/jumpstarter_cli/j.py (1)
packages/jumpstarter/jumpstarter/utils/env.py (1)
  • env (35-44)
packages/jumpstarter-cli-admin/jumpstarter_cli_admin/install.py (1)
packages/jumpstarter-cli-common/jumpstarter_cli_common/version.py (2)
  • version (49-56)
  • get_client_version (12-14)
packages/jumpstarter-cli-admin/jumpstarter_cli_admin/print.py (3)
packages/jumpstarter-cli-common/jumpstarter_cli_common/opt.py (1)
  • OutputMode (23-27)
packages/jumpstarter-cli-common/jumpstarter_cli_common/table.py (1)
  • make_table (1-31)
packages/jumpstarter-cli-common/jumpstarter_cli_common/time.py (1)
  • time_since (4-32)
packages/jumpstarter-cli-admin/jumpstarter_cli_admin/get.py (1)
packages/jumpstarter-cli-common/jumpstarter_cli_common/alias.py (1)
  • AliasedGroup (4-46)
packages/jumpstarter-cli-driver/jumpstarter_cli_driver/__init__.py (2)
packages/jumpstarter-cli-common/jumpstarter_cli_common/alias.py (1)
  • AliasedGroup (4-46)
packages/jumpstarter-cli-common/jumpstarter_cli_common/version.py (1)
  • version (49-56)
packages/jumpstarter-cli/jumpstarter_cli/get.py (4)
packages/jumpstarter-cli-common/jumpstarter_cli_common/config.py (1)
  • opt_config (90-91)
packages/jumpstarter-cli-common/jumpstarter_cli_common/exceptions.py (1)
  • handle_exceptions (30-44)
packages/jumpstarter-cli-common/jumpstarter_cli_common/opt.py (1)
  • OutputMode (23-27)
packages/jumpstarter-cli-common/jumpstarter_cli_common/table.py (1)
  • make_table (1-31)
packages/jumpstarter-cli/jumpstarter_cli/create.py (4)
packages/jumpstarter-cli-common/jumpstarter_cli_common/config.py (1)
  • opt_config (90-91)
packages/jumpstarter-cli-common/jumpstarter_cli_common/exceptions.py (1)
  • handle_exceptions (30-44)
packages/jumpstarter-cli-common/jumpstarter_cli_common/opt.py (1)
  • OutputMode (23-27)
packages/jumpstarter-cli-common/jumpstarter_cli_common/table.py (1)
  • make_table (1-31)
packages/jumpstarter-kubernetes/jumpstarter_kubernetes/clients.py (1)
packages/jumpstarter/jumpstarter/config/client.py (2)
  • ClientConfigV1Alpha1 (37-274)
  • ClientConfigV1Alpha1Drivers (32-34)
packages/jumpstarter-cli/jumpstarter_cli/config_exporter.py (2)
packages/jumpstarter-cli-common/jumpstarter_cli_common/opt.py (1)
  • OutputMode (23-27)
packages/jumpstarter-cli-common/jumpstarter_cli_common/table.py (1)
  • make_table (1-31)
packages/jumpstarter-cli/jumpstarter_cli/run.py (2)
packages/jumpstarter-cli/jumpstarter_cli/config.py (1)
  • config (8-9)
packages/jumpstarter-cli-common/jumpstarter_cli_common/config.py (1)
  • opt_config (90-91)
packages/jumpstarter/jumpstarter/common/utils.py (1)
packages/jumpstarter/jumpstarter/utils/env.py (1)
  • env (35-44)
packages/jumpstarter-cli/jumpstarter_cli/update.py (4)
packages/jumpstarter-cli-common/jumpstarter_cli_common/config.py (1)
  • opt_config (90-91)
packages/jumpstarter-cli-common/jumpstarter_cli_common/exceptions.py (1)
  • handle_exceptions (30-44)
packages/jumpstarter-cli-common/jumpstarter_cli_common/opt.py (1)
  • OutputMode (23-27)
packages/jumpstarter-cli-common/jumpstarter_cli_common/table.py (1)
  • make_table (1-31)
🪛 GitHub Actions: Run Tests
conftest.py

[error] 22-22: ImportError: cannot import name 'RouterStream' from 'jumpstarter.streams' in conftest.py

⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: e2e
  • GitHub Check: build-and-push-image (jumpstarter-dev/jumpstarter-utils Dockerfile.utils)
  • GitHub Check: build-and-push-image (jumpstarter-dev/jumpstarter-dev .devfile/Containerfile)
  • GitHub Check: build-and-push-image (jumpstarter-dev/jumpstarter-devspace .devfile/Containerfile.client)
  • GitHub Check: build-and-push-image (jumpstarter-dev/jumpstarter Dockerfile)
🔇 Additional comments (54)
packages/jumpstarter-cli-driver/jumpstarter_cli_driver/driver.py (1)

4-4: Import Path Updated for make_table
The import has been correctly adjusted to pull make_table from its new submodule (jumpstarter_cli_common.table), in line with the recent modularization.

packages/jumpstarter-cli-driver/jumpstarter_cli_driver/__init__.py (1)

5-7: Imports updated to granular submodules
The AliasedGroup, opt_log_level, and version imports now come directly from their specific submodules, aligning with the broader refactoring and improving modularity and clarity.

packages/jumpstarter-driver-network/jumpstarter_driver_network/adapters/novnc.py (1)

8-8: Stream import path updated correctly
Importing forward_stream from jumpstarter.streams.common aligns with the new modular structure and matches its usage in the NovncAdapter.

packages/jumpstarter-driver-network/jumpstarter_driver_network/adapters/portforward.py (1)

8-8: Stream import path updated correctly
Switching to jumpstarter.streams.common.forward_stream is consistent with the broader refactor and satisfies the usage in both TCP and Unix port‐forward adapters.

packages/jumpstarter/jumpstarter/driver/base.py (1)

36-38: Stream class imports updated correctly
The explicit imports of AiohttpStreamReaderStream, create_memory_stream, and MetadataStream from their submodules accurately replace the removed aggregated jumpstarter.streams import and cover all usages in the driver’s resource handling.

packages/jumpstarter/jumpstarter/client/base.py (1)

15-15: BlockingStream import path updated correctly
Importing BlockingStream from jumpstarter.streams.blocking aligns with the new streams package structure and supports its use in the blocking stream context manager.

packages/jumpstarter/jumpstarter/common/streams.py (1)

10-11: RouterStream and forward_stream imports updated correctly
Switching to jumpstarter.streams.router.RouterStream and jumpstarter.streams.common.forward_stream follows the modularization of the streams package and matches their use in connect_router_stream.

packages/jumpstarter/jumpstarter/exporter/session.py (1)

21-23: Import refactoring looks good.

The changes properly refactor the stream imports to reference specific submodules rather than the higher-level jumpstarter.streams module. This follows better import practices by making dependencies more explicit and granular, which can help with maintainability and potentially improve import times.

packages/jumpstarter/jumpstarter/client/core.py (1)

24-27: Import refactoring is consistent and well-organized.

The stream-related imports have been appropriately refactored to use specific submodules rather than importing from the aggregated jumpstarter.streams package. This is consistent with the changes made in other files and aligns with the PR objective to improve import granularity throughout the codebase.

packages/jumpstarter-cli-admin/jumpstarter_cli_admin/__init__.py (2)

2-3: Explicit submodule imports enhance clarity and reduce coupling.

Importing AliasedGroup and version directly from their respective submodules aligns with the updated module boundaries and removes reliance on root‑level re‑exports. This improves maintainability and makes dependencies more explicit.


2-3:

Details

✅ Verification successful

Verify no residual root‑level imports remain.

To ensure the refactor is complete, please search for any remaining legacy imports from the jumpstarter_cli_common root.


🏁 Script executed:

#!/bin/bash
# Search for outdated root‑level imports of AliasedGroup or version
rg "from jumpstarter_cli_common import (AliasedGroup|version)\b"

Length of output: 66


Could be missing other import patterns—let’s broaden the search:


🏁 Script executed:

#!/bin/bash
# Search all import statements that reference jumpstarter_cli_common at the root
rg -n "^\s*(from|import)\s+jumpstarter_cli_common(\b|\.)"

Length of output: 5550


All root‑level imports of jumpstarter_cli_common have been removed.

A global search for any from jumpstarter_cli_common import … or bare import jumpstarter_cli_common returned only submodule imports (e.g. jumpstarter_cli_common.opt, jumpstarter_cli_common.table, etc.), confirming no residual root‑level imports remain.

packages/jumpstarter-cli/jumpstarter_cli/config_exporter.py (1)

9-9: Move make_table import to granular table submodule
Aligns with the codebase refactor by importing make_table from jumpstarter_cli_common.table. Ensure this function remains available under that module.

packages/jumpstarter/jumpstarter/utils/env.py (2)

1-9: Import organization looks good.

The imports are well-organized with standard libraries first, followed by third-party libraries (anyio), then internal imports, with appropriate spacing. This follows Python best practices for import organization.


34-44: Clean synchronous wrapper around async context manager.

The synchronous env() function correctly wraps the async context manager using anyio's start_blocking_portal() and portal.wrap_async_context_manager(). This pattern effectively bridges the synchronous and asynchronous worlds.

The docstring clearly explains the purpose and usage of this context manager.

packages/jumpstarter-cli/jumpstarter_cli/j.py (1)

6-6: Import path updated correctly to use the new module location.

The import statement has been updated to reference the new location of the env context manager, which matches the refactoring described in the PR summary.

packages/jumpstarter/jumpstarter/common/utils.py (1)

12-14:

Details

✅ Verification successful

Re-export pattern implemented correctly for backward compatibility.

The code now imports and re-exports the env function from its new location. The use of __all__ correctly specifies what should be exported when using star imports.

Note that other functions in this module (serve_async, serve, launch_shell) are not included in __all__. If these functions are part of the public API, consider including them as well.


🏁 Script executed:

#!/bin/bash
# Check if the non-listed functions in __all__ are imported elsewhere in the codebase
echo "Checking for imports of serve, serve_async, and launch_shell from jumpstarter.common.utils"
rg "from jumpstarter.common.utils import (.*)(serve|launch_shell)" --type py
echo "Checking for direct imports of these functions"
rg "from jumpstarter.common.utils import serve" --type py
rg "from jumpstarter.common.utils import serve_async" --type py
rg "from jumpstarter.common.utils import launch_shell" --type py

Length of output: 5953


Re-export pattern is correct and safe.

  • The patch cleanly moves env into its own module and re-exports it here.
  • __all__ only affects from … import *; all existing explicit imports of serve, serve_async, and launch_shell will continue to work unchanged.
  • We verified that:
    • serve is explicitly imported in numerous tests and drivers.
    • launch_shell is explicitly imported in the CLI.
    • serve_async isn’t imported anywhere else.
    • No code imports env_async from this module.
  • No star‑imports of jumpstarter.common.utils were detected in the codebase.

No further changes are required.

packages/jumpstarter-driver-opendal/README.md (1)

32-32: Updated import for ExporterConfigV1Alpha1DriverInstance.

Switched from the top‑level jumpstarter.config to the granular jumpstarter.config.exporter module, matching the refactored configuration structure.

packages/jumpstarter-cli/jumpstarter_cli/run.py (1)

5-5: Refactored import path for opt_config.

Now imports opt_config from jumpstarter_cli_common.config in line with the modularization of the CLI common package.

docs/source/api-reference/drivers/dbus.md (1)

21-21: Corrected import to jumpstarter.config.exporter.

Aligns the doctest example with the new submodule organization of the config package.

docs/source/api-reference/drivers/proxy.md (1)

27-27: Revised import for ExporterConfigV1Alpha1DriverInstance.

Changed to the dedicated jumpstarter.config.exporter path to reflect the removal of aggregated exports from jumpstarter.config.

packages/jumpstarter-driver-sdwire/README.md (1)

21-21: Aligned import with refactored config submodule.

Now imports ExporterConfigV1Alpha1DriverInstance from jumpstarter.config.exporter, consistent with other driver documentation updates.

packages/jumpstarter-driver-ustreamer/README.md (1)

21-21: Update doctest import path
The example now imports ExporterConfigV1Alpha1DriverInstance from jumpstarter.config.exporter, matching the refactored module layout.

packages/jumpstarter-driver-uboot/README.md (1)

21-21: Synchronize driver README import
Importing ExporterConfigV1Alpha1DriverInstance from jumpstarter.config.exporter reflects the updated module structure and keeps documentation accurate.

packages/jumpstarter-cli/jumpstarter_cli/delete.py (2)

2-2: Import opt_config from specific submodule
The opt_config decorator is now imported from jumpstarter_cli_common.config rather than the top‑level package, making the dependency explicit and aligning with the common‑package restructuring.


4-4: Import output helpers from dedicated module
OutputMode, OutputType, and opt_output_name_only have been moved to jumpstarter_cli_common.opt to reduce top‑level exports and improve modularity in the CLI utilities.

packages/jumpstarter/jumpstarter/config/client_config_test.py (1)

11-12: Refine test imports for configuration modules
Tests now import ClientConfigV1Alpha1 and ClientConfigV1Alpha1Drivers from jumpstarter.config.client, and ObjectMeta from jumpstarter.config.common, in line with the new modular export strategy.

packages/jumpstarter-kubernetes/jumpstarter_kubernetes/clients.py (1)

13-14: LGTM! Import paths updated to more specific modules.

The imports have been updated to reference the specific submodules instead of the general jumpstarter.config module. This is in line with the PR's objective to make imports more granular.

conftest.py (1)

10-10: LGTM! Consolidated imports from specific submodule.

The import statement has been properly updated to import both ExporterConfigV1Alpha1 and ExporterConfigV1Alpha1DriverInstance from the more granular jumpstarter.config.exporter module.

packages/jumpstarter-cli-common/jumpstarter_cli_common/config.py (1)

6-8: LGTM! Import paths updated to more specific modules.

The imports have been properly updated to reference each configuration class from its specific submodule, instead of importing all from the general jumpstarter.config module.

packages/jumpstarter-cli-admin/jumpstarter_cli_admin/print.py (1)

2-4: LGTM! Import paths updated to more specific modules.

The imports have been properly updated to reference each utility from its specific submodule within jumpstarter_cli_common. This is consistent with the PR's goal of more granular imports.

packages/jumpstarter/jumpstarter/config/user_config_test.py (1)

7-9: Import modularization for user config tests
Imports have been updated to reference dedicated submodules (client, common, user) instead of the aggregated jumpstarter.config module. This aligns with the broader refactoring and improves clarity.

packages/jumpstarter-cli-admin/jumpstarter_cli_admin/get.py (1)

5-13: Refined imports from jumpstarter_cli_common
The CLI command group now explicitly imports AliasedGroup from jumpstarter_cli_common.alias and option decorators from jumpstarter_cli_common.opt, eliminating the monolithic package import. This change is consistent with the project-wide modularization and preserves functionality.

packages/jumpstarter-cli-admin/jumpstarter_cli_admin/import_res.py (2)

4-11: Use granular imports for CLI options
Refactoring to import PathOutputType and related decorators from jumpstarter_cli_common.opt improves modularity and avoids exposing the entire parent package.


20-22: Direct imports for config classes
Switched to importing ClientConfigV1Alpha1, ExporterConfigV1Alpha1, and UserConfigV1Alpha1 from their specific submodules (client, exporter, user). This aligns with the repo-wide effort to remove top-level re-exports and enhances maintainability.

packages/jumpstarter-cli/jumpstarter_cli/login.py (2)

2-2: Import opt_config from granular submodule
opt_config is now imported from jumpstarter_cli_common.config instead of the umbrella package, aligning with the modular import strategy.


5-6: Refined config class imports
Configuration classes ClientConfigV1Alpha1, ClientConfigV1Alpha1Drivers, and ObjectMeta are now pulled directly from jumpstarter.config.client and jumpstarter.config.common respectively, matching the new module boundaries without altering behavior.

packages/jumpstarter-cli-admin/jumpstarter_cli_admin/import_res_test.py (1)

13-15: Update test imports to match submodule layout
Test now imports ClientConfigV1Alpha1, ClientConfigV1Alpha1Drivers, ObjectMeta, and ExporterConfigV1Alpha1 from their dedicated submodules. This keeps test code in sync with the refactored module structure.

packages/jumpstarter-cli/jumpstarter_cli/get.py (2)

2-2: Correct granularity: config import
opt_config is now correctly imported from jumpstarter_cli_common.config, matching the new modular structure. No functional change.


4-5: Correct granularity: opt and table imports
OutputMode, OutputType, opt_output_all, and make_table are accurately imported from their respective jumpstarter_cli_common submodules, and all usages align with their definitions.

packages/jumpstarter-cli/jumpstarter_cli/create.py (2)

4-4: Correct granularity: config import
opt_config is properly imported from jumpstarter_cli_common.config in line with the refactoring.


6-7: Correct granularity: opt and table imports
OutputMode, OutputType, opt_output_all, and make_table imports are updated to reference their dedicated submodules under jumpstarter_cli_common, and they match the definitions.

packages/jumpstarter-cli/jumpstarter_cli/update.py (2)

4-4: Correct granularity: config import
opt_config is now imported from jumpstarter_cli_common.config, consistent with the new package boundaries.


6-7: Correct granularity: opt and table imports
OutputMode, OutputType, opt_output_all, and make_table are correctly sourced from jumpstarter_cli_common.opt and jumpstarter_cli_common.table, with no break in functionality.

packages/jumpstarter-cli-admin/jumpstarter_cli_admin/delete_test.py (1)

14-17: Correct granularity: config class imports
ClientConfigV1Alpha1, ClientConfigV1Alpha1Drivers, ObjectMeta, ExporterConfigV1Alpha1, UserConfigV1Alpha1, and UserConfigV1Alpha1Config are correctly imported from their new dedicated submodules under jumpstarter.config. All types are used downstream in test setup.

packages/jumpstarter-cli/jumpstarter_cli/shell.py (2)

5-5: Correct granularity: config import
opt_config is properly imported from jumpstarter_cli_common.config, reflecting the refactored common utilities module.


10-11: Correct granularity: client/exporter config imports
ClientConfigV1Alpha1 and ExporterConfigV1Alpha1 are correctly imported from jumpstarter.config.client and jumpstarter.config.exporter respectively, aligning with the new modular structure.

packages/jumpstarter-cli/jumpstarter_cli/config_client.py (1)

4-16: LGTM: Well-organized import refactoring.

The imports have been nicely reorganized to reference specific submodules rather than broader modules, which improves modularity and makes dependencies more explicit.

Instead of importing from the top-level modules, imports now come from more granular sources:

  • Exceptions from jumpstarter_cli_common.exceptions
  • Options from jumpstarter_cli_common.opt
  • Table utilities from jumpstarter_cli_common.table
  • Configuration classes from specific submodules (client, common, user)

This aligns with the PR's goal of improving modularity and performance.

packages/jumpstarter-cli-admin/jumpstarter_cli_admin/create_test.py (1)

17-19: LGTM: Improved import organization.

Configuration classes are now imported from their specific submodules instead of the broader jumpstarter.config module:

  • ClientConfigV1Alpha1 and ClientConfigV1Alpha1Drivers from jumpstarter.config.client
  • ObjectMeta from jumpstarter.config.common
  • ExporterConfigV1Alpha1 from jumpstarter.config.exporter

This change aligns with the broader import refactoring effort across the codebase, improving modularity without changing any functionality.

packages/jumpstarter-cli-admin/jumpstarter_cli_admin/create.py (2)

5-16: LGTM: Refactored imports from general to specific modules.

The import statements have been updated to pull from more specific submodules rather than the broader package:

  • AliasedGroup now comes directly from jumpstarter_cli_common.alias
  • Options like OutputMode, etc. now come from jumpstarter_cli_common.opt

This creates cleaner dependencies and improves modularity.


25-27: LGTM: Configuration imports from specialized modules.

Configuration classes are now imported from their specific submodules:

  • ClientConfigV1Alpha1 from jumpstarter.config.client
  • ExporterConfigV1Alpha1 from jumpstarter.config.exporter
  • UserConfigV1Alpha1 from jumpstarter.config.user

This makes dependencies more explicit and supports the codebase modularization.

packages/jumpstarter-cli-admin/jumpstarter_cli_admin/delete.py (2)

5-14: LGTM: Improved granularity in CLI common imports.

The import statements have been refactored to use specific submodules:

  • AliasedGroup now comes from jumpstarter_cli_common.alias
  • Various options now come from jumpstarter_cli_common.opt

This follows the pattern established across the codebase and improves modularity.


23-25: LGTM: Modularized configuration imports.

Configuration classes are now imported from their dedicated submodules:

  • ClientConfigV1Alpha1 from jumpstarter.config.client
  • ExporterConfigV1Alpha1 from jumpstarter.config.exporter
  • UserConfigV1Alpha1 from jumpstarter.config.user

This change is consistent with the rest of the import refactoring effort.

packages/jumpstarter-cli/jumpstarter_cli/jmp.py (1)

5-7:

Details

✅ Verification successful

Granularize imports from jumpstarter_cli_common
Refactoring these imports to point at their specific submodules (alias, opt, version) correctly follows the recent removal of re-exports in jumpstarter_cli_common.__init__.py and improves clarity.
Please verify that no residual top-level imports from jumpstarter_cli_common remain elsewhere in the codebase.


🏁 Script executed:

#!/bin/bash
# Search for any stale top-level imports from jumpstarter_cli_common
rg "from jumpstarter_cli_common import " .

Length of output: 44


🏁 Script executed:

#!/bin/bash
# Combined search for any stale top-level imports of jumpstarter_cli_common
rg -n -E "(^import\s+jumpstarter_cli_common(\s|\.))|(^from\s+jumpstarter_cli_common\s+import\s+)" .

Length of output: 225


🏁 Script executed:

#!/bin/bash
# Re-check for any stale top-level imports of jumpstarter_cli_common using literal search
rg -n -F "import jumpstarter_cli_common" . || true
rg -n -F "from jumpstarter_cli_common import " . || true

Length of output: 109


No stale top-level imports found – ready to merge
I searched the entire repo for both import jumpstarter_cli_common and from jumpstarter_cli_common import and found no occurrences. The granularized imports in jmp.py correctly reference the new submodules.

packages/jumpstarter-cli-admin/jumpstarter_cli_admin/install.py (1)

4-5:

Details

✅ Verification successful

Update import paths for common utilities
The decorators opt_context and opt_kubeconfig are now imported from jumpstarter_cli_common.opt, and get_client_version is imported from jumpstarter_cli_common.version. This matches the recent refactoring of jumpstarter_cli_common/__init__.py. Please verify that:

  1. packages/jumpstarter-cli-common/jumpstarter_cli_common/opt.py defines both opt_context and opt_kubeconfig.
  2. packages/jumpstarter-cli-common/jumpstarter_cli_common/version.py defines get_client_version.
  3. There are no lingering references to the old aggregate imports elsewhere in the CLI admin commands.

You can run this script to confirm:


🏁 Script executed:

#!/bin/bash
# Verify opt_context & opt_kubeconfig definitions
rg -n "def opt_context" -n packages/jumpstarter-cli-common/jumpstarter_cli_common/opt.py
rg -n "def opt_kubeconfig" -n packages/jumpstarter-cli-common/jumpstarter_cli_common/opt.py
# Verify get_client_version definition
rg -n "def get_client_version" -n packages/jumpstarter-cli-common/jumpstarter_cli_common/version.py

Length of output: 315


🏁 Script executed:

#!/bin/bash
# List files in the common utilities directory
ls -1 packages/jumpstarter-cli-common/jumpstarter_cli_common
# Search for opt_context occurrences (definitions and assignments)
rg -n "opt_context" -n packages/jumpstarter-cli-common/jumpstarter_cli_common/opt.py
# Search for opt_kubeconfig occurrences (definitions and assignments)
rg -n "opt_kubeconfig" -n packages/jumpstarter-cli-common/jumpstarter_cli_common/opt.py

Length of output: 492


🏁 Script executed:

#!/bin/bash
# Check for any legacy aggregate imports in CLI admin commands
rg -n "from jumpstarter_cli_common import" -n packages/jumpstarter-cli-admin
# Check for any direct references to jumpstarter_cli_common without submodule
rg -n "jumpstarter_cli_common\." -n packages/jumpstarter-cli-admin

Length of output: 1783


Import paths are correct and up‑to‑date

  • opt_context (line 16) and opt_kubeconfig (line 12) are defined in packages/jumpstarter-cli-common/jumpstarter_cli_common/opt.py.
  • get_client_version (line 12) is defined in packages/jumpstarter-cli-common/jumpstarter_cli_common/version.py.
  • No legacy from jumpstarter_cli_common import … imports remain in packages/jumpstarter-cli-admin.

All imports align with the refactored common package—LGTM.

Comment thread packages/jumpstarter-cli/jumpstarter_cli/config_exporter.py
Comment thread conftest.py
@NickCao NickCao enabled auto-merge April 17, 2025 17:44
@NickCao NickCao merged commit ecc5cb1 into main Apr 17, 2025
19 checks passed
@NickCao NickCao deleted the faster branch April 30, 2025 18:29
@mangelajo mangelajo added this to the 0.6.0 milestone May 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants