A Library with Amateur Radio specific Functions and Methods
Find a file
Tobias Wellnitz, DH1TW 0313cb72e5 updated docs
2023-12-28 20:51:33 +01:00
.github/workflows macos randomize 2023-12-28 18:08:56 +01:00
docs updated docs 2023-12-28 20:51:33 +01:00
pyhamtools updated docs 2023-12-28 20:51:33 +01:00
test removed support for python 2.7 2023-12-28 20:42:20 +01:00
.gitignore updated .gitignore with pyenv variables 2021-12-16 00:07:45 +01:00
LICENSE Initial commit 2014-04-24 04:48:38 -07:00
README.md updated docs 2023-12-28 20:51:33 +01:00
readthedocs-pip-requirements.txt added dependency for readthedocs 2019-05-30 15:31:20 +02:00
requirements-docs.txt merging v0.8.0 branch 2022-12-05 01:01:45 +01:00
requirements-pytest.txt consolidating runner 2023-12-28 17:34:34 +01:00
setup.py removed support for python 2.7 2023-12-28 20:42:20 +01:00

pyhamtools

Build Status codecov PyPI version

Pyhamtools is a set of functions and classes for Amateur Radio purposes. Currently, the core part is the Callsign Lookup which decodes any amateur radio callsign string and provides the corresponding information (Country, DXCC entity, CQ Zone...etc). This basic functionality is needed for Logbooks, DX-Clusters or Log Checking. This and additional convenience features are provided for the following sources:

Currently,

Other modules include location-based calculations (e.g. distance, heading between Maidenhead locators) or frequency-based calculations (e.g. frequency to band).

References

This Library is used in production at the DXHeat.com DX Cluster, performing several thousand lookups and calculations per day.

Compatibility

Pyhamtools is compatible with Python >=3.6. We check compatibility on OSX, Windows, and Linux with the following Python versions:

  • Python 3.6 (will be deprecated in 2024)
  • Python 3.7 (will be deprecated in 2024)
  • Python 3.8
  • Python 3.9
  • Python 3.10
  • Python 3.11
  • Python 3.12
  • pypy3.7 (will be deprecated in 2024)
  • pypy3.8
  • pypy3.9
  • pypy3.10

The support for Python 2.7 and 3.5 has been deprecated at the end of 2023. The last version which supports Python 2.7 and Python 3.5 is 0.8.7.

Documentation

Check out the full documentation including the changelog at: pyhamtools.readthedocs.org

License

Pyhamtools is published under the permissive MIT License. You can find a good comparison of Open Source Software licenses, including the MIT license at choosealicense.com

Dependencies

Starting with version 0.8.0, libxml2-dev and libxslt-dev are required dependencies.

Installation

Install the dependencies (e.g. on Debian/Ubuntu):


$ sudo apt-get install libxml2-dev libxslt-dev

The easiest way to install pyhamtools is through the packet manager pip:


$ pip install pyhamtools

Christoph, @df7cb is kindly maintaining a Debian package as an alternative way to install pyhamtools:


$ sudo apt-get install pyhamtools

Example: How to use pyhamtools


>>> from pyhamtools.locator import calculate_heading
>>> calculate_heading("JN48QM", "QF67bf")
74.3136


>>> from pyhamtools import LookupLib, Callinfo
>>> my_lookuplib = LookupLib(lookuptype="countryfile")
>>> cic = Callinfo(my_lookuplib)
>>> cic.get_all("DH1TW")
    {
        'country': 'Fed. Rep. of Germany',
        'adif': 230,
        'continent': 'EU',
        'latitude': 51.0,
        'longitude': 10.0,
        'cqz': 14,
        'ituz': 28
    }

Testing

An extensive set of unit tests has been created for all Classes & Methods. To be able to perform all tests, you need a QRZ.com account and a Clublog API key.

pyhamtools rely on the pytest testing framework. To install it with all the needed dependencies run:


$ pip install -r requirements-pytest.txt

The QRZ.com credentials and the Clublog API key have to be set in the environment variables:


$ export CLUBLOG_APIKEY="<your API key>"
$ export QRZ_USERNAME="<your qrz.com username>"
$ export QRZ_PWD="<your qrz.com password>"

To perform the tests related to the redis key/value store, a Redis server has to be up & running.


$ sudo apt install redis-server
$ redis-server

To run the tests, simply execute:


$ pytest --cov pyhamtools

Generate the documentation

You can generate the documentation of pyhamtools with the following commands:


$ pip install -r requirements-docs.txt
$ cd docs
$ make html