Skip to content

Conversation

@ChristopherRabotin
Copy link
Member

Refer to #360 for the ureq details.

I've usurped this PR to cleanup some Python exports, summarized by Gemini as follows:

  1. Expose Polynomial:

    • Makes the Polynomial struct available in Python, crucial for precise time scale conversions (e.g., modeling GPST-UTC differences).
    • Provides Python-friendly classmethod constructors (from_constant_offset, from_constant_offset_nanoseconds, from_offset_and_rate, from_offset_rate_nanoseconds).
    • Exposes the correction_duration method.
    • Adds a __str__ representation.
    • Includes Python tests validating Polynomial creation and its use within Epoch.precise_timescale_conversion.
  2. Expose Weekday:

    • Makes the Weekday enum available in Python.
    • Enables usage like epoch.next(Weekday.Monday).
    • Adds a corresponding Python test.
  3. Enhance Epoch Bindings:

    • Adds read-only duration and time_scale properties to the Python Epoch class for easier introspection.
    • Updates internal PyO3 API calls (PyDateTime::new, get_tzinfo) for compatibility or best practices.

These changes allow Python users to leverage more advanced features of hifitime, particularly for high-precision time scale adjustments and date calculations involving weekdays, directly from Python.

FusRoman and others added 8 commits April 2, 2025 19:19
…ings

This commit significantly expands the hifitime Python bindings:

1.  **Expose `Polynomial`:**
    *   Makes the `Polynomial` struct available in Python, crucial for precise time scale conversions (e.g., modeling GPST-UTC differences).
    *   Provides Python-friendly classmethod constructors (`from_constant_offset`, `from_constant_offset_nanoseconds`, `from_offset_and_rate`, `from_offset_rate_nanoseconds`).
    *   Exposes the `correction_duration` method.
    *   Adds a `__str__` representation.
    *   Includes Python tests validating `Polynomial` creation and its use within `Epoch.precise_timescale_conversion`.

2.  **Expose `Weekday`:**
    *   Makes the `Weekday` enum available in Python.
    *   Enables usage like `epoch.next(Weekday.Monday)`.
    *   Adds a corresponding Python test.

3.  **Enhance `Epoch` Bindings:**
    *   Adds read-only `duration` and `time_scale` properties to the Python `Epoch` class for easier introspection.
    *   Updates internal PyO3 API calls (`PyDateTime::new`, `get_tzinfo`) for compatibility or best practices.

These changes allow Python users to leverage more advanced features of hifitime, particularly for high-precision time scale adjustments and date calculations involving weekdays, directly from Python.
@ChristopherRabotin ChristopherRabotin merged commit d29290a into master Apr 24, 2025
27 checks passed
@ChristopherRabotin ChristopherRabotin deleted the 359-replace-reqwest-with-ureq branch April 24, 2025 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants