modbusim


Namemodbusim JSON
Version 0.1.7 PyPI version JSON
download
home_pageNone
SummaryA Modbus RTU/ASCII/TCP device simulator for testing and development
upload_time2025-08-01 08:58:17
maintainerNone
docs_urlNone
authorTom Sapletta
requires_python<3.14,>=3.8.1
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ModbusIM - Modbus Device Simulator

A Python package for simulating Modbus RTU/ASCII/TCP devices for testing and development purposes.

[![PyPI version](https://badge.fury.io/py/modbusim.svg)](https://badge.fury.io/py/modbusim)
[![Python Version](https://img.shields.io/badge/python-3.8.1+-blue.svg)](https://www.python.org/downloads/)
[![License: Apache 2.0 ](https://img.shields.io/badge/License-Apache 2.0 -yellow.svg)](https://opensource.org/licenses/Apache 2.0 )

## Features

- Simulate Modbus RTU/ASCII/TCP devices
- Support for all standard Modbus function codes
- Easy-to-use CLI interface
- Programmatic API for integration with tests
- Configurable device behavior
- Docker support for easy deployment

## Installation

### Using pip

```bash
pip install modbusim
```

### Using Poetry (for development)

```bash
git clone https://github.com/yourusername/modbusim.git
cd modbusim
poetry install
```

### Using Docker

```bash
# Build the image
docker build -t modbusim .

# Run the Modbus TCP simulator
docker run -p 5020:5020 modbusim
```

Or using Docker Compose:

```bash
docker-compose up -d
```

## Usage

### Command Line Interface

Start a Modbus RTU simulator:

```bash
modbusim rtu --port /tmp/ptyp0 --baudrate 9600
```

Start a Modbus TCP simulator:

```bash
modbusim tcp --host 0.0.0.0 --port 5020
```

### Python API

```python
from modbusim import ModbusSimulator

# Create a simulator instance
simulator = ModbusSimulator(
    mode="rtu",  # or "tcp"
    port="/tmp/ptyp0",  # or host="0.0.0.0" for TCP
    baudrate=9600
)

# Start the simulator
simulator.start()

try:
    # Your test code here
    while True:
        # Keep the simulator running
        pass
except KeyboardInterrupt:
    # Stop the simulator
    simulator.stop()
```

## Development

### Running Tests

```bash
make test
```

### Linting and Formatting

```bash
make lint    # Run linters
make format  # Format code
```

### Building and Publishing

```bash
make build    # Build the package
make publish  # Publish to PyPI
```

## Docker Development

### Build the development image

```bash
docker-compose -f docker-compose.dev.yml build
```

### Run tests in Docker

```bash
docker-compose -f docker-compose.dev.yml run --rm modbusim make test
```

### Start a development shell

```bash
docker-compose -f docker-compose.dev.yml run --rm --service-ports modbusim bash
```

## License

Apache 2.0  - See [LICENSE](LICENSE) for more information.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "modbusim",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.14,>=3.8.1",
    "maintainer_email": null,
    "keywords": null,
    "author": "Tom Sapletta",
    "author_email": "info@softreck.dev",
    "download_url": "https://files.pythonhosted.org/packages/71/02/62979fdfd516a4152869e4a06b1842db1bf24ab93c1100baf9f2a5aa07d4/modbusim-0.1.7.tar.gz",
    "platform": null,
    "description": "# ModbusIM - Modbus Device Simulator\n\nA Python package for simulating Modbus RTU/ASCII/TCP devices for testing and development purposes.\n\n[![PyPI version](https://badge.fury.io/py/modbusim.svg)](https://badge.fury.io/py/modbusim)\n[![Python Version](https://img.shields.io/badge/python-3.8.1+-blue.svg)](https://www.python.org/downloads/)\n[![License: Apache 2.0 ](https://img.shields.io/badge/License-Apache 2.0 -yellow.svg)](https://opensource.org/licenses/Apache 2.0 )\n\n## Features\n\n- Simulate Modbus RTU/ASCII/TCP devices\n- Support for all standard Modbus function codes\n- Easy-to-use CLI interface\n- Programmatic API for integration with tests\n- Configurable device behavior\n- Docker support for easy deployment\n\n## Installation\n\n### Using pip\n\n```bash\npip install modbusim\n```\n\n### Using Poetry (for development)\n\n```bash\ngit clone https://github.com/yourusername/modbusim.git\ncd modbusim\npoetry install\n```\n\n### Using Docker\n\n```bash\n# Build the image\ndocker build -t modbusim .\n\n# Run the Modbus TCP simulator\ndocker run -p 5020:5020 modbusim\n```\n\nOr using Docker Compose:\n\n```bash\ndocker-compose up -d\n```\n\n## Usage\n\n### Command Line Interface\n\nStart a Modbus RTU simulator:\n\n```bash\nmodbusim rtu --port /tmp/ptyp0 --baudrate 9600\n```\n\nStart a Modbus TCP simulator:\n\n```bash\nmodbusim tcp --host 0.0.0.0 --port 5020\n```\n\n### Python API\n\n```python\nfrom modbusim import ModbusSimulator\n\n# Create a simulator instance\nsimulator = ModbusSimulator(\n    mode=\"rtu\",  # or \"tcp\"\n    port=\"/tmp/ptyp0\",  # or host=\"0.0.0.0\" for TCP\n    baudrate=9600\n)\n\n# Start the simulator\nsimulator.start()\n\ntry:\n    # Your test code here\n    while True:\n        # Keep the simulator running\n        pass\nexcept KeyboardInterrupt:\n    # Stop the simulator\n    simulator.stop()\n```\n\n## Development\n\n### Running Tests\n\n```bash\nmake test\n```\n\n### Linting and Formatting\n\n```bash\nmake lint    # Run linters\nmake format  # Format code\n```\n\n### Building and Publishing\n\n```bash\nmake build    # Build the package\nmake publish  # Publish to PyPI\n```\n\n## Docker Development\n\n### Build the development image\n\n```bash\ndocker-compose -f docker-compose.dev.yml build\n```\n\n### Run tests in Docker\n\n```bash\ndocker-compose -f docker-compose.dev.yml run --rm modbusim make test\n```\n\n### Start a development shell\n\n```bash\ndocker-compose -f docker-compose.dev.yml run --rm --service-ports modbusim bash\n```\n\n## License\n\nApache 2.0  - See [LICENSE](LICENSE) for more information.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Modbus RTU/ASCII/TCP device simulator for testing and development",
    "version": "0.1.7",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2add1434554e54bd28734c34a48db4a06a60611b38d7952b806f15e89e99cc85",
                "md5": "c619b1654ad07c3837857cf844dd2269",
                "sha256": "fd30ce295ba480c24c9413124c97762d60fca90a4c8ca73ed86bb847f7bf230a"
            },
            "downloads": -1,
            "filename": "modbusim-0.1.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c619b1654ad07c3837857cf844dd2269",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.14,>=3.8.1",
            "size": 9595,
            "upload_time": "2025-08-01T08:58:16",
            "upload_time_iso_8601": "2025-08-01T08:58:16.000623Z",
            "url": "https://files.pythonhosted.org/packages/2a/dd/1434554e54bd28734c34a48db4a06a60611b38d7952b806f15e89e99cc85/modbusim-0.1.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "710262979fdfd516a4152869e4a06b1842db1bf24ab93c1100baf9f2a5aa07d4",
                "md5": "b415b02e2bbd280a9c851f6a3324f9ed",
                "sha256": "e73bd117684bde33873647bc738705e18086676f3fbaccfd5957c7bb9d3412af"
            },
            "downloads": -1,
            "filename": "modbusim-0.1.7.tar.gz",
            "has_sig": false,
            "md5_digest": "b415b02e2bbd280a9c851f6a3324f9ed",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.14,>=3.8.1",
            "size": 8610,
            "upload_time": "2025-08-01T08:58:17",
            "upload_time_iso_8601": "2025-08-01T08:58:17.369331Z",
            "url": "https://files.pythonhosted.org/packages/71/02/62979fdfd516a4152869e4a06b1842db1bf24ab93c1100baf9f2a5aa07d4/modbusim-0.1.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-01 08:58:17",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "modbusim"
}
        
Elapsed time: 1.76614s