Skip to content

Commit 7d5dbc9

Browse files
authored
Merge pull request #36 from semuconsulting/RC-1.0.6
RC 1.0.6
2 parents 6e7aa23 + 28b1e9a commit 7d5dbc9

File tree

7 files changed

+50
-30
lines changed

7 files changed

+50
-30
lines changed

RELEASE_NOTES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# pyspartn Release Notes
22

3+
### RELEASE 1.0.6
4+
5+
1. Update build configuration and minimum cryptography version - no functional changes.
6+
37
### RELEASE 1.0.5
48

59
CHANGES:

docs/pyspartn.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,69 +9,69 @@ pyspartn.exceptions module
99

1010
.. automodule:: pyspartn.exceptions
1111
:members:
12-
:undoc-members:
1312
:show-inheritance:
13+
:undoc-members:
1414

1515
pyspartn.socket\_wrapper module
1616
-------------------------------
1717

1818
.. automodule:: pyspartn.socket_wrapper
1919
:members:
20-
:undoc-members:
2120
:show-inheritance:
21+
:undoc-members:
2222

2323
pyspartn.spartnhelpers module
2424
-----------------------------
2525

2626
.. automodule:: pyspartn.spartnhelpers
2727
:members:
28-
:undoc-members:
2928
:show-inheritance:
29+
:undoc-members:
3030

3131
pyspartn.spartnmessage module
3232
-----------------------------
3333

3434
.. automodule:: pyspartn.spartnmessage
3535
:members:
36-
:undoc-members:
3736
:show-inheritance:
37+
:undoc-members:
3838

3939
pyspartn.spartnreader module
4040
----------------------------
4141

4242
.. automodule:: pyspartn.spartnreader
4343
:members:
44-
:undoc-members:
4544
:show-inheritance:
45+
:undoc-members:
4646

4747
pyspartn.spartntables module
4848
----------------------------
4949

5050
.. automodule:: pyspartn.spartntables
5151
:members:
52-
:undoc-members:
5352
:show-inheritance:
53+
:undoc-members:
5454

5555
pyspartn.spartntypes\_core module
5656
---------------------------------
5757

5858
.. automodule:: pyspartn.spartntypes_core
5959
:members:
60-
:undoc-members:
6160
:show-inheritance:
61+
:undoc-members:
6262

6363
pyspartn.spartntypes\_get module
6464
--------------------------------
6565

6666
.. automodule:: pyspartn.spartntypes_get
6767
:members:
68-
:undoc-members:
6968
:show-inheritance:
69+
:undoc-members:
7070

7171
Module contents
7272
---------------
7373

7474
.. automodule:: pyspartn
7575
:members:
76-
:undoc-members:
7776
:show-inheritance:
77+
:undoc-members:

examples/benchmark.py

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
# pylint: disable=line-too-long
1414

15+
from io import BytesIO
1516
from datetime import datetime
1617
from platform import python_version
1718
from platform import version as osver
@@ -46,6 +47,10 @@
4647
b"s\x02\xbbb8\xd7!\xef\x10[\x1e\x08\xcc\xa4\xc8=\xfe\x91\x16F\xdf\xd6\x87\x07\x86\xba\xa8\xeb\xa7\xec\x8a\x93\xa3@\xab\xd1\xcdZ<\xad\xf6\xbaL\xbe\xf5\xd3\xe7\x14\x91\xa0D$Q\xebl\x1bt\xc6\xa8\x1e\xf3\xe4\x14\xc4\xd2\x90\xe4\x9d\x1e\x87\xeeW\xffL\x8d\xbd\xa1LxsK\xafE\xb8waU:\xbb1m]\xbbe:\xbf'\xef+\xaf\xe3j<\xe4(]I\x01\xe5\x13\xf8\xf9\x9dI\xf3\xbeS\n+m\xc5\xc0Y\xfe\xb3\x0f\x99(9Th\xa4\xb5\x8e\xb7t@\x91F'\xaf\x16(}\xee\xe0;\x1e\xd6\xc1\xe9\xf7V\x96i@,%\xa7\x19]Bc\xf4]z\x89\xf8\xb6\xd4\x91RH!9`\rXB\xfa\xc7\xf5Q1n\xc8\xcb\x9c\x92\x19\xcfi\x84\x91\xfc\xbb~\x94\xf5\x1561\xa53\xec=\x02/\x9c\xd56\xe3w\x00\tT\xd7=\x11\x8e\x9fpf{\xedI\xc9U\xa9MM\xd0%VbK[t\xe0iz\xefd\x07\xac*\xae\x0f\x9e\xe6\xcb\xd8\xcdl@\xca\x0c\xd4\xd3\xa6\xbb\x8c\xc0\nM~\xc6>\xbd\x1a$B\x07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xf3W:\xa88#nQ\xb0\xc8\x14\x03\xf2\xed\xcb7\x0e\x05\xf9\xa3\x17}\xa1\xba\xd8\xd3\\/M9\r\x8bX(\xfaU\xce\xa1\n\x07\xe3D~\xa7\x9b\x1b\x01\x08\xa1Dl9\x01\xe2\x99*9\xd4\xb1\xdc\xc3\xaa\xd0\xb4S\xb7\xb8\xa20\x80\xadv=\xc5\xc1)\x06jd\xea%\xaa]\xb1\xb7\xb9\xa0\xe8e\x88M\xe9;AY\xed\xb8\x1f\xdb\nTx\xc6\x99\x96Z\xae\x87\x90U\xbe\xeb\x08\xcd\xec\xab\xf2:\xdc\xf6\xfb\xa1zP>qtw\xeb\x19\xcap \xf8r0\x19\xf2\xb1\x8cu\xbf\xa65\xefT9\xa7+\xcf8\xb1\xba\x06(\xc2\xab",
4849
]
50+
msgb = b""
51+
for msg in SPARTNMESSAGES:
52+
msgb += msg
53+
SPARTNBYTES = msgb
4954

5055

5156
def progbar(i: int, lim: int, inc: int = 20):
@@ -66,24 +71,24 @@ def progbar(i: int, lim: int, inc: int = 20):
6671
)
6772

6873

69-
def main(**kwargs) -> float:
74+
def benchmark(**kwargs) -> float:
7075
"""
71-
pyrtcm Performance benchmark test.
76+
pyspartn Performance benchmark test.
7277
7378
:param int cycles: (kwarg) number of test cycles (10,000)
7479
:returns: benchmark as transactions/second
7580
:rtype: float
76-
:raises: UBXStreamError
81+
:raises: SPARTNStreamError
7782
"""
7883

79-
cyc = int(kwargs.get("cycles", 1000))
84+
cyc = int(kwargs.get("cycles", 5000))
8085
txnc = len(SPARTNMESSAGES)
8186
txnt = txnc * cyc
8287

8388
print(
8489
f"\nOperating system: {osver()}",
8590
f"\nPython version: {python_version()}",
86-
f"\npyrtcm version: {spartnver}",
91+
f"\npyspartn version: {spartnver}",
8792
f"\nTest cycles: {cyc:,}",
8893
f"\nTxn per cycle: {txnc:,}",
8994
)
@@ -93,22 +98,33 @@ def main(**kwargs) -> float:
9398
print(f"\nBenchmark (decrypt={decryptflag}) test started at {start}")
9499
for i in range(cyc):
95100
progbar(i, cyc)
96-
for msg in SPARTNMESSAGES:
97-
_ = SPARTNReader.parse(
98-
msg, decode=decryptflag, key=KEY, basedate=BASEDATE
99-
)
101+
stream = BytesIO(SPARTNBYTES)
102+
spr = SPARTNReader(stream, decode=decryptflag, key=KEY, basedate=BASEDATE)
103+
for _, _ in spr:
104+
pass
100105
end = process_time_ns()
101106
print(f"Benchmark test ended at {end}.")
102107
duration = end - start
103-
rate = round(txnt * 1e9 / duration, 2)
108+
msglen = len(SPARTNBYTES) * cyc
109+
txs = round(txnt * 1e9 / duration, 2)
110+
kbs = round(msglen * 1e9 / duration / 2**10, 2)
104111

105112
print(
106-
f"\n{txnt:,} messages processed in {duration/1e9:,.3f} seconds = {rate:,.2f} txns/second.\n"
113+
f"\n{txnt:,} messages processed in {duration/1e9:,.3f} seconds = {txs:,.2f} txns/second, {kbs:,.2f} kB/second.\n"
107114
)
108115

109-
return rate
116+
return txs, kbs
110117

111118

112-
if __name__ == "__main__":
119+
def main():
120+
"""
121+
CLI Entry point.
122+
123+
args as benchmark() method
124+
"""
113125

114-
main(**dict(arg.split("=") for arg in argv[1:]))
126+
benchmark(**dict(arg.split("=") for arg in argv[1:]))
127+
128+
129+
if __name__ == "__main__":
130+
main()

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools>=66.0.0", "wheel"]
2+
requires = ["setuptools>=75.0.0", "wheel"]
33
build-backend = "setuptools.build_meta:__legacy__"
44

55
[project]
@@ -33,7 +33,7 @@ classifiers = [
3333
"Topic :: Scientific/Engineering :: GIS",
3434
]
3535

36-
dependencies = ["cryptography>=42.0.0"]
36+
dependencies = ["cryptography>=45.0.0"]
3737

3838
[project.urls]
3939
homepage = "https://github.com/semuconsulting/pyspartn"
@@ -42,7 +42,7 @@ repository = "https://github.com/semuconsulting/pyspartn"
4242
changelog = "https://github.com/semuconsulting/pyspartn/blob/master/RELEASE_NOTES.md"
4343

4444
[project.optional-dependencies]
45-
deploy = ["build", "pip", "setuptools >= 66.0", "wheel"]
45+
deploy = ["build", "pip", "setuptools >= 75.0", "wheel"]
4646
test = [
4747
"bandit",
4848
"black",

src/pyspartn/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
:license: BSD 3-Clause
99
"""
1010

11-
__version__ = "1.0.5"
11+
__version__ = "1.0.6"

src/pyspartn/spartnreader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
NB Use of gnssTimeTag for message decryption:
2323
2424
The SPARTN protocol requires a key and basedate to calculate the Initialisation
25-
Vector (IV) for encrypted messages (eaf=1). The key is provided by the
25+
Vector (IV) for encrypted messages (eaf=1). The key is provided by the
2626
SPARTN service provider. The basedate is derived in one of two ways:
2727
2828
1. For messages with unambiguous 32-bit gnssTimeTag values (timeTagtype = 1),

src/pyspartn/spartntypes_get.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@
4343
)
4444
4545
An 'NB' prefix indicates that the element size is given by the number of set bits
46-
in the attribute, rather than its integer value e.g.
46+
in the attribute, rather than its integer value e.g.
4747
'NB + "SF011"' -> if SF011 = 0b0101101, the size of the repeating element is 4.
4848
4949
A '+1' or '+2' suffix indicates that the attribute name must be suffixed
5050
with the specified number of nested element indices e.g. 'SF041+1' -> 'SF041_01'
5151
52-
In some instances, the size of the repeating element must be derived from
52+
In some instances, the size of the repeating element must be derived from
5353
multiple attributes. In these cases the element size is denoted by a composite
5454
attribute name which is calculated within `spartnmessage.py` e.g. 'PBBMLEN'
5555

0 commit comments

Comments
 (0)