Skip to main content

Windows-first CODESYS automation tools with a local CLI and HTTP server

Project description

codesys-tools

Windows-first, experimental local automation tooling for CODESYS.

codesys-tools provides:

  • a local CLI: codesys-tools
  • a local HTTP server: codesys-tools-server
  • a persistent CODESYS runtime built around named_pipe

Product Goal

This project is optimized for user-facing utility, not for any single transport or hosting mechanism.

The goal is to give users a reliable way to work with one persistent CODESYS session across multiple steps, so they can:

  • keep a CODESYS session alive across separate commands
  • operate on the same project incrementally instead of rebuilding state every time
  • get trustworthy results from each step, especially for compile/build flows

From the product perspective, CLI, HTTP, named_pipe, background services, threads, and process boundaries are implementation details. They are only acceptable if they preserve the core utility above without introducing false success, false failure, duplicate IDE instances, or UI-thread crashes.

Support Boundary

This project is currently published as:

  • Windows-only
  • experimental
  • intended for local CODESYS installations

Current assumptions:

  • CODESYS must already be installed on the target machine
  • supported Python versions are 3.13 and 3.14
  • the runtime transport is named_pipe only
  • the package does not include a bundled CODESYS runtime
  • public release prep is in place, but the project is not yet committed to cross-platform support

Installation

For local development:

pip install .

For release artifacts:

python scripts\build_release.py
python -m pip install dist\codesys_tools-*.whl

Required Environment

At minimum, local CODESYS usage requires:

  • CODESYS_API_CODESYS_PATH
  • CODESYS_API_CODESYS_PROFILE
  • CODESYS_API_CODESYS_PROFILE_PATH
  • CODESYS_API_CODESYS_NO_UI=1 for headless project workflows to avoid the WinForms crash on project/create

The CLI and server both use the same runtime wiring and packaged assets.

Quick Start

Server:

codesys-tools-server --help
python HTTP_SERVER.py

HTTP is the primary product surface for persistent multi-step workflows.

CLI:

codesys-tools --help

CLI notes:

  • each codesys-tools invocation executes one action
  • reuse the same CODESYS_API_PIPE_NAME when you want later CLI commands to attach to the same CODESYS session
  • use codesys-tools-server when you want the primary persistent-session workflow

HTTP Workflow Example

Start the server with the required environment:

$env:CODESYS_API_CODESYS_PATH="C:\Program Files\CODESYS 3.5.20.60\CODESYS\Common\CODESYS.exe"
$env:CODESYS_API_CODESYS_PROFILE="CODESYS V3.5 SP20 Patch 6"
$env:CODESYS_API_CODESYS_PROFILE_PATH="C:\Program Files\CODESYS 3.5.20.60\CODESYS\Profiles\CODESYS V3.5 SP20 Patch 6.profile.xml"
$env:CODESYS_API_CODESYS_NO_UI="1"
codesys-tools-server

Then send authenticated requests with:

  • Authorization: ApiKey admin

Example workflow:

Invoke-RestMethod -Method POST -Uri http://127.0.0.1:8080/api/v1/session/start -Headers @{ Authorization = "ApiKey admin" }
Invoke-RestMethod -Method POST -Uri http://127.0.0.1:8080/api/v1/project/create -Headers @{ Authorization = "ApiKey admin" } -ContentType "application/json" -Body '{"path":"C:\\work\\demo.project"}'
Invoke-RestMethod -Method POST -Uri http://127.0.0.1:8080/api/v1/pou/create -Headers @{ Authorization = "ApiKey admin" } -ContentType "application/json" -Body '{"name":"CounterFB","type":"FunctionBlock","language":"ST"}'
Invoke-RestMethod -Method POST -Uri http://127.0.0.1:8080/api/v1/pou/code -Headers @{ Authorization = "ApiKey admin" } -ContentType "application/json" -Body '{"path":"Application\\CounterFB","declaration":"VAR_INPUT`n    Enable : BOOL;`nEND_VAR","implementation":"Output := Enable;"}'
Invoke-RestMethod -Method POST -Uri http://127.0.0.1:8080/api/v1/project/save -Headers @{ Authorization = "ApiKey admin" }
Invoke-RestMethod -Method POST -Uri http://127.0.0.1:8080/api/v1/project/close -Headers @{ Authorization = "ApiKey admin" }

Compile note:

  • project/compile runs against the active persistent session and returns CODESYS message-store results
  • POU declarations sent via pou/code must omit the FUNCTION_BLOCK / PROGRAM header line; start at the VAR sections

Repo-local compatibility entrypoints remain available:

  • python codesys_cli.py ...
  • python HTTP_SERVER.py
  • run_cli.bat ...

What It Does

  • starts and stops a local persistent CODESYS session
  • creates, opens, saves, closes, and compiles projects
  • creates and edits POUs
  • exposes the same core actions through both CLI and HTTP entrypoints

Compile validation currently uses:

  • build
  • generate code

Validation Status

Current local engineering baseline:

  • python scripts\run_baseline.py
  • latest expected result: 170 passed, 8 skipped

Current release validation:

  • python scripts\build_release.py
  • clean wheel-install smoke
  • packaged asset lookup smoke
  • GitHub Actions CI and manual release workflows

Documentation

Not Included

This project does not currently provide:

  • a hosted/cloud service
  • cross-platform support
  • a bundled CODESYS installation
  • an installer
  • public API stability guarantees beyond the current local tooling contract

License

MIT. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codesys_tools-0.3.0.tar.gz (2.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codesys_tools-0.3.0-py3-none-any.whl (2.3 MB view details)

Uploaded Python 3

File details

Details for the file codesys_tools-0.3.0.tar.gz.

File metadata

  • Download URL: codesys_tools-0.3.0.tar.gz
  • Upload date:
  • Size: 2.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for codesys_tools-0.3.0.tar.gz
Algorithm Hash digest
SHA256 016173923a941b77cade8db8312ee9d482428ed9e73e31f5bfe02fc1f8ec09c7
MD5 1ddf6edbd6e25c7f231e144fe735b7a0
BLAKE2b-256 50da3a1993cae7932c536c98b2ede41fc09e187de1acc781982c6104b5ead53e

See more details on using hashes here.

Provenance

The following attestation bundles were made for codesys_tools-0.3.0.tar.gz:

Publisher: publish.yml on Zhgong/codesys-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file codesys_tools-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: codesys_tools-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 2.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for codesys_tools-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 96c67b6e0eb014cbf9dd20f2c0b3c6dc7df8ed9b244db75a216e9fb592156e9c
MD5 f0b4ecc3a6bc4c5677482d36c7592dd3
BLAKE2b-256 86943de769b3987b732f64a3069b2e9da19141937c54ebfe3d86381bf20f8baf

See more details on using hashes here.

Provenance

The following attestation bundles were made for codesys_tools-0.3.0-py3-none-any.whl:

Publisher: publish.yml on Zhgong/codesys-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page