Skip to main content

Utilities for working with ICAO AIRAC cycles, including cycle calculations, validation, and conversions.

Project description

airac-tools

PyPI - Version PyPI - License

airac-tools is a Python package for working with ICAO AIRAC (Aeronautical Information Regulation And Control) cycles.
It provides a variety of utilities to determine cycle dates, validate cycle strings, perform conversions, iterate over cycles, and more.


Features

  • Cycle Information Functions

    • get_current_cycle(date: datetime = None) -> str: Get the current AIRAC cycle for a given date.
    • get_next_cycle(date: datetime = None) -> str: Get the next AIRAC cycle after a given date.
    • get_previous_cycle(date: datetime = None) -> str: Get the previous AIRAC cycle.
    • get_cycle_start_date(cycle: str) -> datetime: Get the start date of a given AIRAC cycle.
    • get_cycle_end_date(cycle: str) -> datetime: Get the end date of a given AIRAC cycle.
  • Date Conversion Functions

    • date_to_cycle(date: datetime) -> str: Convert any date to its corresponding AIRAC cycle.
    • cycle_to_date(cycle: str) -> datetime: Convert an AIRAC cycle to its start date.
  • Validation Functions

    • is_valid_cycle(cycle: str) -> bool: Check if a given cycle string (like '2309') is valid.
    • is_date_in_cycle(date: datetime, cycle: str) -> bool: Check if a date falls within a specific cycle.
  • Listing/Iteration Functions

    • list_cycles(year: int) -> list[str]: List all AIRAC cycles for a given year.
    • cycles_between(start_cycle: str, end_cycle: str) -> list[str]: List all cycles between two cycles.
    • dates_between(start_cycle: str, end_cycle: str) -> list[datetime]: List start dates for each cycle in a range.
  • Utility Functions

    • cycle_offset(cycle: str, offset: int) -> str: Returns the cycle offset by N cycles.
    • format_cycle(cycle: str) -> str: Returns a human-readable cycle string.

Installation

Install from PyPI (when published):

pip install airac-tools

Or install locally (for development):

git clone https://github.com/jj-sm/airac-tools.git
cd airac-tools
pip install .

Usage

from airac_tools import cycle

# Get current AIRAC cycle
current_cycle = cycle.get_current_cycle()
print(cycle)  # e.g., '2308'

# List all cycles in 2025
cycles_2025 = cycle.list_cycles(2025)
print(cycles_2025)  # ['2501', ..., '2513']

# Convert date to cycle
from datetime import datetime, timezone
cycle_2 = cycle.date_to_cycle(datetime(2024, 8, 10, tzinfo=timezone.utc))
print(cycle)  # e.g., '2408'

# Get cycle start/end dates
start = cycle.get_cycle_start_date('2408')
end = cycle.get_cycle_end_date('2408')
print(start, end)

# Check if date is within a cycle
cycle.is_date_in_cycle(datetime(2024, 8, 10, tzinfo=timezone.utc), '2408')  # True

# Cycle offset
cycle.cycle_offset('2408', 2)  # '2410'

# Format cycle
from airac_tools import utils
print(utils.format_cycle('2408'))  # 'AIRAC 24/08'

Development

  • Clone the repository and install in editable mode:
    pip install -e .
    
  • Run tests with:
    pytest
    
  • Code is formatted with PEP8.
  • Contributions and issues are welcome!

License

MIT License.


Acknowledgements

AIRAC cycle rules are based on ICAO documentation and public sources.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

airac_tools-1.0.7.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

airac_tools-1.0.7-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file airac_tools-1.0.7.tar.gz.

File metadata

  • Download URL: airac_tools-1.0.7.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for airac_tools-1.0.7.tar.gz
Algorithm Hash digest
SHA256 c87d2a5668f9c92153c253628b267b3b4d90ce9c6286d40ae3793c0ac46aacec
MD5 3e75599b06b52f5293d13fa438dede96
BLAKE2b-256 07f9d42ae05e1aebf97eef5fcbb75328138a399f783080a1a450f583e656f76f

See more details on using hashes here.

Provenance

The following attestation bundles were made for airac_tools-1.0.7.tar.gz:

Publisher: publish.yaml on jj-sm/airac-cc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file airac_tools-1.0.7-py3-none-any.whl.

File metadata

  • Download URL: airac_tools-1.0.7-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for airac_tools-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 8cf6d5cd56a5b0a5d1f29ae15bb9e20fdfb45ed35e5af1647bc114b539308db4
MD5 05520219599d2eaec571882af155d5cb
BLAKE2b-256 5ded16c2f9ff0fa6d0a055b87a05762df37d143ba4c5a55ec8b2ffaec81dec8d

See more details on using hashes here.

Provenance

The following attestation bundles were made for airac_tools-1.0.7-py3-none-any.whl:

Publisher: publish.yaml on jj-sm/airac-cc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page