Skip to content

Conversation

@LittleCoinCoin
Copy link
Member

Summary

Implements v1.2.2 package schema with support for conda package manager and channel specification, enabling packages to specify conda as an alternative to pip for Python dependencies.

Changes

Core Infrastructure

  • feat(core): Add get_python_dependency_channel() method to PackageAccessorBase
    • Provides foundation for conda channel support
    • Returns None by default for backward compatibility

Feature Implementation

  • feat(schema): Complete v1.2.2 package schema implementation
    • PackageAccessorV1_2_2: Metadata accessor with conda channel support
    • PackageValidatorV1_2_2: Validator chain with delegation to v1.2.1
    • SchemaValidationStrategyV1_2_2: Schema validation for v1.2.2 format
    • DependencyValidationStrategyV1_2_2: Enhanced dependency validation

Integration

  • feat(factory): Register v1.2.2 components in factory classes

    • PackageAccessorFactory: Register PackageAccessorV1_2_2
    • ValidatorFactory: Register PackageValidatorV1_2_2
  • feat(service): Add conda channel retrieval to PackageService

    • Expose get_python_dependency_channel() through service layer
    • Maintains backward compatibility with earlier versions

Bug Fixes

  • fix(accessor): Correct v1.2.1 entry point return type
    • Fixed get_entry_point() to return full dict instead of string
    • Resolves test failures in test_package_service.py

Testing

  • test(v1.2.2): Comprehensive test coverage (15 tests, all passing)
    • 13 unit tests covering all validation scenarios
    • 2 integration tests for end-to-end workflows
    • Tests for conda packages, pip packages, and mixed dependencies
    • Channel validation and format testing

Features

Conda Package Manager Support

  • Python dependencies can specify package_manager: "conda" or package_manager: "pip"
  • Defaults to pip when package_manager is not specified
  • Conda packages support optional channel field (e.g., "conda-forge", "bioconda")

Validation Rules

  • ✅ Conda packages can have optional channel
  • ✅ Pip packages cannot have channel (validation error if present)
  • ✅ Invalid package managers are rejected
  • ✅ Channel format is validated (alphanumeric, hyphens, underscores)
  • ✅ Mixed pip and conda dependencies are supported

Backward Compatibility

  • Full delegation to v1.2.1 for unchanged operations
  • Proper chain of responsibility pattern maintained
  • All existing tests continue to pass

Example Usage

schema_version: "1.2.2"
python_dependencies:
  - name: numpy
    version: ">=1.20.0"
    package_manager: conda
    channel: conda-forge
  - name: pandas
    version: ">=1.3.0"
    package_manager: pip

Test Results

✅ V1.2.2 tests: 15/15 passing
✅ Package service tests: 4/4 passing
✅ Schema validators: 13/13 passing
✅ Registry service: 16/16 passing
✅ Dependency graph: 22/22 passing
✅ Total: 70+ tests passing

Commit Structure

Follows organization's conventional commit format:

  1. feat(core): Base accessor infrastructure
  2. feat(schema): v1.2.2 implementation
  3. feat(factory): Factory registration
  4. feat(service): Service layer enhancement
  5. fix(accessor): v1.2.1 bug fix
  6. test(v1.2.2): Comprehensive test coverage

Checklist

  • All tests pass
  • Conventional commit format followed
  • Backward compatibility maintained
  • Comprehensive test coverage added
  • Code follows chain of responsibility pattern
  • Documentation in code is clear and complete

Related Issues

Implements support for conda package manager as requested for enhanced package management flexibility.


Pull Request opened by Augment Code with guidance from the PR author

Add get_python_dependency_channel() method to PackageAccessorBase to
support retrieving conda channel information from package metadata.
This provides the foundation for v1.2.2 schema which introduces
conda package manager support with optional channel specification.

The method returns None by default, allowing version-specific
accessors to override with appropriate implementation.
Implement complete v1.2.2 package schema structure with support for
conda package manager and channel specification.

Key components:
- PackageAccessorV1_2_2: Metadata accessor with conda channel support
- PackageValidatorV1_2_2: Validator chain delegating to v1.2.1
- SchemaValidationStrategyV1_2_2: Schema validation for v1.2.2 format
- DependencyValidationStrategyV1_2_2: Enhanced dependency validation
  with conda package manager and channel support

Features:
- Python dependencies can specify package_manager: 'conda' or 'pip'
- Conda packages support optional 'channel' field (e.g., conda-forge)
- Validation ensures channel is only used with conda packages
- Channel format validation (alphanumeric, hyphens, underscores)
- Defaults to pip when package_manager not specified
- Full backward compatibility through delegation to v1.2.1
Update factory classes to support v1.2.2 schema version:
- PackageAccessorFactory: Register PackageAccessorV1_2_2
- ValidatorFactory: Register PackageValidatorV1_2_2

This enables automatic instantiation of v1.2.2 components when
processing packages with schema_version 1.2.2.
Add get_python_dependency_channel() method to PackageService to
expose conda channel information through the service layer.

This method delegates to the version-specific accessor, enabling
clients to retrieve channel information for conda packages in
v1.2.2 schema while maintaining backward compatibility with
earlier versions that return None.
Fix get_entry_point() method in PackageAccessorV1_2_1 to return
the full entry_point dict instead of just the mcp_server value.

Root cause: Method was returning metadata.get('entry_point').get('mcp_server')
which only returned the string value, but callers expected the full dict
with both mcp_server and hatch_mcp_server keys.

Solution: Return metadata.get('entry_point', {}) to provide full dict.
Update get_mcp_entry_point() to extract mcp_server value from the dict.

This fixes test failures in test_package_service.py where entry_point
was expected to be a dict but received a string.
Add complete test suite for v1.2.2 schema validation and conda
package manager support.

Unit tests (test_package_validator_for_v1_2_2.py):
- Schema validation for v1.2.2 format
- Conda package manager validation
- Channel specification validation
- Mixed pip/conda dependency validation
- Invalid package manager rejection
- Channel format validation
- Backward compatibility with v1.2.1

Integration tests (test_v1_2_2_integration.py):
- End-to-end validation with conda packages
- Service layer integration
- Factory instantiation

Test coverage: 15 tests, all passing
- 13 unit tests covering all validation scenarios
- 2 integration tests for end-to-end workflows
@LittleCoinCoin LittleCoinCoin merged commit d9f9c3d into dev Nov 4, 2025
1 check passed
cracking-shells-semantic-release bot pushed a commit that referenced this pull request Dec 4, 2025
## 0.8.0 (2025-12-04)

* Merge pull request #16 from CrackingShells/dev ([c5c57ce](c5c57ce)), closes [#16](#16)
* Merge pull request #17 from CrackingShells/feature/v1-2-2-conda-support ([d9f9c3d](d9f9c3d)), closes [#17](#17)
* Merge pull request #18 from CrackingShells/dev ([91e9c76](91e9c76)), closes [#18](#18)
* chore: add submodule `cracking-shells-playbook` ([3e7df1e](3e7df1e))
* chore: npm-audit-fix ([8752d47](8752d47))
* chore(release): 0.8.0-dev.1 [skip ci] ([a631656](a631656))
* chore(release): 0.8.0-dev.2 ([ca4f5aa](ca4f5aa))
* fix(accessor): correct v1.2.1 entry point return type ([f90d251](f90d251))
* fix(ci): wrong location of npm package in `.releaserc.sjon` ([0a1d5bd](0a1d5bd))
* ci: add automated PyPI publishing ([82b7316](82b7316))
* ci: migrate to semantic-release ([f05f0cc](f05f0cc))
* test(v1.2.2): add comprehensive test coverage for conda support ([6cfddf1](6cfddf1))
* feat(core): add base accessor method for conda channel support ([e69711b](e69711b))
* feat(factory): register v1.2.2 accessor and validator ([bf73160](bf73160))
* feat(schema): implement v1.2.2 package schema with conda support ([4e2be30](4e2be30))
* feat(service): add conda channel retrieval to PackageService ([d129b65](d129b65))
* docs: diagrams ([7d0f98a](7d0f98a))
* docs: first pass on whole package docs ([02b37f3](02b37f3))
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.

2 participants