|
| 1 | +# VCSPull Package Structure |
| 2 | + |
| 3 | +This document outlines the structure of the modernized VCSPull package. |
| 4 | + |
| 5 | +## Directory Structure |
| 6 | + |
| 7 | +``` |
| 8 | +src/vcspull/ |
| 9 | +├── __about__.py # Package metadata |
| 10 | +├── __init__.py # Package initialization |
| 11 | +├── _internal/ # Internal utilities |
| 12 | +│ ├── __init__.py |
| 13 | +│ └── logger.py # Logging utilities |
| 14 | +├── cli/ # Command-line interface |
| 15 | +│ ├── __init__.py |
| 16 | +│ └── commands.py # CLI command implementations |
| 17 | +├── config/ # Configuration handling |
| 18 | +│ ├── __init__.py |
| 19 | +│ ├── loader.py # Configuration loading functions |
| 20 | +│ └── models.py # Configuration models |
| 21 | +└── vcs/ # Version control system interfaces |
| 22 | + ├── __init__.py |
| 23 | + ├── base.py # Base VCS interface |
| 24 | + ├── git.py # Git implementation |
| 25 | + ├── mercurial.py # Mercurial implementation |
| 26 | + └── svn.py # Subversion implementation |
| 27 | +``` |
| 28 | + |
| 29 | +## Module Responsibilities |
| 30 | + |
| 31 | +### Configuration (`config/`) |
| 32 | + |
| 33 | +- **models.py**: Defines Pydantic models for configuration |
| 34 | +- **loader.py**: Provides functions for loading and resolving configuration files |
| 35 | + |
| 36 | +### Version Control Systems (`vcs/`) |
| 37 | + |
| 38 | +- **base.py**: Defines the abstract interface for VCS operations |
| 39 | +- **git.py**, **mercurial.py**, **svn.py**: Implementations for specific VCS types |
| 40 | + |
| 41 | +### Command-line Interface (`cli/`) |
| 42 | + |
| 43 | +- **commands.py**: Implements CLI commands and argument parsing |
| 44 | + |
| 45 | +### Internal Utilities (`_internal/`) |
| 46 | + |
| 47 | +- **logger.py**: Logging utilities for the package |
| 48 | + |
| 49 | +## Configuration Format |
| 50 | + |
| 51 | +VCSPull uses a YAML or JSON configuration format with the following structure: |
| 52 | + |
| 53 | +```yaml |
| 54 | +settings: |
| 55 | + sync_remotes: true |
| 56 | + default_vcs: git |
| 57 | + depth: 1 |
| 58 | + |
| 59 | +repositories: |
| 60 | + - name: example-repo |
| 61 | + url: https://github.com/user/repo.git |
| 62 | + path: ~/code/repo |
| 63 | + vcs: git |
| 64 | + rev: main |
| 65 | + remotes: |
| 66 | + upstream: https://github.com/upstream/repo.git |
| 67 | + web_url: https://github.com/user/repo |
| 68 | + |
| 69 | +includes: |
| 70 | + - ~/other-config.yaml |
| 71 | +``` |
| 72 | +
|
| 73 | +## Usage |
| 74 | +
|
| 75 | +```python |
| 76 | +from vcspull import load_config |
| 77 | + |
| 78 | +# Load configuration |
| 79 | +config = load_config("~/.config/vcspull/vcspull.yaml") |
| 80 | + |
| 81 | +# Access repositories |
| 82 | +for repo in config.repositories: |
| 83 | + print(f"{repo.name}: {repo.url} -> {repo.path}") |
| 84 | +``` |
| 85 | +
|
| 86 | +## Implemented Features |
| 87 | +
|
| 88 | +The following features have been implemented according to the modernization plan: |
| 89 | +
|
| 90 | +1. **Configuration Format & Structure** |
| 91 | + - Defined Pydantic v2 models for configuration |
| 92 | + - Implemented comprehensive validation logic |
| 93 | + - Created configuration loading functions |
| 94 | + - Added include resolution logic |
| 95 | + - Implemented configuration merging functions |
| 96 | +
|
| 97 | +2. **Validation System** |
| 98 | + - Migrated all validation to Pydantic v2 models |
| 99 | + - Used Pydantic's built-in validation capabilities |
| 100 | + - Created clear type aliases |
| 101 | + - Implemented path expansion and normalization |
| 102 | +
|
| 103 | +3. **Testing System** |
| 104 | + - Reorganized tests to mirror source code structure |
| 105 | + - Created separate unit test directories |
| 106 | + - Implemented test fixtures for configuration files |
| 107 | +
|
| 108 | +4. **Internal APIs** |
| 109 | + - Reorganized codebase according to proposed structure |
| 110 | + - Separated public and private API components |
| 111 | + - Created logical module organization |
| 112 | + - Standardized function signatures |
| 113 | + - Implemented clear parameter and return types |
| 114 | + - Added comprehensive docstrings with type information |
| 115 | +
|
| 116 | +5. **External APIs** |
| 117 | + - Created dedicated API module |
| 118 | + - Implemented load_config function |
| 119 | + - Defined public interfaces |
| 120 | +
|
| 121 | +6. **CLI System** |
| 122 | + - Implemented basic CLI commands |
| 123 | + - Added configuration handling in CLI |
| 124 | + - Created command structure |
| 125 | +
|
| 126 | +## Next Steps |
| 127 | +
|
| 128 | +The following features are planned for future implementation: |
| 129 | +
|
| 130 | +1. **VCS Operations** |
| 131 | + - Implement full synchronization logic |
| 132 | + - Add support for remote management |
| 133 | + - Implement revision locking |
| 134 | +
|
| 135 | +2. **CLI Enhancements** |
| 136 | + - Add progress reporting |
| 137 | + - Implement rich output formatting |
| 138 | + - Add repository detection command |
| 139 | +
|
| 140 | +3. **Documentation** |
| 141 | + - Generate JSON schema documentation |
| 142 | + - Create example configuration files |
| 143 | + - Update user documentation with new format |
0 commit comments