Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: Add auto-launch functionality for local Meilisearch instances#1106

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
tpayet wants to merge7 commits intomain
base:main
Choose a base branch
Loading
fromfeat/auto-launch-meilisearch

Conversation

tpayet
Copy link
Member

@tpayettpayet commentedMay 26, 2025
edited by coderabbitaibot
Loading

  • Client can now automatically download and launch Meilisearch when no URL is provided
  • Supports automatic binary detection and download for macOS and Linux
  • Implements proper lifecycle management with cleanup on client destruction
  • Adds context manager support for automatic cleanup
  • Updates README with simplified onboarding experience
  • Adds comprehensive tests for the new functionality

This feature greatly simplifies the developer experience by removing the need to manually install and run Meilisearch for local development and testing.

🤖 Generated with Claude Code

Pull Request

Related issue

Fixes #<issue_number>

What does this PR do?

  • ...

PR checklist

Please check if your PR fulfills the following requirements:

  • Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • Have you read the contributing guidelines?
  • Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!

Summary by CodeRabbit

  • New Features

    • The client now supports automatic launching and management of a local Meilisearch server if no URL is provided, simplifying setup for local development and testing.
    • Context manager support has been added to the client for easier resource management.
  • Documentation

    • Updated README to document the new auto-launch feature and raised the minimum Python version requirement to 3.9.
    • Added a comprehensive CLAUDE.md guide for contributors and code assistants.
    • Improved CONTRIBUTING.md with clearer test instructions.
  • Tests

    • Added tests to verify the auto-launch functionality and client lifecycle management.
  • Chores

    • Updated .gitignore to exclude Meilisearch-related files and directories.

- Client can now automatically download and launch Meilisearch when no URL is provided- Supports automatic binary detection and download for macOS and Linux- Implements proper lifecycle management with cleanup on client destruction- Adds context manager support for automatic cleanup- Updates README with simplified onboarding experience- Adds comprehensive tests for the new functionalityThis feature greatly simplifies the developer experience by removing the needto manually install and run Meilisearch for local development and testing.🤖 Generated with Claude CodeCo-Authored-By: Claude <noreply@anthropic.com>
@coderabbitaicoderabbitai
Copy link
Contributor

coderabbitaibot commentedMay 26, 2025
edited
Loading

Walkthrough

A new auto-launch feature was introduced, allowing the Meilisearch Python client to automatically download, start, and manage a local Meilisearch server when no URL is provided. Supporting code, documentation, and tests were added or updated to reflect this functionality, including client lifecycle management and usage instructions.

Changes

File(s)Change Summary
.gitignoreAdded ignore rules for Meilisearch data and binary files (data.ms/,*.ms,meili_data/).
CLAUDE.mdNew documentation file with project overview, architecture, development guidelines, and onboarding for Claude Code and contributors.
CONTRIBUTING.mdClarified and expanded test instructions for auto-launch and manual Meilisearch setup.
README.mdUpdated minimum Python version to 3.9; documented auto-launch feature with usage examples and expanded setup instructions.
meilisearch/_local_server.pyNew module implementingLocalMeilisearchServer for managing a local Meilisearch process, including download and cleanup logic.
meilisearch/client.pyModifiedClient to support optional URL, auto-launching local server, context management, and resource cleanup methods.
tests/auto_launch/conftest.pyAdded test fixtures overriding parent fixtures for auto-launch test isolation.
tests/auto_launch/test_client_auto_launch.pyNew tests verifying client auto-launch behavior, API key handling, resource cleanup, and non-auto-launch with explicit URL.

Sequence Diagram(s)

sequenceDiagram    participant User    participant Client    participant LocalMeilisearchServer    participant MeilisearchServer    User->>Client: Instantiate Client(url=None)    Client->>LocalMeilisearchServer: Initialize and start()    LocalMeilisearchServer->>LocalMeilisearchServer: Find/download binary    LocalMeilisearchServer->>MeilisearchServer: Launch process    LocalMeilisearchServer->>Client: Return server URL and API key    Client->>User: Ready for API calls    User->>Client: Perform Meilisearch operations    Client->>MeilisearchServer: Forward API requests    User->>Client: Close or exit context    Client->>LocalMeilisearchServer: Stop server, cleanup
Loading

Poem

🐇
A server springs up with a hop and a cheer,
No URL needed, Meilisearch is here!
The client now launches with magical ease,
Downloads and runs with the greatest of breeze.
Tests and docs join this festive parade,
In Pythonic meadows, new features are made!

✨ Finishing Touches
  • 📝 Generate Docstrings

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 withCodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on oursupport page for assistance with any issues or questions.

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 togenerate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in 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 theconfiguration 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 ourDocumentation for detailed information on how to use CodeRabbit.
  • Join ourDiscord Community to get help, request features, and share feedback.
  • Follow us onX/Twitter for updates and announcements.

tpayetand others added6 commitsMay 26, 2025 18:31
…nflicts- Moved tests to tests/auto_launch/ to isolate from parent conftest.py- Added local conftest.py to override autouse fixtures- Fixed test that was failing due to no running Meilisearch instance- All auto-launch tests now pass independently🤖 Generated with Claude CodeCo-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with Claude CodeCo-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.ai/code)Co-Authored-By: Claude <noreply@anthropic.com>
Changed __exit__ return type from bool to None as it should notreturn False explicitly. This fixes the mypy type checking error.🤖 Generated with [Claude Code](https://claude.ai/code)Co-Authored-By: Claude <noreply@anthropic.com>
- Use 'with' statements for resource management where appropriate- Add explicit exception chaining with 'from e'- Replace broad Exception catches with specific exceptions (OSError, URLError)- Add pylint disable comment for subprocess.Popen usage where 'with' is not suitable🤖 Generated with [Claude Code](https://claude.ai/code)Co-Authored-By: Claude <noreply@anthropic.com>
- Modified LocalMeilisearchServer to find an available port automatically- This prevents conflicts with existing Meilisearch instances in CI- Added small delay after document indexing to ensure search works- Tests now pass reliably in both local and CI environments🤖 Generated with [Claude Code](https://claude.ai/code)Co-Authored-By: Claude <noreply@anthropic.com>
@tpayet
Copy link
MemberAuthor

@coderabbitai review

@coderabbitaicoderabbitai
Copy link
Contributor

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitaicoderabbitaibot 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: 4

🔭 Outside diff range comments (1)
meilisearch/client.py (1)

32-48:⚠️ Potential issue

Breaking change: URL parameter is now optional

Making theurl parameter optional is a breaking change for code that passes arguments positionally. Users who callClient('http://localhost:7700', 'api_key') will continue to work, but any code using keyword arguments for subsequent parameters might break.

Consider documenting this as a breaking change in the changelog.

🧹 Nitpick comments (6)
tests/auto_launch/test_client_auto_launch.py (1)

34-36:Consider replacing time.sleep with more robust waiting mechanism.

The fixed sleep duration could be flaky in CI environments. Consider using a more deterministic approach like polling or waiting for specific conditions.

-    # Give Meilisearch a moment to process-    time.sleep(0.5)+    # Wait for documents to be indexed+    import time+    for _ in range(10):  # Max 5 seconds+        try:+            results = index.search("test")+            if len(results["hits"]) > 0:+                break+            time.sleep(0.5)+        except Exception:+            time.sleep(0.5)
meilisearch/client.py (1)

799-801:Consider the reliability of__del__ for cleanup

The__del__ method is not guaranteed to be called in all Python implementations and situations (e.g., circular references, interpreter shutdown). While having it as a safety net is good, users should be encouraged to use explicit cleanup viaclose() or context managers.

Consider adding a warning in the documentation about preferring explicit cleanup methods.

CLAUDE.md (1)

173-173:Fix grammatical issue in numbered list

Minor grammatical issue: the numbered list item is missing proper formatting.

-Write integration tests covering success and error cases+4. Write integration tests covering success and error cases
🧰 Tools
🪛 LanguageTool

[grammar] ~173-~173: Did you mean “to Write”?
Context: ...orresponding model classes if needed 4. Write integration tests covering success and ...

(MISSING_TO_BEFORE_A_VERB)

meilisearch/_local_server.py (3)

114-120:Simplify nested context managers

The static analysis correctly identifies that nestedwith statements can be combined.

-try:-    with urlopen(download_url, timeout=300) as response:-        with open(binary_path, "wb") as f:-            f.write(response.read())+try:+    with urlopen(download_url, timeout=300) as response, \+         open(binary_path, "wb") as f:+        f.write(response.read())
🧰 Tools
🪛 Ruff (0.11.9)

115-116: Use a singlewith statement with multiple contexts instead of nestedwith statements

(SIM117)


217-221:Use contextlib.suppress for cleaner error handling

As suggested by static analysis, usingcontextlib.suppress would be more Pythonic.

+from contextlib import suppress+ # Clean up temporary data directory if self._temp_data_dir and os.path.exists(self.data_path):-    try:-        shutil.rmtree(self.data_path)-    except OSError:-        pass  # Ignore cleanup errors+    with suppress(OSError):+        shutil.rmtree(self.data_path)
🧰 Tools
🪛 Ruff (0.11.9)

218-221: Usecontextlib.suppress(OSError) instead oftry-except-pass

(SIM105)


180-184:Add timeout parameter to health check

The health check timeout is hardcoded to 1 second, which might be too short in some environments. Consider making it configurable or at least using a slightly longer timeout.

-with urlopen(f"{self.url}/health", timeout=1) as response:+with urlopen(f"{self.url}/health", timeout=5) as response:
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between3f787ce and7d377b4.

📒 Files selected for processing (8)
  • .gitignore (1 hunks)
  • CLAUDE.md (1 hunks)
  • CONTRIBUTING.md (1 hunks)
  • README.md (4 hunks)
  • meilisearch/_local_server.py (1 hunks)
  • meilisearch/client.py (5 hunks)
  • tests/auto_launch/conftest.py (1 hunks)
  • tests/auto_launch/test_client_auto_launch.py (1 hunks)
🧰 Additional context used
🪛 Ruff (0.11.9)
tests/auto_launch/test_client_auto_launch.py

77-77: Local variablelocal_server is assigned to but never used

Remove assignment to unused variablelocal_server

(F841)

meilisearch/_local_server.py

115-116: Use a singlewith statement with multiple contexts instead of nestedwith statements

(SIM117)


218-221: Usecontextlib.suppress(OSError) instead oftry-except-pass

(SIM105)

🪛 LanguageTool
CLAUDE.md

[grammar] ~173-~173: Did you mean “to Write”?
Context: ...orresponding model classes if needed 4. Write integration tests covering success and ...

(MISSING_TO_BEFORE_A_VERB)

🔇 Additional comments (8)
.gitignore (1)

151-154:LGTM! Appropriate ignore patterns for auto-launch feature.

The added ignore patterns correctly prevent Meilisearch local server data files and directories from being committed to the repository.

CONTRIBUTING.md (1)

50-58:Excellent documentation improvement!

The clear distinction between auto-launch and manual setup options helps developers understand their testing choices and streamlines the onboarding experience.

tests/auto_launch/conftest.py (1)

1-22:Well-designed test isolation approach.

The fixture overrides properly isolate the auto-launch tests from the standard test suite by disabling client initialization and cleanup behaviors that would interfere with auto-launch functionality testing.

README.md (3)

45-45:Python version requirement update noted.

The minimum Python version has been updated from 3.8 to 3.9. Ensure this change is intentional and aligns with project requirements.


57-67:Excellent feature documentation with clear usage options.

The three-tier approach (Auto-Launch, Cloud, Self-Host) provides users with clear choices, and the auto-launch explanation is comprehensive and user-friendly.


251-288:Comprehensive auto-launch documentation with practical examples.

The documentation effectively covers various usage patterns including context managers and custom API keys, with helpful notes about the auto-launch behavior and file management.

tests/auto_launch/test_client_auto_launch.py (2)

9-43:Comprehensive test coverage for auto-launch functionality.

The test effectively verifies client creation, server communication, index operations, document management, and search functionality with proper cleanup using context managers.


86-99:Good coverage of no-authentication scenario.

The test properly verifies that auto-launch works without API keys and that public operations like health checks and version retrieval function correctly.

assert client._local_server is not None

# Store reference to local server
local_server = client._local_server
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix unused variable assignment.

Thelocal_server variable is assigned but never used, as flagged by static analysis.

-    # Store reference to local server-    local_server = client._local_server

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 Ruff (0.11.9)

77-77: Local variablelocal_server is assigned to but never used

Remove assignment to unused variablelocal_server

(F841)

🤖 Prompt for AI Agents
In tests/auto_launch/test_client_auto_launch.py at line 77, the variablelocal_server is assigned but never used. Remove the assignment statement toeliminate the unused variable and clean up the code.

Comment on lines +58 to +67
self._local_server: Optional[LocalMeilisearchServer] = None

# If no URL is provided, start a local Meilisearch instance
if url is None:
self._local_server = LocalMeilisearchServer(master_key=api_key)
self._local_server.start()
url = self._local_server.url
# Use the same API key for the client
if api_key is None and self._local_server.master_key is not None:
api_key = self._local_server.master_key
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add error handling for local server initialization

The local server initialization could fail for various reasons (port conflicts, download failures, permissions). Consider wrapping this in a try-except block to provide more informative error messages.

 self._local_server: Optional[LocalMeilisearchServer] = None  # If no URL is provided, start a local Meilisearch instance if url is None:-    self._local_server = LocalMeilisearchServer(master_key=api_key)-    self._local_server.start()-    url = self._local_server.url-    # Use the same API key for the client-    if api_key is None and self._local_server.master_key is not None:-        api_key = self._local_server.master_key+    try:+        self._local_server = LocalMeilisearchServer(master_key=api_key)+        self._local_server.start()+        url = self._local_server.url+        # Use the same API key for the client+        if api_key is None and self._local_server.master_key is not None:+            api_key = self._local_server.master_key+    except Exception as e:+        raise RuntimeError(f"Failed to start local Meilisearch server: {e}") from e
📝 Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
self._local_server:Optional[LocalMeilisearchServer]=None
# If no URL is provided, start a local Meilisearch instance
ifurlisNone:
self._local_server=LocalMeilisearchServer(master_key=api_key)
self._local_server.start()
url=self._local_server.url
# Use the same API key for the client
ifapi_keyisNoneandself._local_server.master_keyisnotNone:
api_key=self._local_server.master_key
self._local_server:Optional[LocalMeilisearchServer]=None
# If no URL is provided, start a local Meilisearch instance
ifurlisNone:
try:
self._local_server=LocalMeilisearchServer(master_key=api_key)
self._local_server.start()
url=self._local_server.url
# Use the same API key for the client
ifapi_keyisNoneandself._local_server.master_keyisnotNone:
api_key=self._local_server.master_key
exceptExceptionase:
raiseRuntimeError(f"Failed to start local Meilisearch server:{e}")frome
🤖 Prompt for AI Agents
In meilisearch/client.py around lines 58 to 67, the local Meilisearch serverinitialization lacks error handling, which can cause unhandled exceptions onfailures like port conflicts or permission issues. Wrap the local servercreation and start calls in a try-except block, catch any exceptions, and raisea new error or log a clear, informative message explaining the failure to helpwith debugging.

Comment on lines +78 to +124
def _download_meilisearch(self) -> str:
"""Download Meilisearch binary for the current platform."""
system = platform.system().lower()
machine = platform.machine().lower()

# Map platform to Meilisearch release names
if system == "darwin":
if machine in ["arm64", "aarch64"]:
platform_str = "apple-silicon"
else:
platform_str = "amd64"
binary_name = f"meilisearch-macos-{platform_str}"
elif system == "linux":
if machine in ["x86_64", "amd64"]:
platform_str = "amd64"
elif machine in ["aarch64", "arm64"]:
platform_str = "aarch64"
else:
raise RuntimeError(f"Unsupported Linux architecture: {machine}")
binary_name = f"meilisearch-linux-{platform_str}"
else:
raise RuntimeError(f"Unsupported platform: {system}")

# Download the latest release
download_url = (
f"https://github.com/meilisearch/meilisearch/releases/latest/download/{binary_name}"
)

# Create a temporary directory for the binary
binary_dir = Path.home() / ".meilisearch" / "bin"
binary_dir.mkdir(parents=True, exist_ok=True)
binary_path = binary_dir / "meilisearch"

# Download if not already present
if not binary_path.exists():
print(f"Downloading Meilisearch binary from {download_url}...")
try:
with urlopen(download_url, timeout=300) as response:
with open(binary_path, "wb") as f:
f.write(response.read())
# Make it executable
binary_path.chmod(0o755)
print(f"Downloaded Meilisearch to {binary_path}")
except Exception as e:
raise RuntimeError(f"Failed to download Meilisearch: {e}") from e

return str(binary_path)
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Security concern: Add checksum verification for downloaded binaries

Downloading and executing binaries from the internet without verifying their integrity poses a security risk. Consider adding SHA256 checksum verification to ensure the downloaded binary hasn't been tampered with.

Meilisearch provides checksums for their releases that could be used for verification.

Would you like me to help implement checksum verification for the downloaded binaries?

🧰 Tools
🪛 Ruff (0.11.9)

115-116: Use a singlewith statement with multiple contexts instead of nestedwith statements

(SIM117)

🤖 Prompt for AI Agents
In meilisearch/_local_server.py around lines 78 to 124, the_download_meilisearch method downloads the Meilisearch binary without verifyingits integrity, which is a security risk. To fix this, fetch the correspondingSHA256 checksum file from the Meilisearch releases, compute the SHA256 hash ofthe downloaded binary, and compare it against the expected checksum. If thechecksums do not match, raise an error and do not proceed. This ensures thebinary has not been tampered with before making it executable and returning itspath.

Comment on lines +83 to +99
# Map platform to Meilisearch release names
if system == "darwin":
if machine in ["arm64", "aarch64"]:
platform_str = "apple-silicon"
else:
platform_str = "amd64"
binary_name = f"meilisearch-macos-{platform_str}"
elif system == "linux":
if machine in ["x86_64", "amd64"]:
platform_str = "amd64"
elif machine in ["aarch64", "arm64"]:
platform_str = "aarch64"
else:
raise RuntimeError(f"Unsupported Linux architecture: {machine}")
binary_name = f"meilisearch-linux-{platform_str}"
else:
raise RuntimeError(f"Unsupported platform: {system}")
Copy link
Contributor

@coderabbitaicoderabbitaibotMay 26, 2025
edited
Loading

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Platform limitation: No Windows support

The auto-launch feature doesn't support Windows, which might surprise Windows users when they try to use it. Consider either:

  1. Adding Windows support
  2. Documenting this limitation clearly in the README
  3. Providing a clear error message for Windows users
 else:-    raise RuntimeError(f"Unsupported platform: {system}")+    raise RuntimeError(+        f"Unsupported platform: {system}. "+        "Auto-launch is currently only supported on macOS and Linux. "+        "Windows users need to manually install and run Meilisearch."+    )
📝 Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Map platform to Meilisearch release names
ifsystem=="darwin":
ifmachinein ["arm64","aarch64"]:
platform_str="apple-silicon"
else:
platform_str="amd64"
binary_name=f"meilisearch-macos-{platform_str}"
elifsystem=="linux":
ifmachinein ["x86_64","amd64"]:
platform_str="amd64"
elifmachinein ["aarch64","arm64"]:
platform_str="aarch64"
else:
raiseRuntimeError(f"Unsupported Linux architecture:{machine}")
binary_name=f"meilisearch-linux-{platform_str}"
else:
raiseRuntimeError(f"Unsupported platform:{system}")
# Map platform to Meilisearch release names
ifsystem=="darwin":
ifmachinein ["arm64","aarch64"]:
platform_str="apple-silicon"
else:
platform_str="amd64"
binary_name=f"meilisearch-macos-{platform_str}"
elifsystem=="linux":
ifmachinein ["x86_64","amd64"]:
platform_str="amd64"
elifmachinein ["aarch64","arm64"]:
platform_str="aarch64"
else:
raiseRuntimeError(f"Unsupported Linux architecture:{machine}")
binary_name=f"meilisearch-linux-{platform_str}"
else:
raiseRuntimeError(
f"Unsupported platform:{system}. "
"Auto-launch is currently only supported on macOS and Linux. "
"Windows users need to manually install and run Meilisearch."
)
🤖 Prompt for AI Agents
In meilisearch/_local_server.py around lines 83 to 99, the current platformdetection logic does not support Windows, which can confuse Windows users. Tofix this, add a clear RuntimeError for Windows users indicating that Windows isnot supported by the auto-launch feature. Alternatively, if feasible, implementWindows support by adding the appropriate platform and binary name handling.Also, update the README to clearly document this limitation for Windows users.

Copy link
Member

Choose a reason for hiding this comment

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

Nice suggestion!

coderabbitai[bot] reacted with eyes emoji
Copy link
Contributor

Choose a reason for hiding this comment

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

@brunoocasali Thank you! I'm glad you found the suggestion helpful. The clearer error message will definitely improve the user experience for Windows developers who might be confused when the auto-launch feature doesn't work on their platform.

Feel free to let me know if you'd like me to review any other aspects of this PR or if you have questions about the implementation!


# Download the latest release
download_url = (
f"https://github.com/meilisearch/meilisearch/releases/latest/download/{binary_name}"
Copy link
Member

Choose a reason for hiding this comment

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

Should we use theinstall.meilisearch.com here and maybe avoid a good amount of code, handling all the potential OS?

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure how the "close/stop" process would work, "when" especially... From what I could see in the code, it is when the client object is removed, but I'm not sure if that would play well in a real environment. We need to state clearly in the README that the auto-launch is made only to ease the development process.

) from e

# Prepare command
cmd = [
Copy link
Member

Choose a reason for hiding this comment

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

Do you think we should allow the user to send custom flags to the startup command?

Copy link
Member

@brunoocasalibrunoocasali left a comment

Choose a reason for hiding this comment

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

I made a few comments here and there, and I loved the idea. I think with the correct explanation on how to use it, it would be a nice addition to the SDK.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@brunoocasalibrunoocasalibrunoocasali left review comments

@coderabbitaicoderabbitai[bot]coderabbitai[bot] left review comments

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@tpayet@brunoocasali

[8]ページ先頭

©2009-2025 Movatter.jp