Metadata-Version: 2.4
Name: angle-parser
Version: 0.1.0
Summary: An angle parsing module
Project-URL: Homepage, https://github.com/tmolteno/angle-parser
Project-URL: Repository, https://github.com/tmolteno/angle-parser
Author-email: Tim Molteno <tim@elec.ac.nz>
License: MIT
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# angle-parser

A simple Python module for parsing angle strings.

## Installation

```bash
pip install angle-parser
```

## Usage

```python
from angle_parser import parse_angle

parse_angle("90 deg")       # 1.5707963267948966  (π/2 radians)
parse_angle("180 deg")      # 3.141592653589793   (π radians)
parse_angle("1 arcmin")     # 0.000290888...       (1/60 degree in radians)
parse_angle("1 arcsec")     # 4.8481368...e-06     (1/3600 degree in radians)
parse_angle("1 rad")        # 1.0
parse_angle("-45 deg")      # -0.785398...         (negative angles)
parse_angle("1.5e2 deg")    # 2.617993...          (scientific notation)
```

## Supported Suffixes

| Suffix   | Description              | Radians multiplier |
|----------|--------------------------|--------------------|
| `deg`    | Degrees                  | π/180              |
| `arcmin` | Arcminutes (1/60 degree) | π/10800            |
| `arcsec` | Arcseconds (1/3600 deg)  | π/648000           |
| `rad`    | Radians                  | 1.0                |

## API

### `parse_angle(string)`

Parse an angle string and return the value in radians.

- **Parameters:** `string` — A string containing a numeric value followed by a valid suffix (`deg`, `arcmin`, `arcsec`, `rad`), with optional whitespace.
- **Returns:** `float` — The angle in radians.
- **Raises:** `ValueError` — if the string does not match the expected format.

## License

Copyright (c) Tim Molteno 2026 (tim@elec.ac.nz)

MIT License
