Metadata-Version: 2.4
Name: pynop-cli
Version: 0.1.1
Summary: Python NopCommerce CLI and DB access (MSSQL/pyodbc)
Author: Sync Team
License: MIT
Keywords: nopcommerce,mssql,pyodbc,cli
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: pyodbc>=4.0.30
Requires-Dist: python-slugify>=5.0.0
Requires-Dist: pymongo>=3.12.0
Requires-Dist: pymsteams>=0.2.2
Requires-Dist: slack_sdk>=3.35.0
Requires-Dist: requests>=2.26.0
Requires-Dist: urllib3>=1.26.0
Requires-Dist: numpy>=1.24.0
Requires-Dist: simplejson>=3.17.0
Requires-Dist: ImageHash>=4.3.0
Requires-Dist: Pillow>=9.0.0
Requires-Dist: python-magic>=0.4.24; platform_system != "Windows"
Requires-Dist: python-magic-bin>=0.4.14; platform_system == "Windows"
Provides-Extra: dev
Requires-Dist: pytest>=6.0; extra == "dev"

# pynop-cli

Python NopCommerce CLI and database access for MSSQL (pyodbc). Extracted from the sync project for standalone use.

## Features

- **DB layer**: `AutoDao` and `DB` for MSSQL (pyodbc) with parameterized queries.
- **NopCommerce helpers**: `NopTool`, `NopData`, `NopQuery` for product, category, picture, manufacturer, and related Nop entities.
- **CLI**: `nopcommerce` command for quick queries and inspections.

## Installation

```bash
pip install -e .
# or from PyPI (when published): pip install pynop-cli
```

Requires **ODBC Driver 17 for SQL Server** (or compatible) and a working MSSQL instance.

## Configuration

Connection is via a config dict or environment variables.

**Config dict** (e.g. when used from another app):

```python
from pynop import AutoDao, NopTool, NopData

config = {
    "db_engine": "MSSQL",
    "db_server": "your-server",
    "db_name": "NOPCommerce",
    "db_username": "sa",
    "db_password": "secret",
}
dao = AutoDao(config)
# Optional: set as default for NopTool
NopTool.set_dao(dao)
```

**Environment variables** (for CLI or standalone scripts):

- `NOP_DB_SERVER`, `NOP_DB_NAME`, `NOP_DB_USERNAME`, `NOP_DB_PASSWORD`
- Or `NOP_DB_DSN` for DSN-based connection.

## CLI

```bash
nopcommerce product get-by-sku MY-SKU
nopcommerce product list --limit 10
nopcommerce ping
```

## Use from sync project

In the sync repo, install this package and import shared modules directly from `pynop.core` (for example `from pynop.core.db import AutoDao`).
The former `sync/src/core` modules are now housed in this package under `pynop/core`.

## License

MIT
