PyHamCTY
Author: Andreas Schawo, DF1ASC (HamQTH, eQSL)
This package provides reading country databases (CTY files) and searching callsign related information.
Also, it provides downloading of the most recent version. Per default, it acts with CTY files but BigCTY can also be loaded.
Until October 2026 this library was part of DragonLog, but I decided to place it as a separate project and did some enhancements.
Since May 2026 I also ported the cty module to Rust in hamcty. This speeds up even more thus I'm looking forward to generate Python bindings for it.
Remarks
The longitude in the result (lon field in Country) is as commonly used
from 0° to 180° to the East and from 0° to -180° to the West.
Usage
After installing the package you can simply do
import pyhamcty
cty = pyhamcty.CountryData() # Loads integrated CTY DB
res = cty.country('DA2CDE')
print(res.code, res.continent, res.cq, res.itu)
If you want to load a more recent CTY do
import pyhamcty
pyhamcty.load_current('cty.csv')
cty = pyhamcty.CountryData('cty.csv')
If faster loading time is critical you can dump a CountryData to pickle file and restore it from there
import os
import pyhamcty
if os.path.isfile('cty.pckl'):
cty = pyhamcty.load_pickle('cty.pckl')
else:
cty = pyhamcty.CountryData('cty.csv')
pyhamcty.dump_pickle(cty, 'cty.pckl')
You also can run it from console to do a simple search. Without callsign it produces the version entity.
pysearch_cty DA2CDE
or to download the most recent CTY file and use it (-c for CTY, -b for BigCTY)
pysearch_cty -c cty.csv
pysearch_cty DA2CDE cty.csv
Performance
I recently stumbled upon ctyparser and notctyparser as I examined Not1MM.
So I was curious how both will compare.
I measured the memory footprint, loading time and searching with 20 callsigns 100 times.
The data for the bench is the same version VER20260603 (3DA, Kingdom of Eswatini). I tested the correct country resolution with "LU1DD", "LU1ZB", "LU1ZA", "LU1ZAW".
Remark: ctyparser and notctyparser both do not provide a complete callsign resolution, so I took the function from
Not1MM
The first value is for CTY, the second for BigCTY.
| Lib | pyhamcty (.csv) | pyhamcty (.pckl) | [not]ctyparser (.dat) | [not]ctyparser (.json) |
|---|---|---|---|---|
| Size | 102.3 / 293.7 kB | 624.4 kB / 2 MB | 99.8 / 339.9 kB | 1.1 / 4.8 MB |
| Memory | 149.4 / 474.8 kB | 153.8 / 481.9 kB | 202.8 / 938.8 kB | same as .dat |
| Load | 39.132 / 117.4 ms | 14.239 / 44.081 ms | 63.72 / 267.932 ms | 20.296 / 92.563 ms |
| Search | 311.125 / 501.82 ms | same as .csv | 5.041 / 24.489 s | same as .dat |
| Per call | 0.16 / 0.25 ms | same as .csv | 2.52 / 12.2 ms | same as .dat |
Copyright
© 2026 by Andreas Schawo is licensed under CC BY-SA 4.0
except the included CTY database files (see corresponding copyright) and some code in bench_notctyparser.py (see code comments).
Metadata
Release files for PyHamCTY 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyhamcty-1.0.1.tar.gz | 56.0 kB | Without provenance | Details for pyhamcty-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyhamcty-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for pyhamcty-1.0.1-py3-none-any.whl |
Total release size: 110.4 kB
Release files / pyhamcty-1.0.1.tar.gz
| Download URL | pyhamcty-1.0.1.tar.gz |
|---|---|
| Size | 56.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
985dee58c47025d3fce4ab76f752bd8126c99fbbc914e65369464e3ad69ffd18
|
|
BLAKE2b-256 checksum How to use checksums |
a0333e2458f76931c7fcc42d1104dfa042122fdc63a1ae034b8cc6964fb99b31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / pyhamcty-1.0.1-py3-none-any.whl
| Download URL | pyhamcty-1.0.1-py3-none-any.whl |
|---|---|
| Size | 54.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d8a6ed351ae970933c0f02f0ff4c7eaa68e92e37dd3cf70c7236f81504306aba
|
|
BLAKE2b-256 checksum How to use checksums |
38a6228b521acfd42177a2d9d12f0e13928bb451475d8568efa3305bf2a6405d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for PyHamCTY 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.