feat: add pip_indices support for custom PyPI repositories#258
Open
basnijholt wants to merge 14 commits intomainfrom
Open
feat: add pip_indices support for custom PyPI repositories#258basnijholt wants to merge 14 commits intomainfrom
basnijholt wants to merge 14 commits intomainfrom
Conversation
- Add pip_indices field to ParsedRequirements and CondaEnvironmentSpec - Parse pip_indices from both requirements.yaml and pyproject.toml - Support environment variable expansion for credentials ( syntax) - Map pip_indices to pip_repositories in environment.yaml for conda-lock - Implement --index-url (primary) and --extra-index-url (supplementary) flags - Add comprehensive unit tests and integration tests - Support both pip and uv backends with same index flag interface - Maintain backward compatibility (empty list default) - Preserve index order (first is primary, rest are supplementary)
- Fix file handle usage with Path.open() instead of open() - Add type annotations to test methods and fixtures - Comment out unused test variables - Add type annotation for empty list initialization - Fix unused mock_monorepo argument
- Remove commented-out code (ERA001) from test_pip_indices.py and test_pip_indices_integration.py - Add missing pip_indices argument to create_conda_env_specification calls - Fix type annotations: use list[str] instead of list[Platform] with type ignores where needed - Add __future__ annotations import and update typing imports - Fix unused arguments with noqa comments - Consolidate nested with statements - Mark hardcoded test password with noqa comment - Clean up indentation issues All pre-commit hooks now pass: ruff, ruff-format, and mypy
- Add pip_indices to the list of supported configuration keys - Include examples in both requirements.yaml and pyproject.toml formats - Create dedicated "Custom Pip Index URLs" section with: - Clear explanation of use cases (private packages, mirrors, authenticated repos) - How it works (primary vs extra indices, env var expansion, deduplication) - Practical examples for common scenarios (GitLab, Artifactory, PyTorch) - Generated environment.yaml output format - Security best practices for credentials - Update table of contents to include new section - Reference Conda CEP-8 specification for pip_repositories field The documentation provides clear guidance for users needing to access private or alternative package repositories while maintaining security best practices.
- Change _pip_install to _pip_install_local (the actual function name) - Change generate_conda_lock to conda_lock_command (the actual function name) This fixes the CI test failures caused by attempting to mock non-existent functions.
- Test _build_pip_index_arguments function with various scenarios - Test environment variable expansion in pip indices - Test pip and uv command construction with indices - Test install command with pip_indices - Test conda environment file generation with pip_repositories - Test full workflow integration from parsing to environment generation - Add edge case tests for missing environment variables - Test conda-lock integration with pip_indices
- Changed back from list[str] to list[Platform] - Removed unnecessary # type: ignore[arg-type] comments - Added proper import of Platform from unidep.platform_definitions This corrects a mistake where I incorrectly changed the type annotations to work around an import issue instead of fixing the import properly.
The pip_repositories field is not part of any official Conda Enhancement Proposal (CEP). CEP-8 (PR #8 in conda/ceps) is actually about menuinst multiplatform support, not pip repositories. The pip_repositories field appears to be an unofficial extension that may be used by conda-lock or other tools, but it's not a formal specification.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #257.
📚 Documentation preview 📚: https://unidep--258.org.readthedocs.build/en/258/