Skip to content

Commit

Permalink
Change version number to 3.0.0 + Rename package.
Browse files Browse the repository at this point in the history
  • Loading branch information
Henrik-Norgren committed Jun 12, 2023
1 parent 93293be commit 16649fe
Show file tree
Hide file tree
Showing 23 changed files with 95 additions and 85 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/build
/dist
/qtm.egg-info
/qtm_rt.egg-info
/env
/env3
/.idea
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ The Qualisys SDK for Python implements our RealTime(RT) protocol and works with
Installation
------------

The easiest way to install the qtm package is by using [pip]((https://pip.pypa.io/en/stable/installing/)):
The easiest way to install the qtm_rt package is by using [pip]((https://pip.pypa.io/en/stable/installing/)):

```
python -m pip install pip --upgrade # Upgrade to latest pip
python -m pip install qtm
python -m pip install qtm-rt
```

It's also possible to install from github:
Expand All @@ -19,7 +19,7 @@ It's also possible to install from github:
python -m pip install git+https://github.com/qualisys/qualisys_python_sdk.git
```

Or just clone the repo and copy the qtm folder into you project folder,
Or just clone the repo and copy the qtm_rt folder into you project folder,

Documentation
-------------
Expand Down
16 changes: 13 additions & 3 deletions docs/deprecated.rst
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
.. _deprecated_version:

Upgrade information
3.0.0
-------------------

The package has been renamed to qtm_rt (qtm-rt on pip). Otherwise everything is identical to 2.1.2.
Older versions will remain under the qtm name to avoid breaking existing code.

To install the old version:

.. code-block:: console
python -m pip install qtm==2.1.2
2.0.0
-------------------

The basic functionality is the same, but the package now
uses `asyncio <https://docs.python.org/3.5/library/asyncio.html>`_ instead of `twisted <https://twistedmatrix.com/>`_.
This reduces dependencies and simplifies installation but raises the required version of Python to 3.5.
If you cannot use Python 3, stay on the earlier versions of this SDK.

QRest is still not implemented in 2.0.

To install the old version:

.. code-block:: console
Expand Down
20 changes: 10 additions & 10 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Welcome to Qualisys SDK for Python's documentation!
===================================================

This document describes the Qualisys SDK for Python version 2.1.2
This document describes the Qualisys SDK for Python version 3.0.0

**NOTE:** Version 2.0.0 introduces breaking changes. :ref:`More info...<deprecated_version>`
**NOTE:** Major versions introduces breaking changes. :ref:`More info...<deprecated_version>`

.. contents::
:depth: 2
Expand All @@ -22,7 +22,7 @@ This package is a pure python package and requires at least Python 3.5.3, the ea

.. code-block:: console
python -m pip install qtm
python -m pip install qtm-rt
Example usage:
--------------
Expand All @@ -36,40 +36,40 @@ already streaming data, either live or RT from file.
QTM RT Protocol
---------------

An instance of QRTConnection is returned when qtm.connect_ successfully connects to QTM.
An instance of QRTConnection is returned when qtm_rt.connect_ successfully connects to QTM.

Functions marked as coroutines need to be run in a async function and awaited, please see example above.

.. autocofunction:: qtm.connect
.. autocofunction:: qtm_rt.connect

QRTConnection
~~~~~~~~~~~~~

.. autoclass:: qtm.QRTConnection
.. autoclass:: qtm_rt.QRTConnection
:members:

QRTPacket
~~~~~~~~~

.. autoclass:: qtm.QRTPacket
.. autoclass:: qtm_rt.QRTPacket
:members:

QRTEvent
~~~~~~~~~

.. autoclass:: qtm.QRTEvent
.. autoclass:: qtm_rt.QRTEvent
:members:
:undoc-members:

QRTComponentType
~~~~~~~~~~~~~~~~

.. autoclass:: qtm.packet.QRTComponentType
.. autoclass:: qtm_rt.packet.QRTComponentType
:members:
:undoc-members:

Exceptions
~~~~~~~~~~

.. autoclass:: qtm.QRTCommandException
.. autoclass:: qtm_rt.QRTCommandException

10 changes: 5 additions & 5 deletions examples/advanced_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import asyncio
import logging

import qtm
import qtm_rt

LOG = logging.getLogger("example")

Expand Down Expand Up @@ -47,18 +47,18 @@ async def shutdown(delay, connection, receiver_future, queue):
async def setup():
""" main function """

connection = await qtm.connect("127.0.0.1")
connection = await qtm_rt.connect("127.0.0.1")

if connection is None:
return -1

async with qtm.TakeControl(connection, "password"):
async with qtm_rt.TakeControl(connection, "password"):

state = await connection.get_state()
if state != qtm.QRTEvent.EventConnected:
if state != qtm_rt.QRTEvent.EventConnected:
await connection.new()
try:
await connection.await_event(qtm.QRTEvent.EventConnected, timeout=10)
await connection.await_event(qtm_rt.QRTEvent.EventConnected, timeout=10)
except asyncio.TimeoutError:
LOG.error("Failed to start new measurement")
return -1
Expand Down
22 changes: 11 additions & 11 deletions examples/asyncio_everything.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
import argparse
import pkg_resources

import qtm
import qtm_rt


logging.basicConfig(level=logging.INFO)
LOG = logging.getLogger("example")


QTM_FILE = pkg_resources.resource_filename("qtm", "data/Demo.qtm")
QTM_FILE = pkg_resources.resource_filename("qtm_rt", "data/Demo.qtm")


class AsyncEnumerate:
Expand Down Expand Up @@ -48,7 +48,7 @@ async def choose_qtm_instance(interface):
""" List running QTM instances, asks for input and return chosen QTM """
instances = {}
print("Available QTM instances:")
async for i, qtm_instance in AsyncEnumerate(qtm.Discover(interface), start=1):
async for i, qtm_instance in AsyncEnumerate(qtm_rt.Discover(interface), start=1):
instances[i] = qtm_instance
print("{} - {}".format(i, qtm_instance.info))

Expand All @@ -75,19 +75,19 @@ async def main(interface=None):

while True:

connection = await qtm.connect(qtm_ip, 22223, version="1.18")
connection = await qtm_rt.connect(qtm_ip, 22223, version="1.18")

if connection is None:
return

await connection.get_state()
await connection.byte_order()

async with qtm.TakeControl(connection, "password"):
async with qtm_rt.TakeControl(connection, "password"):

result = await connection.close()
if result == b"Closing connection":
await connection.await_event(qtm.QRTEvent.EventConnectionClosed)
await connection.await_event(qtm_rt.QRTEvent.EventConnectionClosed)

await connection.load(QTM_FILE)

Expand All @@ -103,7 +103,7 @@ async def main(interface=None):
await connection.stream_frames(
components=["incorrect"], on_packet=queue.put_nowait
)
except qtm.QRTCommandException as exception:
except qtm_rt.QRTCommandException as exception:
LOG.info("exception %s", exception)

await connection.stream_frames(
Expand All @@ -122,13 +122,13 @@ async def main(interface=None):
await connection.await_event()

await connection.new()
await connection.await_event(qtm.QRTEvent.EventConnected)
await connection.await_event(qtm_rt.QRTEvent.EventConnected)

await connection.start()
await connection.await_event(qtm.QRTEvent.EventWaitingForTrigger)
await connection.await_event(qtm_rt.QRTEvent.EventWaitingForTrigger)

await connection.trig()
await connection.await_event(qtm.QRTEvent.EventCaptureStarted)
await connection.await_event(qtm_rt.QRTEvent.EventCaptureStarted)

await asyncio.sleep(0.5)

Expand All @@ -139,7 +139,7 @@ async def main(interface=None):
await asyncio.sleep(0.5)

await connection.stop()
await connection.await_event(qtm.QRTEvent.EventCaptureStopped)
await connection.await_event(qtm_rt.QRTEvent.EventCaptureStopped)

await connection.save(r"measurement.qtm")

Expand Down
4 changes: 2 additions & 2 deletions examples/basic_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""

import asyncio
import qtm
import qtm_rt


def on_packet(packet):
Expand All @@ -19,7 +19,7 @@ def on_packet(packet):

async def setup():
""" Main function """
connection = await qtm.connect("127.0.0.1")
connection = await qtm_rt.connect("127.0.0.1")
if connection is None:
return

Expand Down
10 changes: 5 additions & 5 deletions examples/calibration_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@

import asyncio
import logging
import qtm
import qtm_rt
from lxml import etree

LOG = logging.getLogger("example")

async def setup():
""" main function """

connection = await qtm.connect("127.0.0.1")
connection = await qtm_rt.connect("127.0.0.1")

if connection is None:
return -1

async with qtm.TakeControl(connection, "password"):
async with qtm_rt.TakeControl(connection, "password"):

state = await connection.get_state()
if state != qtm.QRTEvent.EventConnected:
if state != qtm_rt.QRTEvent.EventConnected:
await connection.new()
try:
await connection.await_event(qtm.QRTEvent.EventConnected, timeout=10)
await connection.await_event(qtm_rt.QRTEvent.EventConnected, timeout=10)
except asyncio.TimeoutError:
LOG.error("Failed to start new measurement")
return -1
Expand Down
12 changes: 6 additions & 6 deletions examples/qt_example/qt_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
from PyQt5.QtCore import pyqtSignal, QObject, pyqtProperty
from PyQt5 import uic

import qtm
from qtm import QRTEvent
import qtm_rt
from qtm_rt import QRTEvent
from quamash import QSelectorEventLoop

main_window_class, _ = uic.loadUiType("./ui/main.ui")
Expand Down Expand Up @@ -67,7 +67,7 @@ def discover(self):
async def _discover_qtm(self, interface):

try:
async for qtm_instance in qtm.Discover(interface):
async for qtm_instance in qtm_rt.Discover(interface):
info = qtm_instance.info.decode("utf-8").split(",")[0]

if not info in self._found_qtms:
Expand Down Expand Up @@ -155,7 +155,7 @@ def connect_qtm(self):
async def _connect_qtm(self):
ip = self.qtm_combo.currentText().split(" ")[1]

self._connection = await qtm.connect(
self._connection = await qtm_rt.connect(
ip, on_disconnect=self.on_disconnect, on_event=self.on_event
)

Expand Down Expand Up @@ -193,15 +193,15 @@ def set_3d_values(self, controls, values):
control.setText("{0:.3f}".format(component))

def on_packet(self, packet):
if qtm.packet.QRTComponentType.Component3d in packet.components:
if qtm_rt.packet.QRTComponentType.Component3d in packet.components:
_, markers = packet.get_3d_markers()
if self._trajectory_index is not None:
marker = markers[self._trajectory_index]
self.set_3d_values(
[self.x_trajectory, self.y_trajectory, self.z_trajectory], marker
)

if qtm.packet.QRTComponentType.Component6d in packet.components:
if qtm_rt.packet.QRTComponentType.Component6d in packet.components:
_, sixdofs = packet.get_6d()
if self._sixdof_index is not None:
position, _ = sixdofs[self._sixdof_index]
Expand Down
2 changes: 1 addition & 1 deletion examples/qt_example/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
qtm
qtm_rt
PyQt5==5.9
Quamash==0.6.1
8 changes: 4 additions & 4 deletions examples/stream_6dof_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import xml.etree.ElementTree as ET
import pkg_resources

import qtm
import qtm_rt

QTM_FILE = pkg_resources.resource_filename("qtm", "data/Demo.qtm")
QTM_FILE = pkg_resources.resource_filename("qtm_rt", "data/Demo.qtm")


def create_body_index(xml_string):
Expand All @@ -28,15 +28,15 @@ def body_enabled_count(xml_string):
async def main():

# Connect to qtm
connection = await qtm.connect("127.0.0.1")
connection = await qtm_rt.connect("127.0.0.1")

# Connection failed?
if connection is None:
print("Failed to connect")
return

# Take control of qtm, context manager will automatically release control after scope end
async with qtm.TakeControl(connection, "password"):
async with qtm_rt.TakeControl(connection, "password"):

realtime = False

Expand Down
2 changes: 1 addition & 1 deletion qtm/__init__.py → qtm_rt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

# pylint: disable=C0330

LOG = logging.getLogger("qtm")
LOG = logging.getLogger("qtm_rt")
LOG_LEVEL = os.getenv("QTM_LOGGING", None)

LEVEL = logging.DEBUG if LOG_LEVEL == "debug" else logging.INFO
Expand Down
2 changes: 1 addition & 1 deletion qtm/control.py → qtm_rt/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from .qrt import QRTConnection

LOG = logging.getLogger("qtm")
LOG = logging.getLogger("qtm_rt")


class TakeControl:
Expand Down
File renamed without changes.
Loading

0 comments on commit 16649fe

Please sign in to comment.