|
| 1 | +# Migration Guide: Schema v1.2.1 → v1.2.2 |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +Schema version 1.2.2 introduces **conda channel support** for Python dependencies, enabling packages to specify conda channels for package installation. This enhancement allows for more flexible dependency management, particularly for scientific packages that are distributed through specialized conda channels like `colomoto`, `conda-forge`, or `bioconda`. |
| 6 | + |
| 7 | +## Key Changes in v1.2.2 |
| 8 | + |
| 9 | +### 1. Conda Package Manager Support |
| 10 | + |
| 11 | +**v1.2.1 (Pip Only)**: |
| 12 | +```json |
| 13 | +{ |
| 14 | + "package_schema_version": "1.2.1", |
| 15 | + "dependencies": { |
| 16 | + "python": [ |
| 17 | + { |
| 18 | + "name": "numpy", |
| 19 | + "version_constraint": ">=1.20.0", |
| 20 | + "package_manager": "pip" |
| 21 | + } |
| 22 | + ] |
| 23 | + } |
| 24 | +} |
| 25 | +``` |
| 26 | + |
| 27 | +**v1.2.2 (Conda with Channel Support)**: |
| 28 | +```json |
| 29 | +{ |
| 30 | + "package_schema_version": "1.2.2", |
| 31 | + "dependencies": { |
| 32 | + "python": [ |
| 33 | + { |
| 34 | + "name": "maboss", |
| 35 | + "version_constraint": ">=2.5.0", |
| 36 | + "package_manager": "conda", |
| 37 | + "channel": "colomoto" |
| 38 | + }, |
| 39 | + { |
| 40 | + "name": "numpy", |
| 41 | + "version_constraint": ">=1.20.0", |
| 42 | + "package_manager": "pip" |
| 43 | + } |
| 44 | + ] |
| 45 | + } |
| 46 | +} |
| 47 | +``` |
| 48 | + |
| 49 | +### 2. New Channel Field |
| 50 | + |
| 51 | +The new optional `channel` field allows specifying conda channels: |
| 52 | + |
| 53 | +- **Type**: String (optional) |
| 54 | +- **Pattern**: `^[a-zA-Z0-9_\-]+$` |
| 55 | +- **Description**: Conda channel to use when `package_manager` is 'conda' |
| 56 | +- **Examples**: `"colomoto"`, `"conda-forge"`, `"bioconda"` |
| 57 | +- **Usage**: Only applicable when `package_manager` is `"conda"` |
| 58 | + |
| 59 | +## Migration Steps |
| 60 | + |
| 61 | +### Step 1: Update Schema Version |
| 62 | + |
| 63 | +Change the `package_schema_version` from `"1.2.1"` to `"1.2.2"`: |
| 64 | + |
| 65 | +```json |
| 66 | +{ |
| 67 | + "package_schema_version": "1.2.2" |
| 68 | +} |
| 69 | +``` |
| 70 | + |
| 71 | +### Step 2: Add Conda Dependencies (Optional) |
| 72 | + |
| 73 | +If your package requires conda packages, update the Python dependencies: |
| 74 | + |
| 75 | +**Before (v1.2.1)**: |
| 76 | +```json |
| 77 | +"dependencies": { |
| 78 | + "python": [ |
| 79 | + { |
| 80 | + "name": "some-package", |
| 81 | + "version_constraint": ">=1.0.0" |
| 82 | + } |
| 83 | + ] |
| 84 | +} |
| 85 | +``` |
| 86 | + |
| 87 | +**After (v1.2.2)**: |
| 88 | +```json |
| 89 | +"dependencies": { |
| 90 | + "python": [ |
| 91 | + { |
| 92 | + "name": "some-package", |
| 93 | + "version_constraint": ">=1.0.0", |
| 94 | + "package_manager": "conda", |
| 95 | + "channel": "conda-forge" |
| 96 | + } |
| 97 | + ] |
| 98 | +} |
| 99 | +``` |
| 100 | + |
| 101 | +## Common Use Cases |
| 102 | + |
| 103 | +### Scientific Computing Packages |
| 104 | + |
| 105 | +Many scientific packages are available through specialized conda channels: |
| 106 | + |
| 107 | +```json |
| 108 | +{ |
| 109 | + "dependencies": { |
| 110 | + "python": [ |
| 111 | + { |
| 112 | + "name": "maboss", |
| 113 | + "version_constraint": ">=2.5.0", |
| 114 | + "package_manager": "conda", |
| 115 | + "channel": "colomoto" |
| 116 | + }, |
| 117 | + { |
| 118 | + "name": "bioconductor-deseq2", |
| 119 | + "version_constraint": ">=1.30.0", |
| 120 | + "package_manager": "conda", |
| 121 | + "channel": "bioconda" |
| 122 | + }, |
| 123 | + { |
| 124 | + "name": "pytorch", |
| 125 | + "version_constraint": ">=1.9.0", |
| 126 | + "package_manager": "conda", |
| 127 | + "channel": "pytorch" |
| 128 | + } |
| 129 | + ] |
| 130 | + } |
| 131 | +} |
| 132 | +``` |
| 133 | + |
| 134 | +### Mixed Package Managers |
| 135 | + |
| 136 | +You can mix pip and conda dependencies in the same package: |
| 137 | + |
| 138 | +```json |
| 139 | +{ |
| 140 | + "dependencies": { |
| 141 | + "python": [ |
| 142 | + { |
| 143 | + "name": "numpy", |
| 144 | + "version_constraint": ">=1.20.0", |
| 145 | + "package_manager": "pip" |
| 146 | + }, |
| 147 | + { |
| 148 | + "name": "maboss", |
| 149 | + "version_constraint": ">=2.5.0", |
| 150 | + "package_manager": "conda", |
| 151 | + "channel": "colomoto" |
| 152 | + } |
| 153 | + ] |
| 154 | + } |
| 155 | +} |
| 156 | +``` |
| 157 | + |
| 158 | +## Validation Rules |
| 159 | + |
| 160 | +### Channel Field Validation |
| 161 | + |
| 162 | +- The `channel` field is **optional** |
| 163 | +- Only valid when `package_manager` is `"conda"` |
| 164 | +- Must match pattern: `^[a-zA-Z0-9_\-]+$` |
| 165 | +- Common valid channels: `colomoto`, `conda-forge`, `bioconda`, `pytorch`, `nvidia` |
| 166 | + |
| 167 | +### Package Manager Enum |
| 168 | + |
| 169 | +The `package_manager` field now accepts: |
| 170 | +- `"pip"` (default) |
| 171 | +- `"conda"` |
| 172 | + |
| 173 | +## Complete Example |
| 174 | + |
| 175 | +Here's a complete v1.2.2 package with conda channel support: |
| 176 | + |
| 177 | +```json |
| 178 | +{ |
| 179 | + "$schema": "https://raw.githubusercontent.com/crackingshells/Hatch-Schemas/main/package/v1.2.2/hatch_pkg_metadata_schema.json", |
| 180 | + "package_schema_version": "1.2.2", |
| 181 | + "name": "bioinformatics_package", |
| 182 | + "version": "1.0.0", |
| 183 | + "description": "A bioinformatics package with conda dependencies", |
| 184 | + "tags": ["bioinformatics", "conda"], |
| 185 | + "author": { |
| 186 | + "name": "Jane Doe", |
| 187 | + "email": "jane.doe@example.com" |
| 188 | + }, |
| 189 | + "license": { |
| 190 | + "name": "MIT" |
| 191 | + }, |
| 192 | + "entry_point": { |
| 193 | + "mcp_server": "mcp_server.py", |
| 194 | + "hatch_mcp_server": "hatch_mcp_server.py" |
| 195 | + }, |
| 196 | + "dependencies": { |
| 197 | + "python": [ |
| 198 | + { |
| 199 | + "name": "maboss", |
| 200 | + "version_constraint": ">=2.5.0", |
| 201 | + "package_manager": "conda", |
| 202 | + "channel": "colomoto" |
| 203 | + }, |
| 204 | + { |
| 205 | + "name": "biopython", |
| 206 | + "version_constraint": ">=1.78", |
| 207 | + "package_manager": "conda", |
| 208 | + "channel": "conda-forge" |
| 209 | + }, |
| 210 | + { |
| 211 | + "name": "requests", |
| 212 | + "version_constraint": ">=2.25.0", |
| 213 | + "package_manager": "pip" |
| 214 | + } |
| 215 | + ] |
| 216 | + } |
| 217 | +} |
| 218 | +``` |
| 219 | + |
| 220 | +## Backward Compatibility |
| 221 | + |
| 222 | +- **Existing v1.2.1 and earlier packages continue to work unchanged** |
| 223 | +- No breaking changes to existing packages |
| 224 | +- The `channel` field is optional and only used with conda |
| 225 | +- Migration to v1.2.2 is optional but recommended for packages requiring conda dependencies |
| 226 | + |
| 227 | +## Benefits of Migration |
| 228 | + |
| 229 | +1. **Conda Channel Support**: Access to specialized scientific package repositories |
| 230 | +2. **Flexible Package Management**: Mix pip and conda dependencies as needed |
| 231 | +3. **Better Scientific Computing Support**: Access to bioconda, conda-forge, and other channels |
| 232 | +4. **Future-Proof**: Foundation for additional package manager enhancements |
| 233 | + |
| 234 | +## Troubleshooting |
| 235 | + |
| 236 | +### Common Migration Issues |
| 237 | + |
| 238 | +**Issue**: Channel validation fails |
| 239 | +**Solution**: Ensure channel name matches pattern `^[a-zA-Z0-9_\-]+$` |
| 240 | + |
| 241 | +**Issue**: Channel specified with pip package manager |
| 242 | +**Solution**: Only use `channel` field when `package_manager` is `"conda"` |
| 243 | + |
| 244 | +**Issue**: Schema validation fails |
| 245 | +**Solution**: Ensure `package_schema_version` is exactly `"1.2.2"` |
| 246 | + |
| 247 | +### Getting Help |
| 248 | + |
| 249 | +- Check validation error messages for specific guidance |
| 250 | +- Refer to the complete examples in this guide |
| 251 | +- Review conda channel documentation for valid channel names |
| 252 | + |
| 253 | +## Next Steps |
| 254 | + |
| 255 | +After migration: |
| 256 | +1. Test your package with conda dependencies |
| 257 | +2. Update your documentation to reflect conda requirements |
| 258 | +3. Consider incrementing your package version to indicate the new capabilities |
| 259 | +4. Update any CI/CD pipelines to handle conda installations |
0 commit comments