Skip to content

feat: private registry support (index_url / extra_index_url)#6

Merged
raffelino merged 1 commit intomainfrom
feat/private-registry-support
Mar 10, 2026
Merged

feat: private registry support (index_url / extra_index_url)#6
raffelino merged 1 commit intomainfrom
feat/private-registry-support

Conversation

@raffelino
Copy link
Collaborator

Summary

Adds support for private Python package registries when creating environments.

  • Adds index_url and extra_index_url fields to environment creation
  • Includes DB migration for new fields
  • i18n strings for all supported languages
  • Unit tests for registry URL handling

Changes

  • feat: add private registry support with index_url and extra_index_url

@raffelino
Copy link
Collaborator Author

@copilot fix the conflicts

Copy link

Copilot AI commented Mar 10, 2026

@raffelino I've opened a new pull request, #8, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for configuring private Python package registries per Environment by introducing index_url and extra_index_url across the UI, API, persistence layer, and package-install execution flow.

Changes:

  • Added index_url / extra_index_url to environment create/request/response types (frontend + backend).
  • Plumbed registry URLs into uv pip install command construction and task execution; added unit tests for command generation and API create behavior.
  • Introduced an Alembic migration to add the new DB columns and added i18n strings + UI controls for registry settings.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
frontend/src/views/EnvironmentsView.vue Adds registry settings fields to the “Add Environment” dialog and sends them on create.
frontend/src/types/domain.types.ts Extends Environment domain type with registry URL fields.
frontend/src/types/api.types.ts Extends EnvCreateRequest API type with registry URL fields.
frontend/src/i18n/locales/en.ts Adds English UI strings for registry settings.
frontend/src/i18n/locales/fr.ts Adds French UI strings for registry settings.
frontend/src/i18n/locales/es.ts Adds Spanish UI strings for registry settings.
frontend/src/i18n/locales/de.ts Adds German UI strings for registry settings.
backend/src/environments/venv_utils.py Extends pip_install_cmd to include --index-url / --extra-index-url.
backend/src/environments/tasks.py Passes env registry URLs into install/upgrade package tasks.
backend/src/environments/service.py Persists and clones the new registry URL fields.
backend/src/environments/schemas.py Adds registry URL fields to create/update/response schemas.
backend/src/environments/models.py Adds index_url / extra_index_url columns to the Environment model.
backend/migrations/versions/001_add_registry_urls.py Alembic migration adding the new DB columns.
backend/tests/environments/test_venv_utils.py Tests pip_install_cmd behavior with index URL flags.
backend/tests/environments/test_router.py Tests environment creation with/without registry URLs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +10 to +14

revision = "001_add_registry_urls"
down_revision = None
branch_labels = None
depends_on = None
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

This Alembic migration may not be applied in deployments where the app relies on create_tables() + the in-code _run_migrations() (see src/main.py and src/database.py). If existing DBs are upgraded without running Alembic, the new environments.index_url / extra_index_url columns will be missing and ORM queries will fail. Either ensure Alembic is always run in the deployment path, or extend the lightweight migration helpers to add these columns for both SQLite and Postgres.

Copilot uses AI. Check for mistakes.
Comment on lines 15 to +17
description: str | None = None
index_url: str | None = None
extra_index_url: str | None = None
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

index_url / extra_index_url are persisted as String(500) in the DB, but the API schema doesn’t enforce any max length or whitespace trimming. Add validation (e.g., Field(max_length=500) and/or stripping) so oversized values don’t cause DB errors and accidental leading/trailing spaces don’t break installs.

Copilot uses AI. Check for mistakes.
Comment on lines 27 to +29
description: str | None = None
index_url: str | None = None
extra_index_url: str | None = None
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

Same as EnvCreate: add validation for index_url / extra_index_url (length limit, whitespace stripping). Without it, PATCH requests can store invalid values that later cause uv pip to fail or DB writes to error.

Copilot uses AI. Check for mistakes.
Comment on lines 41 to +43
description: str | None = None
index_url: str | None = None
extra_index_url: str | None = None
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

These registry URLs are returned in EnvResponse and the GET /environments endpoint is accessible to any authenticated user. If a user embeds credentials/tokens in the URL (e.g., https://user:token@host/simple), they will be exposed to other users and potentially to logs/clients. Consider rejecting URLs with userinfo, or masking credentials in responses / storing credentials separately (e.g., secrets).

Copilot uses AI. Check for mistakes.
Comment on lines +63 to +66
if index_url:
cmd += ["--index-url", index_url]
if extra_index_url:
cmd += ["--extra-index-url", extra_index_url]
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

if index_url: / if extra_index_url: will treat whitespace-only strings as truthy and emit --index-url ' ', causing installs to fail. Since the UI doesn’t trim input, consider normalizing (strip and treat empty-as-None) before appending these flags.

Suggested change
if index_url:
cmd += ["--index-url", index_url]
if extra_index_url:
cmd += ["--extra-index-url", extra_index_url]
normalized_index_url = index_url.strip() if isinstance(index_url, str) else None
normalized_extra_index_url = (
extra_index_url.strip() if isinstance(extra_index_url, str) else None
)
if normalized_index_url:
cmd += ["--index-url", normalized_index_url]
if normalized_extra_index_url:
cmd += ["--extra-index-url", normalized_extra_index_url]

Copilot uses AI. Check for mistakes.
Comment on lines 167 to +173
subprocess.run(
pip_install_cmd(env.venv_path, pkg_spec),
pip_install_cmd(
env.venv_path,
pkg_spec,
index_url=env.index_url,
extra_index_url=env.extra_index_url,
),
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

Now that registry URLs can be passed through from the DB, be careful about leaking embedded credentials into logs/error messages. CalledProcessError.stderr often contains the effective index URL; consider sanitizing/redacting any userinfo before logging or returning message to the caller.

Copilot uses AI. Check for mistakes.
@raffelino
Copy link
Collaborator Author

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link

Copilot AI commented Mar 10, 2026

@raffelino I've opened a new pull request, #9, to work on those changes. Once the pull request is ready, I'll request review from you.

Allow environments to configure custom PyPI registry URLs for package
installation. Adds index_url (replaces default PyPI) and extra_index_url
(additional index) fields to the Environment model, with Alembic migration,
schema updates, frontend form fields, i18n (EN/DE/FR/ES), and tests.

- Add index_url and extra_index_url columns to environments table
- Pass --index-url and --extra-index-url flags to uv pip install
- Add collapsible registry settings in environment create dialog
- Carry over registry URLs when cloning environments
- Add 4 venv_utils tests for registry URL command building
- Add 2 router tests for registry URL CRUD

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@raffelino raffelino force-pushed the feat/private-registry-support branch from 3cff184 to 63139e9 Compare March 10, 2026 10:20
@raffelino raffelino merged commit 72dcacd into main Mar 10, 2026
1 check passed
@raffelino raffelino deleted the feat/private-registry-support branch March 10, 2026 10:46
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.

3 participants