G3 PLC Hardware XML Configuration Generator

raw JSON →
0.2.16 verified Sat May 09 auth: no python

Generates XML configuration files for G3 PLC hardware. Current version: 0.2.16. Release cadence: infrequent.

pip install g3hardware
error AttributeError: module 'g3hardware' has no attribute 'generate_config'
cause Incorrect import path; the submodule 'generator' does not expose the function.
fix
Use 'from g3hardware import generate_config' instead of 'from g3hardware.generator import generate_config'.
error TypeError: generate_config() got an unexpected keyword argument 'config_type'
cause Parameter name changed in version 0.2.10.
fix
Replace 'config_type' with 'generator_type'.
error pip install: ERROR: Package 'g3hardware' requires a different Python: 3.9.x not in '>=3.10'
cause Installing on Python version older than 3.10.
fix
Upgrade to Python 3.10 or later, or create a new virtual environment with Python 3.10+.
gotcha Output format: The generate_config function returns bytes by default (or string in some contexts). Always check the type and decode appropriately.
fix Wrap output with config.decode() if bytes is returned, or use config = generate_config(…).decode('utf-8') if you need a string.
gotcha Python version requirement: Requires Python >=3.10. Installing on older Pythons will fail during installation.
fix Ensure your environment uses Python 3.10 or higher.
deprecated The parameter 'config_type' in some generation functions is deprecated in favor of 'generator_type'.
fix Replace 'config_type' with 'generator_type' in function calls.

Generates an XML configuration string for a G3 PLC with specified interfaces.

from g3hardware import generate_config

# Generate a basic PLC configuration XML
config = generate_config(device_name='MyPLC', interfaces=['CAN', 'ETH'])
print(config.decode() if isinstance(config, bytes) else config)