Metadata-Version: 2.4
Name: dataplex-sm-cli
Version: 0.2.1
Summary: A CLI tool for Dataplex Semantic Model operations with YAML validation
Home-page: https://github.com/Sachin-Rungta/dataplex-sm-cli
Author: Sachin Rungta
Author-email: Sachin Rungta <sachin.rungta@example.com>
License: MIT
Keywords: cli,dataplex,semantic-model
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: click>=8.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Requires-Dist: black>=22.0; extra == "dev"
Requires-Dist: flake8>=4.0; extra == "dev"
Requires-Dist: mypy>=0.950; extra == "dev"
Dynamic: author
Dynamic: home-page
Dynamic: requires-python

# dataplex-sm-cli

A powerful and extensible CLI tool for managing Dataplex Semantic Models. This CLI can be installed in any Python project via pip.

## Features

- 🚀 Easy installation via pip
- 🎯 Semantic model management (create, delete, list)
- ⚙️ Configuration management
- 🔧 Extensible command structure
- ✅ YAML validation using js-yaml (npm package)
- 📝 Well-documented commands with examples

## Installation

### Requirements

- Python 3.8+
- Node.js 14+ (required for YAML validation)
- npm (comes with Node.js)

### Install Node.js

**Linux (Ubuntu/Debian):**
```bash
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs
```

**macOS (Homebrew):**
```bash
brew install node
```

**Windows:**
Download from https://nodejs.org/ or use:
```bash
choco install nodejs
```

**Verify Installation:**
```bash
node --version
npm --version
```

### From Source (Development)

```bash
# Clone the repository
git clone https://github.com/Sachin-Rungta/dataplex-sm-cli.git
cd dataplex-sm-cli

# Install Node.js dependencies for YAML validator
npm install

# Install Python package in development mode
pip install -e .
```

### From PyPI (Once Published)

```bash
pip install dataplex-sm-cli
```

### In Any Project

Once installed, you can use the CLI from any directory:

```bash
pip install dataplex-sm-cli
dataplex-sm --help
```

## Usage

### Get Help

```bash
dataplex-sm --help
dataplex-sm --version
```

### Model Commands

#### Create a semantic model
```bash
dataplex-sm model create --name my-model --description "My model" --project my-project
```

#### List all models
```bash
dataplex-sm model list --project my-project
```

#### Delete a model
```bash
dataplex-sm model delete --name my-model --project my-project
```

### Configuration Commands

#### Set a configuration value
```bash
dataplex-sm config set --key project-id --value my-project
```

#### Get configuration
```bash
dataplex-sm config get --key project-id
dataplex-sm config get  # Get all values
```

### YAML Validation Commands

Validate YAML files using the js-yaml npm package:

```bash
dataplex-sm validate-yaml config.yaml
dataplex-sm validate-yaml path/to/file.yaml
```

The validator will:
- Check YAML syntax validity
- Parse YAML structure
- Report errors with line and column numbers
- Display clear success/failure messages

## Development

### Setup Development Environment

```bash
# Install with dev dependencies
pip install -e ".[dev]"
```

### Run Tests

```bash
pytest tests/
pytest tests/ --cov=dataplex_sm_cli  # With coverage
```

### Code Quality

```bash
# Format code
black dataplex_sm_cli/ tests/

# Lint
flake8 dataplex_sm_cli/ tests/

# Type checking
mypy dataplex_sm_cli/
```

## Project Structure

```
dataplex-sm-cli/
├── dataplex_sm_cli/
│   ├── __init__.py          # Package initialization
│   └── cli.py               # Main CLI implementation
├── tests/
│   ├── __init__.py
│   └── test_cli.py          # CLI tests
├── pyproject.toml           # Modern Python project config
├── setup.py                 # Setup script for pip
├── README.md                # This file
└── .gitignore               # Git ignore rules
```

## Adding New Commands

To add new commands to the CLI, edit `dataplex_sm_cli/cli.py`:

```python
@main.command()
@click.option("--option", help="Option help text")
def my_command(option):
    """Command help text."""
    click.echo(f"Executing my-command with option: {option}")
```

Then add tests in `tests/test_cli.py`:

```python
def test_my_command(runner):
    result = runner.invoke(main, ["my-command", "--option", "value"])
    assert result.exit_code == 0
    assert "expected output" in result.output
```

## Publishing to PyPI

```bash
# Build the package
pip install build
python -m build

# Upload to PyPI (requires credentials)
pip install twine
twine upload dist/*
```

## Requirements

- Python 3.8+
- Node.js 14+ (for YAML validation)
- npm
- click >= 8.0.0 (Python)
- js-yaml >= 4.1.0 (npm)

## NPM Dependencies

The project uses the following npm package for YAML validation:
- **js-yaml**: A JavaScript YAML parser and serializer with excellent error reporting

Install npm dependencies with:
```bash
npm install
```

## License

MIT License

## Contributing

Contributions are welcome! Please feel free to submit a pull request.
