Python package for IBM Maximo DevOps utilities. Provides command-line tools for deployment automation, database validation, Slack notifications, and user management. Distributed as installable package with setup.py/pyproject.toml and standalone scripts in bin/.
- bin/: Executable CLI scripts (entry points)
mas-devops-*: Command-line tools for specific operations- Scripts import from
src/package for implementation - Each script typically wraps a single operational task
- src/: Main package source code
- Organized by module/function (import path:
from mas_devops import ...) - Core utilities: configuration management, API clients, database handlers
- Organized by module/function (import path:
- test/: Test suite (pytest structure)
- Mirror
src/structure in test files - Run with
pytestormake test
- Mirror
- build/: Generated artifacts (don't edit)
*.egg-info/: Package metadatadist/,*.whl: Distribution packages
- setup.py / pyproject.toml: Package definition
- Entry points defined in setup.py pointing to
bin/scripts - Dependencies in both files (must keep in sync)
- Version defined once (check both files)
- Entry points defined in setup.py pointing to
- CLI Tool Pattern:
bin/mas-devops-*scripts are thin wrappers- Import main logic from
src/mas_devops/ - Handle argument parsing and error reporting
- Example:
mas-devops-notify-slack→ calls slack notification module
- Import main logic from
- Dependency Management:
- Core dependencies in
setup.pyinstall_requires - Dev dependencies in
setup.pyextras_require['dev'] requirements.txtfor pinned versions (reproducible installs)- Keep all three in sync
- Core dependencies in
- Entry Points:
setup.pydefines CLI commands- Format:
'mas-devops-task-name = mas_devops.module:main_function' - Creates executable scripts in
bin/when package installed
- Format:
- Module Organization: Import directly from package
from mas_devops.db2_validator import validate_config- Avoid deep nesting; keep public API clear
make install # Install package in dev mode (pip install -e .)
make test # Run pytest suite
make test-verbose # Pytest with verbose output
make build # Build distribution (wheel/tarball)
make clean # Remove build artifacts
make all # Clean, test, build- Python Version: Check
setup.pyforpython_requires(e.g.,>=3.8) - Entry Points: Adding new CLI tool requires editing
setup.pyentry_points section - Error Handling: CLI scripts should catch exceptions and exit with meaningful error messages
- Logging: Use Python logging module; configure in main module
- Testing: Test structure mirrors source; test file for
src/module.pyistest/test_module.py - Documentation: Docstrings in functions should describe parameters, return, exceptions
- Imports: Use absolute imports from package (
from mas_devops import ...), not relative
mas-devops-create-initial-users-for-saas: User provisioning (SaaS)mas-devops-db2-validate-config: Validate DB2 configurationmas-devops-notify-slack: Send notificationsmas-devops-saas-job-cleaner: Cleanup SaaS jobs
- ansible-devops: Playbooks call these Python utilities for infrastructure setup
- playbook: Runbooks document procedures; Python tools automate them
- Standalone Usage: Scripts can be called independently or from other tools via entry points
- Distribution: Package installed via pip; entry points register CLI commands globally
- Create implementation module in
src/mas_devops/ - Create script in
bin/mas-devops-tool-nameor updatesetup.pyentry_points - Add entry to
setup.pyentry_points section - Add tests in
test/matching module structure - Update
requirements.txtif adding dependencies - Test with
make installthen runmas-devops-tool-name --help
- Build:
python -m buildormake build - Outputs: wheel file in
dist/ready for pip install - Version managed in
setup.py(check both setup.py and pyproject.toml)