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

feat: add --index-url support for private package registries#35

Open
juan-abia wants to merge 7 commits intopydantic:mainfrom
juan-abia:feat/index-url-support
Open

feat: add --index-url support for private package registries#35
juan-abia wants to merge 7 commits intopydantic:mainfrom
juan-abia:feat/index-url-support

Conversation

@juan-abia
Copy link

@juan-abia juan-abia commented Dec 20, 2025

Add support for custom package index URLs to allow installing dependencies from private registries. The --index-url CLI option can be repeated multiple times to specify multiple indexes, which are tried in order before PyPI.

Changes:

  • Add --index-url CLI argument with action='append' for multiple indexes
  • Add index_urls parameter to run_mcp_server(), prepare_deno_env(), async_prepare_deno_env(), and code_sandbox()
  • Pass index_urls through Deno/TypeScript layer to micropip.install()
  • Update README with usage examples

Usage:
uvx mcp-run-python --index-url https://private.repo.com/simple --deps pkg stdio

Python API:
async with code_sandbox( dependencies=['pkg'], index_urls=['https://private.repo.com/simple'] ) as sandbox: await sandbox.eval('import pkg')

@juan-abia juan-abia force-pushed the feat/index-url-support branch from 79f12ac to 2e51c0b Compare December 20, 2025 21:29
@juan-abia juan-abia force-pushed the feat/index-url-support branch 3 times, most recently from d33a672 to 22eb651 Compare December 20, 2025 21:50
@DouweM DouweM self-assigned this Jan 12, 2026
@DouweM DouweM added the enhancement New feature or request label Jan 12, 2026
@juan-abia juan-abia force-pushed the feat/index-url-support branch 2 times, most recently from 1f09b30 to 553272c Compare January 13, 2026 14:07
Add support for custom package index URLs to allow installing dependencies
from private registries. The --index-url CLI option can be repeated multiple
times to specify multiple indexes, which are tried in order before PyPI.

Changes:
- Add --index-url CLI argument with action='append' for multiple indexes
- Add index_urls parameter to run_mcp_server(), prepare_deno_env(),
  async_prepare_deno_env(), and code_sandbox()
- Pass index_urls through Deno/TypeScript layer to micropip.install()
- Update README with usage examples

Usage:
  uvx mcp-run-python --index-url https://private.repo.com/simple --deps pkg stdio

Python API:
  async with code_sandbox(
      dependencies=['pkg'],
      index_urls=['https://private.repo.com/simple']
  ) as sandbox:
      await sandbox.eval('import pkg')
@juan-abia juan-abia force-pushed the feat/index-url-support branch from 553272c to 81e9179 Compare January 13, 2026 14:31
- Always pass indexUrls to prepare_env (even if empty), matching how dependencies are handled
- Add repeatable --dep flag alongside existing --deps for CLI consistency with --index-url
- Mark --deps as deprecated but keep it working for backwards compatibility
micropip treats empty list [] differently from None - with [] it doesn't
fall back to PyPI. Using 'index_urls or None' ensures empty lists are
converted to None so PyPI fallback works correctly.
- Update README.md examples to use --dep (repeatable) instead of --deps
- Hide --deps from CLI help (argparse.SUPPRESS)
- Add DeprecationWarning when --deps is used
- Keep --deps working for backwards compatibility
- Add --dep and --index-url as repeatable args in Deno CLI (using collect)
- Update Python main.py to pass --dep= and --index-url= instead of comma-separated
- Add deprecation warnings when --deps or --index-urls are used
- Update Deno help text to show new args
- Keep backwards compatibility for old comma-separated format
- Add test for repeatable --dep flag
- test_cli_dep_multiple: test multiple --dep flags (--dep numpy --dep pydantic)
- test_cli_dep_and_deps_combined: test combining --dep and --deps
- test_cli_deps_deprecation_warning: verify deprecation warning is emitted
--index-urls was never a public option, so there's nothing to deprecate.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants