forked from alexbjorling/lib-maxiv-regloicc
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from numat/master
merge master
- Loading branch information
Showing
18 changed files
with
1,368 additions
and
555 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"$schema": "https://docs.renovatebot.com/renovate-schema.json", | ||
"extends": [ | ||
"config:base" | ||
], | ||
"timezone": "America/Chicago", | ||
"pre-commit": { | ||
"enabled": true | ||
}, | ||
"packageRules": [ | ||
{ | ||
"matchManagers": ["github-actions"], | ||
"automerge": true | ||
}, | ||
{ | ||
"matchPackagePatterns": ["mypy", "pre-commit", "ruff"], | ||
"automerge": true | ||
}, | ||
{ | ||
"matchPackagePatterns": ["ruff"], | ||
"groupName": "ruff", | ||
"schedule": [ | ||
"on the first day of the month" | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | ||
|
||
name: ismatec | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
jobs: | ||
test: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
allow-prereleases: true | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install '.[test]' | ||
- name: Lint with ruff | ||
run: | | ||
ruff . | ||
- name: Check types with mypy | ||
run: | | ||
mypy ismatec | ||
- name: Pytest | ||
run: | | ||
pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
__pycache__/ | ||
.DS_Store | ||
*.pyc | ||
build | ||
dist | ||
*egg-info | ||
*.pyc | ||
*.egg-info | ||
.vscode | ||
.coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v5.0.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-added-large-files | ||
- id: check-json | ||
- repo: https://github.com/charliermarsh/ruff-pre-commit | ||
rev: v0.4.7 | ||
hooks: | ||
- id: ruff | ||
args: [--fix, --exit-non-zero-on-fix] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,49 @@ | ||
TODO: | ||
* the Moxa interface (implement SocketCommunicator) | ||
ismatec | ||
======= | ||
|
||
Python ≥3.8 driver and command-line tool for Masterflex® Ismatec® Reglo ICC Digital Pumps. | ||
|
||
![](https://us.vwr.com/stibo/bigweb/std.lang.all/21/78/38732178.jpg) | ||
|
||
Installation | ||
============ | ||
|
||
``` | ||
pip install ismatec | ||
``` | ||
|
||
Usage | ||
===== | ||
|
||
## Command Line | ||
|
||
``` | ||
$ ismatec /dev/ttyUSB0 --channel 1 | ||
$ ismatec <serial-to-ethernet-ip>:<port> --channel 2 | ||
``` | ||
|
||
This will print the current flow rate for the selected channel, using either the serial port or an ethernet-to-serial adapter. | ||
|
||
## Python | ||
|
||
This uses Python ≥3.5's async/await syntax to asynchronously communicate with a Ismatec® Reglo ICC pump. For example: | ||
|
||
```python | ||
import asyncio | ||
from ismatec import Pump | ||
|
||
async def get(): | ||
async with Pump('/dev/ttyUSB0') as pump: | ||
print(await pump.get_pump_version()) | ||
|
||
asyncio.run(get()) | ||
``` | ||
|
||
Acknowledgements | ||
================ | ||
|
||
©2022 Alexander Ruddick | ||
|
||
[Original project](https://github.com/alexbjorling/lib-maxiv-regloicc) ©2017 Alexander Bjoerling | ||
|
||
No affiliation to [the Hein group](https://gitlab.com/heingroup/ismatec). As of 2023, that project appears to have been abandoned. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"""Python driver for Ismatec Reglo ICC peristaltic pump. | ||
Distributed under the GNU General Public License v3 | ||
Copyright (C) 2022 NuMat Technologies | ||
""" | ||
from ismatec.driver import Pump | ||
|
||
|
||
def command_line(args=None): | ||
"""Command-line tool for reading Ismatec Reglo ICC pumps.""" | ||
import argparse | ||
import asyncio | ||
import json | ||
|
||
parser = argparse.ArgumentParser(description="Control a RegloICC pump" | ||
"from the command line.") | ||
parser.add_argument('address', nargs='?', default='/dev/ttyUSB0', help="The " | ||
"target serial port or TCP address:port. Default " | ||
"'/dev/ttyUSB0'.") | ||
parser.add_argument('--channel', '-c', default=None, type=int, | ||
help="Specify channel in case of multi-channel pump.") | ||
args = parser.parse_args(args) | ||
|
||
async def run(): | ||
async with Pump(address=(args.address), timeout=.2) as pump: | ||
d = await pump.get_flow_rate(args.channel) | ||
print(json.dumps(d, indent=4)) | ||
|
||
loop = asyncio.new_event_loop() | ||
loop.run_until_complete(run()) | ||
loop.close() | ||
return | ||
|
||
|
||
if __name__ == '__main__': | ||
command_line() |
Oops, something went wrong.