Skip to main content

angle-parser

A simple Python module for parsing angle strings.

Installation

pip install angle-parser

Usage

from angle_parser import parse_angle

# Whitespace between value and suffix is optional
parse_angle("90 deg")       # 1.5707963267948966  (π/2 radians)
parse_angle("90deg")        # 1.5707963267948966  (same, no space)
parse_angle("1 arcmin")     # 0.000290888...       (1/60 degree in radians)
parse_angle("1'")           # 0.000290888...       (synonym for arcmin)
parse_angle("1 arcsec")     # 4.8481368...e-06     (1/3600 degree in radians)
parse_angle('1"')           # 4.8481368...e-06     (synonym for arcsec)
parse_angle("1000 mas")     # 4.8481368...e-06     (milli-arcsec)
parse_angle("1e6 uas")      # 4.8481368...e-06     (micro-arcsec)
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
' Arcminutes (synonym) π/10800
arcsec Arcseconds (1/3600 deg) π/648000
" Arcseconds (synonym) π/648000
mas Milli-arcseconds π/648000000
uas Micro-arcseconds π/648000000000
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/", mas, uas, rad). Whitespace between the value and suffix is optional.
  • 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

Metadata

Release files for angle-parser 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for angle-parser 0.2.1
File Size Uploaded Provenance Actions
angle_parser-0.2.1.tar.gz 3.2 kB With provenance Details for angle_parser-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for angle-parser 0.2.1
File Interpreter ABI Platform Actions
angle_parser-0.2.1-py3-none-any.whl Python 3 none any Details for angle_parser-0.2.1-py3-none-any.whl

Total release size: 6.1 kB

Release files / angle_parser-0.2.1.tar.gz

Download URL angle_parser-0.2.1.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b389c3475f4935db6777b3d40740249aca692d3ffd5630f47969ee584b63a508
BLAKE2b-256 checksum
How to use checksums
835eb1907a02f3478e3b65fce24fa812a74e5dab515c1c6768a3bd1e3df7b2db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 29, 2026.

Transparency log

Release files / angle_parser-0.2.1-py3-none-any.whl

Download URL angle_parser-0.2.1-py3-none-any.whl
Size 2.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
93629180ed34a5d5b687d30be44705da2972ec4a006b6cc0d032a49f5b0845ba
BLAKE2b-256 checksum
How to use checksums
ebeac9b0c5ef959dbb0be695f99f10a709f289df54259979425a3fbcf5876975
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 29, 2026.

Transparency log

Security for angle-parser 0.2.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for angle_parser-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 29, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page