Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,25 @@

English / [日本語](https://github.com/Moge800/gomc_rest_python/blob/main/README_JP.md)

Python package for talking to Mitsubishi PLCs via
[gomc-rest](https://github.com/Moge800/gomc-rest) — **Pattern B**: the
`gomc-rest` server binary is bundled and auto-launched as a subprocess, so you
never have to start or distribute the executable yourself.
**A Python library for talking to Mitsubishi PLCs.** Read and write PLC devices
over the MC protocol (3E/4E frames) — the protocol is handled for you by a bundled
[gomc-rest](https://github.com/Moge800/gomc-rest) server that the package
auto-launches, so you never have to start or distribute an executable yourself.

The HTTP layer is provided by
**Bonus — expose a REST API.** Enable `server_mode` to make the bundled
server's REST API reachable from other apps on your network (a GUI, another
machine, another language); and `connect()` talks to a gomc-rest server that is
already running elsewhere. See [Access control](#access-control).

Under the hood the HTTP layer is provided by
[gomc-rest-client](https://github.com/Moge800/gomc_rest_client); this package
adds only the bundled binary and its process lifecycle.
adds the bundled binary and its process lifecycle.

```text
your Python process
└─ gomc_rest.launch()
├─ spawns gomc-rest (bundled exe) on a free loopback port ── MC protocol ──▶ PLC
└─ returns a gomc_rest_client.PLCClient pointed at it
├─ spawns the bundled gomc-rest on a free loopback port ── MC protocol ──▶ PLC
└─ returns a Server that provides a PLCClient pointed at it
```

## Install
Expand Down
19 changes: 13 additions & 6 deletions README_JP.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@

[English](README.md) / 日本語

三菱PLCと通信するためのPythonパッケージです。
[gomc-rest](https://github.com/Moge800/gomc-rest) のサーバーバイナリを同梱し、
子プロセスとして自動起動する「サーバー同梱型(Pattern B)」を採用しています。
利用者がサーバーの実行ファイルを別途用意したり、手動で起動したりする必要はありません。

HTTPクライアント機能には
**三菱PLCと通信するためのPythonライブラリです。** MCプロトコル(3E/4Eフレーム)で
PLCのデバイスを読み書きできます。MCプロトコル通信は同梱の
[gomc-rest](https://github.com/Moge800/gomc-rest) サーバーが処理するため、
利用者がサーバーの実行ファイルを別途用意したり、手動で起動したりする
必要はありません。

**追加機能 — REST APIのネットワーク公開。** `server_mode` を有効にすると、
同梱サーバーのREST APIをネットワークから利用可能にし、他のアプリケーション
(GUI、別のコンピューター、別の言語のクライアントなど)から呼び出せます。また
`connect()` を使えば、すでに別の場所で稼働している gomc-rest へ
クライアントとして接続できます(「アクセス制御」を参照)。

内部のHTTPクライアント機能には
[gomc-rest-client](https://github.com/Moge800/gomc_rest_client) を使用しています。
このパッケージが追加するのは、サーバーバイナリの同梱とプロセスの
ライフサイクル管理です。
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "hatchling.build"
[project]
name = "gomc-rest"
version = "0.1.0"
description = "Pattern-B wrapper for gomc-rest: bundles the gomc-rest server binary and auto-launches it, exposing a Python client for Mitsubishi PLCs."
description = "Talk to Mitsubishi PLCs from Python over the MC protocol via a bundled, auto-launched gomc-rest server — with optional REST API exposure."
readme = "README.md"
requires-python = ">=3.10"
license = { text = "MIT" }
Expand Down
Loading