PyHamCTY 1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,131 @@
1
+ Metadata-Version: 2.4
2
+ Name: PyHamCTY
3
+ Version: 1.0
4
+ Summary: Read and search hamradio country data for callsigns in a CTY database
5
+ Author-email: "Andreas Schawo, DF1ASC" <andreas@schawo.de>
6
+ Project-URL: Homepage, https://codeberg.org/dragoncode/pyhamcty#readme
7
+ Project-URL: Bug Tracker, https://codeberg.org/dragoncode/pyhamcty/issues
8
+ Classifier: Development Status :: 5 - Production/Stable
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: Python :: 3 :: Only
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Programming Language :: Python :: 3.14
16
+ Classifier: Topic :: Communications :: Ham Radio
17
+ Classifier: Topic :: Software Development :: Libraries
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Requires-Python: >=3.11
20
+ Description-Content-Type: text/markdown
21
+ Requires-Dist: requests~=2.34
22
+ Provides-Extra: bench
23
+ Requires-Dist: notctyparser~=26.8; extra == "bench"
24
+ Provides-Extra: dev
25
+ Requires-Dist: coverage>=7.16; extra == "dev"
26
+ Requires-Dist: ruff~=0.16; extra == "dev"
27
+
28
+ PyHamCTY
29
+ =========
30
+
31
+ [![PyPI Package](https://img.shields.io/pypi/v/pyhamcty?color=%2334D058&label=PyPI%20Package)](https://pypi.org/project/pyhamcty)
32
+ ![Coverage](https://img.shields.io/badge/coverage-86%25-%2334D058?logo=umbrel)
33
+ [![Python versions](https://img.shields.io/pypi/pyversions/pyhamcty.svg?color=%2334D058&label=Python)](https://pypi.org/project/pyhamcty)
34
+
35
+ Author: Andreas Schawo, DF1ASC ([HamQTH](http://www.hamqth.com/DF1ASC), [eQSL](http://www.eqsl.cc/Member.cfm?DF1ASC))
36
+
37
+ This package provides reading [country databases](https://www.country-files.com/) (CTY files) and searching callsign
38
+ related information.
39
+
40
+ Also, it provides downloading of the most recent version. Per default, it acts with CTY files but BigCTY can also be
41
+ loaded.
42
+
43
+ Until October 2026 this library was part of [DragonLog](https://codeberg.org/dragoncode/DragonLog),
44
+ but I decided to place it as a separate project and did some enhancements.
45
+
46
+ Since May 2026 I also ported the cty module to Rust in [hamcty](https://codeberg.org/dragoncode/hamcty).
47
+ This speeds up even more thus I'm looking forward to generate Python bindings for it.
48
+
49
+
50
+ Remarks
51
+ -------
52
+
53
+ The longitude in the result (`lon` field in `Country`) is as commonly used
54
+ from 0° to 180° to the East and from 0° to -180° to the West.
55
+
56
+
57
+ Usage
58
+ -----
59
+
60
+ After installing the package you can simply do
61
+
62
+ ```python
63
+ import pyhamcty
64
+
65
+ cty = pyhamcty.CountryData() # Loads integrated CTY DB
66
+ res = cty.country('DA2CDE')
67
+ print(res.code, res.continent, res.cq, res.itu)
68
+ ```
69
+
70
+ If you want to load a more recent CTY do
71
+
72
+ ```python
73
+ import pyhamcty
74
+
75
+ pyhamcty.load_current('cty.csv')
76
+ cty = pyhamcty.CountryData('cty.csv')
77
+ ```
78
+
79
+ If faster loading time is critical you can dump a `CountryData` to pickle file and restore it from there
80
+
81
+ ```python
82
+ import os
83
+ import pyhamcty
84
+
85
+ if os.path.isfile('cty.pckl'):
86
+ cty = pyhamcty.load_pickle('cty.pckl')
87
+ else:
88
+ cty = pyhamcty.CountryData('cty.csv')
89
+ pyhamcty.dump_pickle(cty, 'cty.pckl')
90
+ ```
91
+
92
+ You also can run it from console to do a simple search. Without callsign it produces the version entity.
93
+
94
+ pysearch_cty DA2CDE
95
+
96
+ or to download the most recent CTY file and use it (`-c` for CTY, `-b` for BigCTY)
97
+
98
+ pysearch_cty -c cty.csv
99
+ pysearch_cty DA2CDE cty.csv
100
+
101
+ Performance
102
+ -----------
103
+
104
+ I recently stumbled upon `ctyparser` and `notctyparser` as I examined [Not1MM](https://github.com/mbridak/not1mm).
105
+ So I was curious how both will compare.
106
+ I measured the memory footprint, loading time and searching with 20 callsigns 100 times.
107
+
108
+ The data for the bench is the same version VER20260603 (3DA, Kingdom of Eswatini).
109
+ I tested the correct country resolution with "LU1DD", "LU1ZB", "LU1ZA", "LU1ZAW".
110
+
111
+ _Remark:_ `ctyparser` and `notctyparser` both do not provide a complete callsign resolution, so I took the function from
112
+ Not1MM
113
+
114
+ The first value is for CTY, the second for BigCTY.
115
+
116
+ | Lib | pyhamcty (.csv) | pyhamcty (.pckl) | [not]ctyparser (.dat) | [not]ctyparser (.json) |
117
+ |----------|---------------------|--------------------|-----------------------|------------------------|
118
+ | Size | 102.3 / 293.7 kB | 624.4 kB / 2 MB | 99.8 / 339.9 kB | 1.1 / 4.8 MB |
119
+ | Memory | 149.4 / 474.8 kB | 153.8 / 481.9 kB | 202.8 / 938.8 kB | same as .dat |
120
+ | Load | 39.132 / 117.4 ms | 14.239 / 44.081 ms | 63.72 / 267.932 ms | 20.296 / 92.563 ms |
121
+ | Search | 311.125 / 501.82 ms | same as .csv | 5.041 / 24.489 s | same as .dat |
122
+ | Per call | 0.16 / 0.25 ms | same as .csv | 2.52 / 12.2 ms | same as .dat |
123
+
124
+
125
+ Copyright
126
+ ---------
127
+
128
+ &copy; 2026 by Andreas Schawo is licensed under [CC BY-SA 4.0](http://creativecommons.org/licenses/by-sa/4.0/)
129
+
130
+ except the included CTY database files (see corresponding copyright) and
131
+ some code in bench_notctyparser.py (see code comments).
@@ -0,0 +1,13 @@
1
+ pyhamcty/__init__.py,sha256=lWmlylvTn5uRYqdSxt_u9g02l0kgJF3u65CVPz8DEY4,260
2
+ pyhamcty/__main__.py,sha256=5P9XPC3x55sV68hHxV2hqi2qHmBPOPQK0-CdSRrhkh0,1232
3
+ pyhamcty/cty.py,sha256=0xxrLYMOwL-sDT8T9e211k0oWD7KAnybGYwUHz5rh18,8783
4
+ pyhamcty/data/HISTORY.TXT,sha256=7icR8mEd25ET2VhNasW9SmPiwsveBRIPZPu20RNkI8E,21194
5
+ pyhamcty/data/README.TXT,sha256=jvfz9znwFKdPkygWzH9S68HxHm-9BlVj04wWx6A-bY4,6814
6
+ pyhamcty/data/copyright.txt,sha256=IM0IvKCbUCNu2s_PHHn8n1AajA12w20o9CgZskPzp-4,1195
7
+ pyhamcty/data/cty.csv,sha256=sDMJkB0PusG_CYWXvMKkRPiFg2UOILAEgvZ4StAmCGw,107933
8
+ pyhamcty/data/fetch_recent.py,sha256=KlabtUcss6CCXNXR_Pm0_3grWUt64V9RaRYW_qyDF74,2779
9
+ pyhamcty-1.0.dist-info/METADATA,sha256=qfG_ZI2rRt7YNrJi4GTR_dI5FNGMOg8EQMCJ6Ktv1YI,5049
10
+ pyhamcty-1.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
11
+ pyhamcty-1.0.dist-info/entry_points.txt,sha256=DOlG1FthIFien0N5ovCiu9qGA3-Dr_rvjfVUfDWlIO8,56
12
+ pyhamcty-1.0.dist-info/top_level.txt,sha256=N1RmCLia22YzjKiqKNocpRTzPkd0lBVOTtgYJZP69vI,9
13
+ pyhamcty-1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ pysearch_cty = pyhamcty.__main__:main
@@ -0,0 +1 @@
1
+ pyhamcty