rhapsody-cli 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rhapsody_cli-0.1.0/LICENSE +21 -0
- rhapsody_cli-0.1.0/PKG-INFO +395 -0
- rhapsody_cli-0.1.0/README.md +375 -0
- rhapsody_cli-0.1.0/pyproject.toml +97 -0
- rhapsody_cli-0.1.0/setup.cfg +4 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/__init__.py +21 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/actions/__init__.py +17 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/actions/abstract_action.py +259 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/actions/attribute_action.py +595 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/actions/class_action.py +708 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/actions/operation_action.py +606 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/actions/package_action.py +592 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/actions/port_action.py +565 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/actions/project_action.py +119 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/application.py +390 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/cli/__init__.py +5 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/cli/cli.py +102 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/cli/formatters.py +47 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/cli/logging_config.py +39 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/cli/main.py +6 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/cli/path_resolver.py +117 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/com_utils.py +54 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/commands/__init__.py +9 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/commands/abstract_command.py +92 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/commands/attribute_command.py +36 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/commands/class_command.py +38 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/commands/operation_command.py +36 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/commands/package_command.py +36 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/commands/port_command.py +36 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/commands/project_command.py +34 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/exceptions/__init__.py +9 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/exceptions/core.py +42 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/__init__.py +16 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/core.py +2263 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/__init__.py +15 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/activity/__init__.py +33 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/activity/model_actions.py +358 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/activity/model_activity.py +744 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/classifiers/__init__.py +27 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/classifiers/model_actor.py +76 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/classifiers/model_association_class.py +21 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/classifiers/model_class.py +461 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/classifiers/model_classifier.py +870 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/classifiers/model_interface_item.py +138 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/classifiers/model_operation.py +182 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/classifiers/model_statechart.py +108 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/classifiers/model_stereotype.py +23 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/classifiers/model_usecase.py +86 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/common/__init__.py +21 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/common/model_misc.py +45 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/common/model_other_model.py +822 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/containment/__init__.py +29 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/containment/model_collaboration.py +55 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/containment/model_component.py +59 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/containment/model_component_instance.py +20 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/containment/model_configuration.py +62 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/containment/model_module.py +17 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/containment/model_node.py +22 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/containment/model_package.py +285 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/containment/model_profile.py +17 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/containment/model_project.py +248 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/diagrams/__init__.py +31 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/diagrams/model_diagram_types.py +285 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/diagrams/model_diagrams.py +114 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/graphics/__init__.py +35 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/graphics/model_graphics.py +3053 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/interactions/__init__.py +29 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/interactions/model_interactions.py +1336 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/relations/__init__.py +23 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/relations/model_association_role.py +20 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/relations/model_dependency.py +23 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/relations/model_generalization.py +26 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/relations/model_hyperlink.py +25 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/relations/model_instance.py +224 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/relations/model_port.py +227 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/relations/model_relation.py +474 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/requirements/__init__.py +11 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/requirements/model_requirements.py +176 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/statemachine/__init__.py +11 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/statemachine/model_statemachine.py +793 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/templates/__init__.py +13 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/templates/model_templates.py +172 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/values/__init__.py +17 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/values/model_values.py +282 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/variables/__init__.py +15 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/elements/variables/model_variables.py +301 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/support/__init__.py +5 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/support/model_codegen.py +1749 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/support/model_files.py +438 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/models/support/model_ide.py +782 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli/py.typed +0 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli.egg-info/PKG-INFO +395 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli.egg-info/SOURCES.txt +95 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli.egg-info/dependency_links.txt +1 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli.egg-info/entry_points.txt +2 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli.egg-info/requires.txt +14 -0
- rhapsody_cli-0.1.0/src/rhapsody_cli.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 melodypapa
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rhapsody-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Pythonic wrapper around the IBM Rhapsody COM API, mirroring the Rhapsody Java API
|
|
5
|
+
License: MIT
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: pywin32>=306; sys_platform == "win32"
|
|
10
|
+
Provides-Extra: dev
|
|
11
|
+
Requires-Dist: pytest>=7.4; extra == "dev"
|
|
12
|
+
Requires-Dist: pytest-cov>=4.1; extra == "dev"
|
|
13
|
+
Requires-Dist: ruff>=0.4; extra == "dev"
|
|
14
|
+
Requires-Dist: black<25,>=24.1; extra == "dev"
|
|
15
|
+
Requires-Dist: mypy<2,>=1.8; extra == "dev"
|
|
16
|
+
Provides-Extra: cli
|
|
17
|
+
Requires-Dist: tabulate>=0.9; extra == "cli"
|
|
18
|
+
Requires-Dist: rich>=13.0; extra == "cli"
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
|
|
21
|
+
# rhapsody-cli
|
|
22
|
+
|
|
23
|
+
[](https://github.com/user/rhapsody-cli)
|
|
24
|
+
[](LICENSE)
|
|
25
|
+
[](https://www.python.org/downloads/)
|
|
26
|
+
[](https://www.microsoft.com/windows)
|
|
27
|
+
|
|
28
|
+
A Pythonic, object-oriented wrapper around the IBM Rhapsody COM API for
|
|
29
|
+
Windows. Method names and class hierarchy mirror the Rhapsody Java API
|
|
30
|
+
(`com.telelogic.rhapsody.core`) exactly, so existing Rhapsody Java API
|
|
31
|
+
knowledge and documentation transfer directly.
|
|
32
|
+
|
|
33
|
+
## Features
|
|
34
|
+
|
|
35
|
+
- **Complete API Mirroring**: Method names and signatures match the Rhapsody Java API exactly
|
|
36
|
+
- **Object-Oriented Design**: Clean Python classes wrapping COM objects with proper type hints
|
|
37
|
+
- **Comprehensive Element Support**: 50+ Rhapsody element types wrapped with full method coverage
|
|
38
|
+
- **CLI Tools**: Command-line utilities for element management, I/O operations, and project handling
|
|
39
|
+
- **Multi-Level Path Navigation**: Navigate hierarchical model structures using `/` or `\` separators
|
|
40
|
+
- **Bulk Operations**: Add multiple elements, query recursively, and delete with safety confirmations
|
|
41
|
+
- **Robust Error Handling**: Automatic COM error translation with user-friendly exception messages
|
|
42
|
+
- **Mocked Testing**: Full test suite runs without Rhapsody installation or license
|
|
43
|
+
- **Type Safety**: Strict mypy checking with comprehensive type annotations
|
|
44
|
+
- **Cross-Instance Support**: Manage multiple simultaneous Rhapsody instances in the same process
|
|
45
|
+
|
|
46
|
+
## Requirements
|
|
47
|
+
|
|
48
|
+
- Windows with a licensed IBM Rhapsody installation (COM automation is
|
|
49
|
+
Windows-only)
|
|
50
|
+
- Python 3.8+
|
|
51
|
+
- `pywin32` (automatically installed on Windows)
|
|
52
|
+
|
|
53
|
+
## Installation
|
|
54
|
+
|
|
55
|
+
### Basic Installation
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install rhapsody-cli
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Development Installation
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pip install -e ".[dev,cli]"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
This installs:
|
|
68
|
+
- **Core dependencies**: `pywin32` (Windows COM support)
|
|
69
|
+
- **CLI dependencies**: `tabulate`, `rich` (table formatting and colored output)
|
|
70
|
+
- **Dev dependencies**: `pytest`, `pytest-cov`, `ruff`, `black`, `mypy` (testing and linting)
|
|
71
|
+
|
|
72
|
+
## Usage
|
|
73
|
+
|
|
74
|
+
### Python API
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
from rhapsody_cli import RhapsodyApplication
|
|
78
|
+
|
|
79
|
+
# Attaches to a running Rhapsody instance, or launches a new one if none
|
|
80
|
+
# is running.
|
|
81
|
+
app = RhapsodyApplication.connect()
|
|
82
|
+
|
|
83
|
+
# Open an existing project
|
|
84
|
+
project = app.open_project(r"C:\Models\MyProject.rpy")
|
|
85
|
+
|
|
86
|
+
# Create a new package
|
|
87
|
+
package = project.addPackage("Sensors")
|
|
88
|
+
|
|
89
|
+
# Add classes with attributes and operations
|
|
90
|
+
sensor_class = package.addClass("TemperatureSensor")
|
|
91
|
+
sensor_class.addAttribute("currentTemperature")
|
|
92
|
+
sensor_class.addOperation("readTemperature")
|
|
93
|
+
|
|
94
|
+
# Navigate existing elements
|
|
95
|
+
for cls in project.get_nested_elements_by_meta_class("Class", 1): # recursive
|
|
96
|
+
print(f"Class: {cls.get_name()}")
|
|
97
|
+
for attr in cls.get_attributes():
|
|
98
|
+
print(f" Attribute: {attr.get_name()}")
|
|
99
|
+
|
|
100
|
+
# Save and quit
|
|
101
|
+
project.save()
|
|
102
|
+
app.quit()
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Command-Line Interface
|
|
106
|
+
|
|
107
|
+
The CLI provides three main command groups:
|
|
108
|
+
|
|
109
|
+
#### Element Management
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
# Add elements with multi-level paths
|
|
113
|
+
rhapsody-cli element add --type class --path "Sensors/TemperatureSensor"
|
|
114
|
+
rhapsody-cli element add --type actor --path "System/User" --name "AdminUser"
|
|
115
|
+
|
|
116
|
+
# View element details (supports JSON, CSV, table output)
|
|
117
|
+
rhapsody-cli element view --path "Sensors/TemperatureSensor" --output json
|
|
118
|
+
|
|
119
|
+
# Query elements with pattern matching
|
|
120
|
+
rhapsody-cli element query "Sensor*" --output table
|
|
121
|
+
rhapsody-cli element query --path "Sensors" --recursive
|
|
122
|
+
|
|
123
|
+
# Delete elements with safety confirmation
|
|
124
|
+
rhapsody-cli element delete "Sensors/OldSensor"
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
#### Project Management
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# Create a new project
|
|
131
|
+
rhapsody-cli project create --location "C:\Models" --name "NewProject"
|
|
132
|
+
|
|
133
|
+
# Open existing project
|
|
134
|
+
rhapsody-cli project open --file "C:\Models\MyProject.rpy"
|
|
135
|
+
|
|
136
|
+
# Attach to active project in running Rhapsody
|
|
137
|
+
rhapsody-cli project attach
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
#### I/O Operations
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# Export model to various formats
|
|
144
|
+
rhapsody-cli io export --format json --output model.json
|
|
145
|
+
|
|
146
|
+
# Import model data
|
|
147
|
+
rhapsody-cli io import --file import_data.json
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Global Options
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# Enable verbose logging
|
|
154
|
+
rhapsody-cli --verbose element query
|
|
155
|
+
|
|
156
|
+
# Specify output format
|
|
157
|
+
rhapsody-cli --output json element view --path " MyClass"
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Multi-Instance Support
|
|
161
|
+
|
|
162
|
+
```python
|
|
163
|
+
from rhapsody_cli import RhapsodyApplication
|
|
164
|
+
|
|
165
|
+
# Manage multiple simultaneous Rhapsody instances
|
|
166
|
+
app1 = RhapsodyApplication.attach() # Attach to first instance
|
|
167
|
+
app2 = RhapsodyApplication.launch() # Launch second instance
|
|
168
|
+
|
|
169
|
+
project1 = app1.open_project("project1.rpy")
|
|
170
|
+
project2 = app2.open_project("project2.rpy")
|
|
171
|
+
|
|
172
|
+
# Each instance operates independently
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Development
|
|
176
|
+
|
|
177
|
+
### Running Tests
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
# Run all unit tests (554 tests, no Rhapsody installation required)
|
|
181
|
+
pytest tests/unit
|
|
182
|
+
|
|
183
|
+
# Run with coverage
|
|
184
|
+
pytest --cov=rhapsody_cli --cov-report=html
|
|
185
|
+
|
|
186
|
+
# Run integration tests (requires running Rhapsody with open project)
|
|
187
|
+
pytest tests/integration
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Code Quality
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
# Format code
|
|
194
|
+
black src/ tests/
|
|
195
|
+
|
|
196
|
+
# Lint code
|
|
197
|
+
ruff check src/ tests/
|
|
198
|
+
|
|
199
|
+
# Type check
|
|
200
|
+
mypy src/ tests/
|
|
201
|
+
|
|
202
|
+
# All checks in one
|
|
203
|
+
pytest && ruff check src/ tests/ && black --check src/ tests/ && mypy src/ tests/
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Test Coverage
|
|
207
|
+
|
|
208
|
+
- **554 unit tests** covering all wrapped methods and edge cases
|
|
209
|
+
- **Mocked COM objects** (`tests/fakes.py`) - no Rhapsody installation required
|
|
210
|
+
- **Integration tests** for real COM automation verification
|
|
211
|
+
- **Branch coverage** tracking with 80% minimum threshold
|
|
212
|
+
|
|
213
|
+
## Architecture
|
|
214
|
+
|
|
215
|
+
### Core Design
|
|
216
|
+
|
|
217
|
+
The package follows a systematic wrapping pattern:
|
|
218
|
+
|
|
219
|
+
1. **Connection Layer**: `RhapsodyApplication` manages COM connections
|
|
220
|
+
2. **Wrapping Pattern**: Each wrapper stores `_com` and delegates all calls
|
|
221
|
+
3. **Type Registry**: Central registry maps Rhapsody types to Python wrappers
|
|
222
|
+
4. **Automatic Fallback**: Unknown types fall back to generic `RPModelElement`
|
|
223
|
+
5. **Collection Wrapping**: `RPCollection` provides Pythonic iteration
|
|
224
|
+
|
|
225
|
+
### Class Hierarchy
|
|
226
|
+
|
|
227
|
+
Mirrors the Rhapsody Java API hierarchy:
|
|
228
|
+
|
|
229
|
+
```
|
|
230
|
+
RPModelElement (wraps IRPModelElement - base for all model elements)
|
|
231
|
+
└─ RPUnit (wraps IRPUnit - elements that can be saved as files)
|
|
232
|
+
├─ RPProject (wraps IRPProject)
|
|
233
|
+
├─ RPPackage (wraps IRPPackage)
|
|
234
|
+
├─ RPClassifier (wraps IRPClassifier)
|
|
235
|
+
│ ├─ RPClass (wraps IRPClass)
|
|
236
|
+
│ ├─ RPActor (wraps IRPActor)
|
|
237
|
+
│ ├─ RPUseCase (wraps IRPUseCase)
|
|
238
|
+
│ └─ ... (15+ classifier types)
|
|
239
|
+
└─ ... (50+ total wrapped element types)
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Adding New Element Types
|
|
243
|
+
|
|
244
|
+
Supporting new Rhapsody element types is mechanical:
|
|
245
|
+
|
|
246
|
+
1. Define a wrapper class inheriting from the appropriate base
|
|
247
|
+
2. Implement methods delegating to `self._com`
|
|
248
|
+
3. Register in the type registry with `register_wrapper()`
|
|
249
|
+
4. Add unit tests following the established pattern
|
|
250
|
+
|
|
251
|
+
## Documentation
|
|
252
|
+
|
|
253
|
+
### Building Documentation Locally
|
|
254
|
+
|
|
255
|
+
The project uses **Sphinx** with the **ReadTheDocs theme** to generate comprehensive documentation including API reference, user guides, and examples.
|
|
256
|
+
|
|
257
|
+
#### Install Documentation Dependencies
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
pip install -r docs/requirements.txt
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
This installs:
|
|
264
|
+
- `sphinx>=4.0.0` - Documentation generator
|
|
265
|
+
- `sphinx-rtd-theme>=1.0.0` - ReadTheDocs theme
|
|
266
|
+
- `myst-parser>=0.18.0` - Markdown support for Sphinx
|
|
267
|
+
|
|
268
|
+
#### Generate HTML Documentation
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
# Navigate to docs directory
|
|
272
|
+
cd docs
|
|
273
|
+
|
|
274
|
+
# Build HTML documentation
|
|
275
|
+
make html
|
|
276
|
+
|
|
277
|
+
# On Windows (PowerShell)
|
|
278
|
+
.\make.bat html
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
The generated documentation will be in `docs/_build/html/`.
|
|
282
|
+
|
|
283
|
+
#### View Documentation Locally
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
# Open the main documentation page
|
|
287
|
+
start docs/_build/html/index.html # Windows
|
|
288
|
+
open docs/_build/html/index.html # macOS
|
|
289
|
+
xdg-open docs/_build/html/index.html # Linux
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
#### Alternative Build Formats
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
# Build PDF documentation (requires LaTeX)
|
|
296
|
+
make latexpdf
|
|
297
|
+
|
|
298
|
+
# Build coverage report (checks documentation coverage)
|
|
299
|
+
make coverage
|
|
300
|
+
|
|
301
|
+
# View all available build formats
|
|
302
|
+
make help
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
#### Documentation Structure
|
|
306
|
+
|
|
307
|
+
- **Design Document**: `docs/superpowers/specs/2026-07-06-rhapsody-cli-com-api-design.md`
|
|
308
|
+
- **API Reference**: `docs/api/` - auto-generated from docstrings using Sphinx autodoc
|
|
309
|
+
- **User Guide**: `docs/user_guide/` - comprehensive usage tutorials
|
|
310
|
+
- **Examples**: `docs/examples/` - advanced workflow examples
|
|
311
|
+
- **Code Guidelines**: `docs/CODE_GUIDELINES.md` - development standards
|
|
312
|
+
|
|
313
|
+
#### Deploying to ReadTheDocs
|
|
314
|
+
|
|
315
|
+
To deploy documentation to [ReadTheDocs.io](https://readthedocs.io):
|
|
316
|
+
|
|
317
|
+
1. **Create ReadTheDocs Project**: Import your GitHub repository at https://readthedocs.io
|
|
318
|
+
2. **Configure Build Settings**:
|
|
319
|
+
- Python interpreter: Python 3.x
|
|
320
|
+
- Requirements file: `docs/requirements.txt`
|
|
321
|
+
- Configuration file: `docs/conf.py`
|
|
322
|
+
3. **Enable Auto-Build**: ReadTheDocs automatically rebuilds on every push to main branch
|
|
323
|
+
4. **Access Online Docs**: Your documentation will be available at `https://rhapsody-cli.readthedocs.io`
|
|
324
|
+
|
|
325
|
+
#### Sphinx Configuration Features
|
|
326
|
+
|
|
327
|
+
The `docs/conf.py` configuration includes:
|
|
328
|
+
- **Autodoc extension**: Automatically generates API docs from Python docstrings
|
|
329
|
+
- **Napoleon extension**: Parses Google-style and NumPy-style docstrings
|
|
330
|
+
- **Myst parser**: Enables Markdown support alongside reStructuredText
|
|
331
|
+
- **Intersphinx**: Links to Python standard library documentation
|
|
332
|
+
- **Coverage checking**: Validates all modules are documented
|
|
333
|
+
- **Type hints**: Displays type annotations in documentation
|
|
334
|
+
|
|
335
|
+
## Supported Rhapsody Elements
|
|
336
|
+
|
|
337
|
+
The package currently wraps **50+ element types** including:
|
|
338
|
+
|
|
339
|
+
**Containment Elements**: Project, Package, Profile, Module, Configuration, Node, Component, ComponentInstance, Collaboration
|
|
340
|
+
|
|
341
|
+
**Classifier Elements**: Class, Actor, UseCase, InterfaceItem, Stereotype, Statechart, Operation, AssociationClass
|
|
342
|
+
|
|
343
|
+
**Relation Elements**: Relation, Instance, Dependency, Generalization, Hyperlink, AssociationRole
|
|
344
|
+
|
|
345
|
+
**Leaf Elements**: Attribute, Tag, Requirement, Variable, Annotation, Constraint, EnumerationLiteral, Diagram, Comment
|
|
346
|
+
|
|
347
|
+
Plus **hundreds of generic methods** from `RPModelElement` available on all element types.
|
|
348
|
+
|
|
349
|
+
## Contributing
|
|
350
|
+
|
|
351
|
+
See [Contributing Guide](docs/contributing.rst) for:
|
|
352
|
+
|
|
353
|
+
- Code style guidelines
|
|
354
|
+
- Test requirements
|
|
355
|
+
- Documentation standards
|
|
356
|
+
- Pull request process
|
|
357
|
+
|
|
358
|
+
## License
|
|
359
|
+
|
|
360
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
361
|
+
|
|
362
|
+
## Changelog
|
|
363
|
+
|
|
364
|
+
### v0.1.0 (2026-07-09)
|
|
365
|
+
|
|
366
|
+
- Initial release with 50+ wrapped Rhapsody element types
|
|
367
|
+
- Complete CLI tools for element, project, and I/O operations
|
|
368
|
+
- Multi-level path navigation with `/` and `\` separator support
|
|
369
|
+
- Comprehensive test suite (554 unit tests) with mocked COM objects
|
|
370
|
+
- Strict type checking with mypy
|
|
371
|
+
- Sphinx documentation with API reference and user guides
|
|
372
|
+
|
|
373
|
+
## Limitations
|
|
374
|
+
|
|
375
|
+
- **Windows-only**: Rhapsody COM automation is Windows-only
|
|
376
|
+
- **Requires Rhapsody License**: Actual COM calls require licensed Rhapsody installation
|
|
377
|
+
- **Not all 160+ interfaces**: Core ~50 types wrapped; others fall back to generic wrapper
|
|
378
|
+
- **No Design Manager**: Deprecated Design Manager features not supported
|
|
379
|
+
|
|
380
|
+
## Comparison with Rhapsody Java API
|
|
381
|
+
|
|
382
|
+
| Aspect | Java API | rhapsody-cli |
|
|
383
|
+
|--------|----------|--------------|
|
|
384
|
+
| Method Names | `getName()` | `get_name()` ✓ |
|
|
385
|
+
| Class Hierarchy | `IRPClass extends IRPClassifier` | `RPClass(RPClassifier)` ✓ |
|
|
386
|
+
| Collections | `IRPCollection` | `RPCollection` ✓ |
|
|
387
|
+
| Error Handling | COM errors | `RhapsodyRuntimeException` ✓ |
|
|
388
|
+
| Type Safety | Checked at compile | mypy strict mode ✓ |
|
|
389
|
+
| Testing | Requires Rhapsody | Mocked COM objects ✓ |
|
|
390
|
+
|
|
391
|
+
## Support
|
|
392
|
+
|
|
393
|
+
- **Issues**: GitHub Issues for bug reports and feature requests
|
|
394
|
+
- **Documentation**: Full API docs at `docs/api/` and user guide at `docs/user_guide/`
|
|
395
|
+
- **Examples**: Advanced usage patterns in `docs/examples/`
|