feat: private registry support (index_url / extra_index_url)#6
feat: private registry support (index_url / extra_index_url)#6
Conversation
|
@copilot fix the conflicts |
|
@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. |
There was a problem hiding this comment.
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_urlto environment create/request/response types (frontend + backend). - Plumbed registry URLs into
uv pip installcommand 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.
|
|
||
| revision = "001_add_registry_urls" | ||
| down_revision = None | ||
| branch_labels = None | ||
| depends_on = None |
There was a problem hiding this comment.
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.
| description: str | None = None | ||
| index_url: str | None = None | ||
| extra_index_url: str | None = None |
There was a problem hiding this comment.
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.
| description: str | None = None | ||
| index_url: str | None = None | ||
| extra_index_url: str | None = None |
There was a problem hiding this comment.
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.
| description: str | None = None | ||
| index_url: str | None = None | ||
| extra_index_url: str | None = None |
There was a problem hiding this comment.
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).
| if index_url: | ||
| cmd += ["--index-url", index_url] | ||
| if extra_index_url: | ||
| cmd += ["--extra-index-url", extra_index_url] |
There was a problem hiding this comment.
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.
| 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] |
| 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, | ||
| ), |
There was a problem hiding this comment.
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 open a new pull request to apply changes based on the comments in this thread |
|
@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>
3cff184 to
63139e9
Compare
Summary
Adds support for private Python package registries when creating environments.
index_urlandextra_index_urlfields to environment creationChanges
feat: add private registry support with index_url and extra_index_url