Skip to content

Commit

Permalink
Merge pull request #259 from nyx-space/dependabot/cargo/pyo3-0.20.0
Browse files Browse the repository at this point in the history
Update pyo3 requirement from 0.19.0 to 0.20.0
  • Loading branch information
ChristopherRabotin authored Nov 18, 2023
2 parents b58ed96 + 11c5246 commit b731275
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 23 deletions.
25 changes: 19 additions & 6 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is autogenerated by maturin v0.14.17
# This file is autogenerated by maturin v1.3.2
# To update, run
#
# maturin generate-ci --pytest -o .github/workflows/python.yml github
Expand Down Expand Up @@ -28,14 +28,27 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.11'
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter -F python
sccache: 'true'
manylinux: auto
before-script-linux: |
# If we're running on rhel centos, install needed packages.
if command -v yum &> /dev/null; then
yum update -y && yum install -y perl-core openssl openssl-devel pkgconfig libatomic
# If we're running on i686 we need to symlink libatomic
# in order to build openssl with -latomic flag.
if [[ ! -d "/usr/lib64" ]]; then
ln -s /usr/lib/libatomic.so.1 /usr/lib/libatomic.so
fi
else
# If we're running on debian-based system.
apt update -y && apt-get install -y libssl-dev openssl pkg-config
fi
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -74,7 +87,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.11'
architecture: ${{ matrix.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
Expand Down Expand Up @@ -105,7 +118,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.11'
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
Expand Down Expand Up @@ -156,4 +169,4 @@ jobs:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
command: upload
args: --skip-existing *
args: --non-interactive --skip-existing *
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust:
- { version: "1.64", name: MSRV }
- { version: "1.70", name: MSRV }
- { version: stable, name: stable }

runs-on: ${{ matrix.os }}
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hifitime"
version = "3.8.4"
version = "3.8.5"
authors = ["Christopher Rabotin <[email protected]>"]
description = "Ultra-precise date and time handling in Rust for scientific applications with leap second support"
homepage = "https://nyxspace.com/"
Expand All @@ -21,7 +21,7 @@ name = "hifitime"
serde = { version = "1.0.155", optional = true }
serde_derive = { version = "1.0.155", optional = true }
der = { version = "0.6.1", features = ["derive", "real"], optional = true }
pyo3 = { version = "0.19.0", features = ["extension-module"], optional = true }
pyo3 = { version = "0.20.0", features = ["extension-module"], optional = true }
num-traits = { version = "0.2.15", default-features = false, features = [
"libm",
] }
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ In Python:

[![hifitime on crates.io][cratesio-image]][cratesio]
[![hifitime on docs.rs][docsrs-image]][docsrs]
[![minimum rustc: 1.64](https://img.shields.io/badge/minimum%20rustc-1.64-yellowgreen?logo=rust)](https://www.whatrustisit.com)
[![minimum rustc: 1.70](https://img.shields.io/badge/minimum%20rustc-1.70-yellowgreen?logo=rust)](https://www.whatrustisit.com)
[![Build Status](https://github.com/nyx-space/hifitime/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/nyx-space/hifitime/actions)
[![Build Status](https://github.com/nyx-space/hifitime/actions/workflows/formal_verification.yml/badge.svg?branch=master)](https://github.com/nyx-space/hifitime/actions)
[![codecov](https://codecov.io/gh/nyx-space/hifitime/branch/master/graph/badge.svg?token=l7zU57rUGs)](https://codecov.io/gh/nyx-space/hifitime)
Expand Down Expand Up @@ -309,6 +309,12 @@ In order to provide full interoperability with NAIF, hifitime uses the NAIF algo

# Changelog

## 3.8.5

Changes from 3.8.2 are only dependency upgrades until this release.

Minimum Supported Rust version bumped from 1.64 to **1.70**.

## 3.8.2
+ Clarify README and add a section comparing Hifitime to `time` and `chrono`, cf. [#221](https://github.com/nyx-space/hifitime/issues/221)
+ Fix incorrect printing of Gregorian dates prior to to 1900, cf. [#204](https://github.com/nyx-space/hifitime/issues/204)
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["maturin>=0.13,<0.14"]
requires = ["maturin>=1.3,<1.4"]
build-backend = "maturin"

[project]
Expand All @@ -15,4 +15,4 @@ classifiers = [
[tool.yapf]
based_on_style = "google"
spaces_before_comment = 4
column_limit = 100
column_limit = 100
26 changes: 17 additions & 9 deletions src/duration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -730,15 +730,23 @@ impl Duration {
}

#[cfg(feature = "python")]
fn __richcmp__(&self, other: Self, op: CompareOp) -> bool {
match op {
CompareOp::Lt => *self < other,
CompareOp::Le => *self <= other,
CompareOp::Eq => *self == other,
CompareOp::Ne => *self != other,
CompareOp::Gt => *self > other,
CompareOp::Ge => *self >= other,
}
fn __le__(&self, other: Self) -> bool {
*self <= other
}

#[cfg(feature = "python")]
fn __lt__(&self, other: Self) -> bool {
*self < other
}

#[cfg(feature = "python")]
fn __ge__(&self, other: Self) -> bool {
*self >= other
}

#[cfg(feature = "python")]
fn __gt__(&self, other: Self) -> bool {
*self > other
}

// Python constructors
Expand Down
13 changes: 12 additions & 1 deletion tests/python/test_epoch.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from hifitime import Epoch, TimeSeries, Unit
from hifitime import Epoch, TimeSeries, Unit, Duration
from datetime import datetime


Expand Down Expand Up @@ -44,3 +44,14 @@ def test_time_series():
print(f"#{num}:\t{epoch}")

assert num == 10

def test_duration_eq():
"""
Checks that Duration comparisons work
"""

assert Unit.Second * 0.0 == Duration("0 ns")
assert Unit.Second * 1.0 >= Duration("0 ns")
assert Unit.Second * 1.0 > Duration("0 ns")
assert Duration("0 ns") <= Unit.Second * 1.0
assert Duration("0 ns") < Unit.Second * 1.0
2 changes: 1 addition & 1 deletion tests/ut1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ fn test_ut1_from_jpl() {
let ut1_epoch = epoch.to_ut1(provider);
assert_eq!(
format!("{:x}", ut1_epoch),
"2022-01-03T03:05:06.679020600 TAI",
"2022-01-03T03:05:43.789100000 TAI",
);
}

0 comments on commit b731275

Please sign in to comment.