pyhamtools/README.md

170 lines
4.8 KiB
Markdown
Raw Permalink Normal View History

2014-06-15 09:06:17 +02:00
# pyhamtools
2014-04-24 13:48:38 +02:00
2021-06-01 03:27:32 +02:00
![Build Status](https://github.com/dh1tw/pyhamtools/actions/workflows/test.yml/badge.svg)
2018-01-28 02:30:15 +01:00
[![codecov](https://codecov.io/gh/dh1tw/pyhamtools/branch/master/graph/badge.svg)](https://codecov.io/gh/dh1tw/pyhamtools)
[![PyPI version](https://badge.fury.io/py/pyhamtools.svg)](https://badge.fury.io/py/pyhamtools)
2023-12-28 21:02:41 +01:00
Pyhamtools is a set of functions and classes for Amateur Radio purposes.
2021-06-01 03:27:32 +02:00
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,
2018-01-28 00:30:34 +01:00
DX-Clusters or Log Checking. This and additional convenience features are
provided for the following sources:
2014-06-15 10:13:09 +02:00
Currently,
* [AD1C's Amateur Radio Country Files](https://www.country-files.com)
2014-06-15 09:06:17 +02:00
* [Clublog Prefixes & Exceptions XML File](https://clublog.freshdesk.com/support/articles/54902-downloading-the-prefixes-and-exceptions-as)
* [Clublog DXCC Query API](http://clublog.freshdesk.com/support/articles/54904-how-to-query-club-log-for-dxcc)
2015-04-06 20:05:18 +02:00
* [QRZ.com XML API](http://www.qrz.com/XML/current_spec.html)
2014-06-15 09:06:17 +02:00
* [Redis.io](http://redis.io)
* [ARRL Logbook of the World (LOTW)](https://lotw.arrl.org)
2018-01-28 00:30:34 +01:00
* [eQSL.cc user list](https://www.eqsl.cc)
* [Clublog & OQRS user list](http://clublog.freshdesk.com/support/solutions/articles/3000064883-list-of-club-log-and-lotw-users)
2014-04-24 17:46:46 +02:00
2021-06-01 03:27:32 +02:00
Other modules include location-based calculations (e.g. distance,
heading between Maidenhead locators) or frequency-based calculations
(e.g. frequency to band).
2014-09-21 20:42:52 +02:00
2014-06-15 10:18:48 +02:00
## References
This Library is used in production at the [DXHeat.com DX Cluster](https://dxheat.com), performing several thousand lookups and calculations per day.
## Compatibility
2023-12-28 21:02:41 +01:00
Pyhamtools is compatible with Python >=3.6.
We check compatibility on OSX, Windows, and Linux with the following Python versions:
2018-01-28 00:30:34 +01:00
2023-12-28 21:02:41 +01:00
* Python 3.6 (will be deprecated in 2024)
* Python 3.7 (will be deprecated in 2024)
* Python 3.8
2021-06-01 03:27:32 +02:00
* Python 3.9
* Python 3.10
* Python 3.11
2023-12-28 21:02:41 +01:00
* Python 3.12
* [pypy3.7](https://pypy.org/) (will be deprecated in 2024)
* [pypy3.8](https://pypy.org/)
* [pypy3.9](https://pypy.org/)
2023-12-28 21:02:41 +01:00
* [pypy3.10](https://pypy.org/)
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.
2014-06-15 10:13:09 +02:00
## Documentation
2018-01-28 00:30:34 +01:00
Check out the full documentation including the changelog at:
[pyhamtools.readthedocs.org](http://pyhamtools.readthedocs.org/en/latest/index.html)
2014-06-15 09:06:17 +02:00
## License
2018-01-28 00:30:34 +01:00
Pyhamtools is published under the permissive [MIT License](http://choosealicense.com/licenses/mit/). You can find a good comparison of
Open Source Software licenses, including the MIT license at [choosealicense.com](http://choosealicense.com/licenses/)
## Dependencies
Starting with version 0.8.0, `libxml2-dev` and `libxslt-dev` are required dependencies.
2014-06-15 10:13:09 +02:00
## Installation
2014-06-15 09:06:17 +02:00
Install the dependencies (e.g. on Debian/Ubuntu):
```bash
$ sudo apt-get install libxml2-dev libxslt-dev
```
2021-06-01 03:27:32 +02:00
The easiest way to install pyhamtools is through the packet manager `pip`:
2018-01-28 00:30:34 +01:00
```bash
$ pip install pyhamtools
2014-06-15 10:25:16 +02:00
2018-01-28 00:30:34 +01:00
```
2014-06-15 09:06:17 +02:00
Christoph, [@df7cb](https://github.com/df7cb) is kindly maintaining a Debian package as an alternative way to install pyhamtools:
```bash
$ sudo apt-get install pyhamtools
```
2014-06-15 10:18:48 +02:00
## Example: How to use pyhamtools
2014-06-15 09:06:17 +02:00
``` python
2014-09-21 20:42:52 +02:00
>>> from pyhamtools.locator import calculate_heading
>>> calculate_heading("JN48QM", "QF67bf")
74.3136
2014-06-15 09:06:17 +02:00
>>> 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,
2018-01-28 00:39:01 +01:00
'longitude': 10.0,
2014-06-15 09:06:17 +02:00
'cqz': 14,
'ituz': 28
}
```
2014-06-15 10:13:09 +02:00
## Testing
An extensive set of unit tests has been created for all Classes & Methods.
2021-06-01 03:27:32 +02:00
To be able to perform all tests, you need a QRZ.com account and a
[Clublog API key](http://clublog.freshdesk.com/support/solutions/articles/54910-api-keys).
pyhamtools rely on the [pytest](https://docs.pytest.org/en/latest/) testing
2021-06-01 03:27:32 +02:00
framework. To install it with all the needed dependencies run:
```bash
$ pip install -r requirements-pytest.txt
```
2021-06-01 03:27:32 +02:00
The QRZ.com credentials and the Clublog API key have to be set in the environment
variables:
```bash
$ export CLUBLOG_APIKEY="<your API key>"
$ export QRZ_USERNAME="<your qrz.com username>"
$ export QRZ_PWD="<your qrz.com password>"
```
2021-06-01 03:27:32 +02:00
To perform the tests related to the [redis](https://redis.io/) key/value
store, a Redis server has to be up & running.
```bash
$ sudo apt install redis-server
$ redis-server
```
To run the tests, simply execute:
```bash
$ pytest --cov pyhamtools
```
## Generate the documentation
You can generate the documentation of pyhamtools with the following commands:
```bash
$ pip install -r requirements-docs.txt
$ cd docs
$ make html
```