semvec/pypi-packages huggingface dataset:
py-node-manager 0.1.2
A tool library for conveniently using Node.js in Python
Requires Python: >=3.8

# py-node-manager

A tool library for conveniently using Node.js in Python.

[![Tests](https://github.com/HogaStack/py-node-manager/workflows/Tests/badge.svg)](https://github.com/HogaStack/py-node-manager/actions)
[![Coverage](https://codecov.io/gh/HogaStack/py-node-manager/branch/main/graph/badge.svg)](https://codecov.io/gh/HogaStack/py-node-manager)
[![GitHub](https://shields.io/badge/license-MIT-informational)](https://github.com/HogaStack/py-node-manager/blob/main/LICENSE)
[![PyPI](https://img.shields.io/pypi/v/py-node-manager.svg?color=dark-green)](https://pypi.org/project/py-node-manager/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)

English | [简体中文](./README-zh_CN.md)

## Installation

```bash
pip install py-node-manager
```

## Usage

### Basic Usage

```python
from py_node_manager import NodeManager

# Create NodeManager instance
# download_node=True means automatically download Node.js if not found in system
# node_version specifies the Node.js version to download
manager = NodeManager(download_node=True, node_version='18.17.0')

# Get paths to Node.js, npm, and npx
node_path = manager.node_path  # Path to downloaded Node.js, None if using system Node.js
npm_path = manager.npm_path    # Path to npm
npx_path = manager.npx_path    # Path to npx

# Get environment variables (if using downloaded Node.js)
node_env = manager.node_env    # Environment variables dictionary
```

### Running Node.js Commands

```python
import subprocess
from py_node_manager import NodeManager

manager = NodeManager(download_node=True, node_version='18.17.0')

# Run Node.js commands
result = subprocess.run(
    [manager.npm_path, 'init', '-y'],
    env=manager.node_env,
    capture_output=True,
    text=True
)
print(result.stdout)
```

### Without Automatic Node.js Download

```python
from py_node_manager import NodeManager

# Will raise an exception if Node.js is not found in the system
manager = NodeManager(download_node=False, node_version='18.17.0')
```

## Testing

This project uses pytest for testing with 100% code coverage.

### Running Tests

To run the tests in the conda environment:

```bash

# Install dependencies
pip install -e .
pip install -r requirements-dev.txt

# Run tests
pytest tests/ -v

# Run tests with coverage report
pytest tests/ --cov=py_node_manager --cov-report=term-missing
```

### Test Structure

- `tests/test_node_manager.py` - Complete test suite for NodeManager class
- `tests/conftest.py` - pytest configuration
- `tests/__init__.py` - Package initialization

All code paths are tested including:

- Normal execution paths
- Error handling scenarios
- Platform-specific behaviors
- CLI mode logging
- Cached Node.js usage
mdsvg2png 0.2.0
A tool to convert SVG images in Markdown files to PNG.
Requires Python: >=3.10
Keywords: converter, markdown, png, svg

# mdsvg2png

A simple Python tool to convert SVG images in Markdown files to PNG format(upload converted .pngs to the Tencent cos).

## Features

- Automatically detects SVG images in Markdown.
- Converts SVG to PNG for better compatibility.
- Easy to use and integrate.

## Config

`.env` or configure environment variables:
```
COS_SECRET_ID=<xyz>
COS_SECRET_KEY=<xyz>
COS_REGION=<xyz>
COS_BUCKET=<xyz>
```

## Usage

1. Install dependencies:
    ```bash
    pip install mdsvg2png
    playwright install
    ```
2. Run the script:
    ```bash
    mdsvg2png your_markdown.md
    ```

## Demo

demo.md:
```
first line

![Version constructor](https://iscinumpy.dev/post/packaging-faster/version.TimeVersionSuite.time_constructor.svg)

end lint
```

demo_output.md
```
first line

![Version constructor](https://pic-1251484506.cos.ap-guangzhou.myqcloud.com/svg2png/version.TimeVersionSuite.time_constructor_3950bb8a.png)

end lint
```

## Note

Depend on playwright to support rendering `<foreignObject>` tag in svg.
TODO: Use resvg_python for static svg.

## License

Apache License