Skip to content

0.5.0 release #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 23 additions & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## 0.3.0-alpha.1 (unreleased)
## 0.5.0

### Added

Expand All @@ -20,7 +20,7 @@
- Added support for MPIO driver (HDF5 has to be built with H5_HAVE_PARALLEL and
the crate has to be built with "mpio" feature enabled).
- Added support for direct VFD driver (HDF5 has to be built with H5_HAVE_DIRECT).
- Added some missing bindings to `libhdf5-sys`: driver-related FAPL bindings
- Added some missing bindings to `hdf5-sys`: driver-related FAPL bindings
in h5p/h5fd (including MPIO and direct VFD drivers), MPIO bindings in h5p/h5f/h5fd.
- Added core reading/writing API in `Container`, with support for reading/writing scalars,
1-d, 2-d, and dynamic-dimensional arrays, and raw slices. As a side effect, the main crate
Expand All @@ -32,10 +32,13 @@

### Changed

- Renamed `hdf5-rs` crate (importable as `h5`) to `hdf5` (importable simply as `hdf5`).
- Renamed `libhdf5-sys` crate to `hdf5-sys` (importable as `hdf5_sys`).
- Renamed GitHub repository to `aldanor/hdf5-rust`.
- Updated the bindings and tests to the latest HDF5 versions (1.10.4 and 1.8.21).
- The build system has been reworked from the ground up:
- `libhdf5-lib` crate has been removed; all of the build-time logic now resides
in the build script of `libhdf5-sys`.
- `hdf5-lib` crate has been removed; all of the build-time logic now resides
in the build script of `hdf5-sys`.
- The environment variables the build script reacts to are now `HDF5_DIR` and `HDF5_VERSION`.
- `pkg-config` is now only launched on Linux.
- On macOS, the build scripts detects Homebrew installations, for both 1.8 and 1.10 versions.
Expand All @@ -44,7 +47,7 @@
- A few definitions from `H5pubconf.h` are now exposed as cfg definitions, like
`h5_have_parallel`, `h5_have_threadsafe` and `h5_have_direct` (this requires us to
locate the include folder and parse the header at build time).
- Various clean ups in `libhdf5-sys`: implemented `Default` and `Clone` where
- Various clean ups in `hdf5-sys`: implemented `Default` and `Clone` where
applicable, moved a few types and methods to matching parent modules.
- Major refactor: trait-based type hierarchy has been replaced with a `Deref`-based
hierarchy instead (53eff4f). `ID` and `FromID` traits have been removed. Traits like `Location`,
Expand All @@ -66,10 +69,17 @@

### Removed

- Removed `libhdf5-lib` crate (merged it into `libhdf5-sys`, see above).
- Removed `hdf5-lib` crate (merged it into `hdf5-sys`, see above).
- Removed `remutex` crate, using locking primitives from `parking_lot` crate instead.
- `Container` trait has been removed, all of its functionality merged into `Group` type.

### Notes

- The version number jump is due to renaming crates `hdf5-rs` and `libhdf5-sys` to `hdf5` and
`hdf5-sys`, respectively. Since there were already published crates with those names and
the crates registry is meant to be immutable even if the crates are yanked, we had to
bump the version so that it shadows all of the older versions.

## 0.2.0 (Apr 17, 2016)

### Added
Expand All @@ -81,19 +91,19 @@
the `bin` folder of HDF5 installation, the library directory will be inferred automatically.
The official HDF5 installers add the `bin` folder to user path, so the official MSVC releases
should just work out of the box without having to set any environment variables.
- The library is now split into three crates: `libhdf5-lib` (requests linkage to HDF5),
`libhdf5-sys` (contains bindings, requires `libhdf5-lib` at build time in order to conditionally
enable or disable certain HDF5 functionality), and `hdf5-rs` (the user-facing crate, requires
- The library is now split into three crates: `hdf5-lib` (requests linkage to HDF5),
`hdf5-sys` (contains bindings, requires `hdf5-lib` at build time in order to conditionally
enable or disable certain HDF5 functionality), and `hdf5` (the user-facing crate, requires
both lower-level crates at build time).
- Added `h5::hdf5_version` function.
- Added `hdf5::hdf5_version` function.
- The minimum required version of the HDF5 library is now 1.8.4.
- Both `libhdf5-sys` and `hdf5-rs` crates can now use version attributes at compile time to
- Both `hdf5-sys` and `hdf5` crates can now use version attributes at compile time to
enable/disable/change functionality. All functions and definitions that appeared in HDF5 versions
past 1.8.4 are now conditionally enabled in `libhdf5-sys`.
past 1.8.4 are now conditionally enabled in `hdf5-sys`.
- Added bindings for HDF5 functions that were added in releases 1.8.15 and 1.8.16.
- Static global variables in HDF5 (H5E, H5P, H5T) are now linked based on HDF5 version and not
the target platform (`_ID_g` variables were introduced in 1.8.14). When `msvc` target is used,
the dllimport stub prefixes are also accounted for. The constants exposed by `libhdf5-sys` are
the dllimport stub prefixes are also accounted for. The constants exposed by `hdf5-sys` are
now of reference type and need to be dereferenced upon use (for `msvc`, they have to be
dereferenced twice).

Expand Down
25 changes: 11 additions & 14 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,39 +1,36 @@
[package]
name = "hdf5-rs"
version = "0.2.0"
name = "hdf5"
version = "0.5.0"
authors = ["Ivan Smirnov <[email protected]>"]
keywords = ["hdf5"]
license = "MIT/Apache-2.0"
readme = "README.md"
description = "Thread-safe Rust bindings for the HDF5 library."
repository = "https://github.com/aldanor/hdf5-rs"
homepage = "https://github.com/aldanor/hdf5-rs"
repository = "https://github.com/aldanor/hdf5-rust"
homepage = "https://github.com/aldanor/hdf5-rust"
build = "build.rs"
edition = "2018"

[lib]
name = "h5"

[features]
default = []
mpio = ["mpi-sys", "libhdf5-sys/mpio"]
mpio = ["mpi-sys", "hdf5-sys/mpio"]

[workspace]
members = ["hdf5-types", "hdf5-derive", "libhdf5-sys"]
members = ["hdf5-types", "hdf5-derive", "hdf5-sys"]
exclude = ["*.yml", "ci/*"]

[dependencies]
bitflags = "1.0"
lazy_static = "1.2"
lazy_static = "1.3"
libc = "0.2"
parking_lot = "0.7"
ndarray = "0.12"
num-integer = "0.1"
num-traits = "0.2"
mpi-sys = { version = "0.1", optional = true }
libhdf5-sys = { path = "libhdf5-sys", version = "0.2.0" }
hdf5-types = { path = "hdf5-types", version = "0.2.0" }
hdf5-derive = { path = "hdf5-derive", version = "0.2.0" }
hdf5-sys = { path = "hdf5-sys", version = "0.5.0" }
hdf5-types = { path = "hdf5-types", version = "0.5.0" }
hdf5-derive = { path = "hdf5-derive", version = "0.5.0" }

[dev-dependencies]
mashup = "0.1"
Expand All @@ -43,4 +40,4 @@ scopeguard = "1.0"
tempdir = "0.3"

[build-dependencies]
libhdf5-sys = { path = "libhdf5-sys", version = "0.2.0" }
hdf5-sys = { path = "hdf5-sys", version = "0.5.0" }
40 changes: 24 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,47 @@
# hdf5-rs
# `hdf5`

[![Build Status](https://img.shields.io/travis/aldanor/hdf5-rs.svg)](https://travis-ci.org/aldanor/hdf5-rs) [![Appveyor Build Status](https://img.shields.io/appveyor/ci/aldanor/hdf5-rs.svg)](https://ci.appveyor.com/project/aldanor/hdf5-rs)
[![Build Status](https://img.shields.io/travis/aldanor/hdf5-rust.svg)](https://travis-ci.org/aldanor/hdf5-rust) [![Appveyor Build Status](https://img.shields.io/appveyor/ci/aldanor/hdf5-rust.svg)](https://ci.appveyor.com/project/aldanor/hdf5-rust)

[Documentation](https://docs.rs/crate/hdf5-rs)
[Changelog](https://github.com/aldanor/hdf5-rs/blob/master/CHANGELOG.md)
[Documentation](https://docs.rs/crate/hdf5)
[Changelog](https://github.com/aldanor/hdf5-rust/blob/master/CHANGELOG.md)

Thread-safe Rust bindings and high-level wrappers for the HDF5 library API.
The `hdf5` crate (previously known as `hdf5-rs`) provides thread-safe Rust bindings and
high-level wrappers for the HDF5 library API. Some of the features include:

- Thread-safety with non-threadsafe libhdf5 builds guaranteed via reentrant mutexes.
- Native representation of most HDF5 types, including variable-length strings and arrays.
- Derive-macro for automatic mapping of user structs and enums to HDF5 types.
- Multi-dimensional array reading/writing interface via `ndarray`.

Direct low-level bindings are also available and are provided in the `hdf5-sys` crate.

Requires HDF5 library of version 1.8.4 or later.

## Example

```rust
#[derive(h5::H5Type, Clone, PartialEq, Debug)]
#[derive(hdf5::H5Type, Clone, PartialEq, Debug)]
#[repr(u8)]
pub enum Color {
RED = 1,
GREEN = 2,
BLUE = 3,
}

#[derive(h5::H5Type, Clone, PartialEq, Debug)]
#[derive(hdf5::H5Type, Clone, PartialEq, Debug)]
#[repr(C)]
pub struct Pixel {
xy: (i64, i64),
color: Color,
}

fn main() -> h5::Result<()> {
fn main() -> hdf5::Result<()> {
use self::Color::*;
use ndarray::{arr1, arr2};

{
// write
let file = h5::File::open("pixels.h5", "w")?;
let file = hdf5::File::open("pixels.h5", "w")?;
let colors = file.new_dataset::<Color>().create("colors", 2)?;
colors.write(&[RED, BLUE])?;
let group = file.create_group("dir")?;
Expand All @@ -45,7 +53,7 @@ fn main() -> h5::Result<()> {
}
{
// read
let file = h5::File::open("pixels.h5", "r")?;
let file = hdf5::File::open("pixels.h5", "r")?;
let colors = file.dataset("colors")?;
assert_eq!(colors.read_1d::<Color>()?, arr1(&[RED, BLUE]));
let pixels = file.dataset("dir/pixels")?;
Expand All @@ -67,12 +75,12 @@ fn main() -> h5::Result<()> {

### Platforms

`hdf5-rs` is known to run on these platforms: Linux, macOS, Windows (tested on Travis CI and
AppVeyor, HDF5 1.8 and 1.10, system installations and conda environments).
`hdf5` crate is known to run on these platforms: Linux, macOS, Windows (tested on Travis
CI and AppVeyor, HDF5 1.8 and 1.10, system installations and conda environments).

### Rust

`hdf5-rs` is tested continuously for all three official release channels, and requires
`hdf5` crate is tested continuously for all three official release channels, and requires
a modern Rust compiler (e.g. of version 1.31 or later).

### HDF5
Expand All @@ -84,7 +92,7 @@ threadsafe option enabled.

### HDF5 version

Build scripts for both `libhdf5-sys` and `hdf5-rs` crates check the actual version of the
Build scripts for both `hdf5-sys` and `hdf5` crates check the actual version of the
HDF5 library that they are being linked against, and some functionality may be conditionally
enabled or disabled at compile time. While this allows supporting multiple versions of HDF5
in a single codebase, this is something the library user should be aware of in case they
Expand Down Expand Up @@ -127,7 +135,7 @@ unless `HDF5_VERSION` is set.

### Windows

`hdf5-rs` fully supports MSVC toolchain, which allows using the
`hdf5` crate fully supports MSVC toolchain, which allows using the
[official releases](https://www.hdfgroup.org/downloads/index.html) of
HDF5 and is generally the recommended way to go. That being said, previous experiments have
shown that all tests pass on the `gnu` target as well, one just needs to be careful with
Expand All @@ -149,6 +157,6 @@ Few things to note when building on Windows:

## License

`hdf5-rs` is primarily distributed under the terms of both the MIT license and the
`hdf5` crate is primarily distributed under the terms of both the MIT license and the
Apache License (Version 2.0). See [LICENSE-APACHE](LICENSE-APACHE) and
[LICENSE-MIT](LICENSE-MIT) for details.
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
fn main() {
libhdf5_sys::emit_cfg_flags();
hdf5_sys::emit_cfg_flags();
}
4 changes: 2 additions & 2 deletions hdf5-derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hdf5-derive"
version = "0.2.0"
version = "0.5.0"
authors = ["Ivan Smirnov <[email protected]>"]
edition = "2018"

Expand All @@ -11,7 +11,7 @@ proc-macro = true
proc-macro2 = "0.4"
quote = "0.6"
syn = { version = "0.15", features = ["derive", "extra-traits"]}
hdf5-types = { path = "../hdf5-types", version = "0.2.0" }
hdf5-types = { path = "../hdf5-types", version = "0.5.0" }

[dev-dependencies]
compiletest_rs = { version = "0.3.18", features = ["stable"] }
8 changes: 4 additions & 4 deletions libhdf5-sys/Cargo.toml → hdf5-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "libhdf5-sys"
version = "0.2.0"
name = "hdf5-sys"
version = "0.5.0"
authors = ["Ivan Smirnov <[email protected]>"]
keywords = ["hdf5"]
license = "MIT/Apache-2.0"
build = "build.rs"
repository = "https://github.com/aldanor/hdf5-rs"
homepage = "https://github.com/aldanor/hdf5-rs"
repository = "https://github.com/aldanor/hdf5-rust"
homepage = "https://github.com/aldanor/hdf5-rust"
description = "Native bindings to the HDF5 library."
edition = "2018"

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion hdf5-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hdf5-types"
version = "0.2.0"
version = "0.5.0"
authors = ["Ivan Smirnov <[email protected]>"]
edition = "2018"

Expand Down
4 changes: 2 additions & 2 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use num_integer::Integer;
use num_traits::{Bounded, Zero};
use parking_lot::Mutex;

use libhdf5_sys::h5e::{
use hdf5_sys::h5e::{
H5E_error2_t, H5Eclose_stack, H5Eget_current_stack, H5Eget_msg, H5Eprint2, H5Eset_auto2,
H5Ewalk2, H5E_DEFAULT, H5E_WALK_DOWNWARD,
};
Expand Down Expand Up @@ -304,7 +304,7 @@ where

#[cfg(test)]
pub mod tests {
use libhdf5_sys::h5p::{H5Pclose, H5Pcreate};
use hdf5_sys::h5p::{H5Pclose, H5Pcreate};

use crate::globals::H5P_ROOT;
use crate::internal_prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion src/filters.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::globals::H5P_DATASET_CREATE;
use crate::internal_prelude::*;

use libhdf5_sys::{
use hdf5_sys::{
h5p::{
H5Pcreate, H5Pget_filter2, H5Pget_nfilters, H5Pset_deflate, H5Pset_fletcher32,
H5Pset_scaleoffset, H5Pset_shuffle, H5Pset_szip,
Expand Down
20 changes: 10 additions & 10 deletions src/globals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ use std::mem;
use lazy_static::lazy_static;

#[cfg(h5_have_direct)]
use libhdf5_sys::h5fd::H5FD_direct_init;
use hdf5_sys::h5fd::H5FD_direct_init;
#[cfg(h5_have_parallel)]
use libhdf5_sys::h5fd::H5FD_mpio_init;
use libhdf5_sys::h5fd::{
use hdf5_sys::h5fd::H5FD_mpio_init;
use hdf5_sys::h5fd::{
H5FD_core_init, H5FD_family_init, H5FD_log_init, H5FD_multi_init, H5FD_sec2_init,
H5FD_stdio_init,
};
Expand All @@ -19,9 +19,9 @@ use crate::internal_prelude::*;
macro_rules! link_hid {
($rust_name:ident, $mod_name:ident::$c_name:ident) => {
lazy_static! {
pub static ref $rust_name: ::libhdf5_sys::h5i::hid_t = {
h5lock!(::libhdf5_sys::h5::H5open());
*::libhdf5_sys::$mod_name::$c_name
pub static ref $rust_name: ::hdf5_sys::h5i::hid_t = {
h5lock!(::hdf5_sys::h5::H5open());
*::hdf5_sys::$mod_name::$c_name
};
}
};
Expand All @@ -32,9 +32,9 @@ macro_rules! link_hid {
macro_rules! link_hid {
($rust_name:ident, $mod_name:ident::$c_name:ident) => {
lazy_static! {
pub static ref $rust_name: ::libhdf5_sys::h5i::hid_t = {
h5lock!(::libhdf5_sys::h5::H5open());
unsafe { *(*::libhdf5_sys::$mod_name::$c_name as *const _) }
pub static ref $rust_name: ::hdf5_sys::h5i::hid_t = {
h5lock!(::hdf5_sys::h5::H5open());
unsafe { *(*::hdf5_sys::$mod_name::$c_name as *const _) }
};
}
};
Expand Down Expand Up @@ -359,7 +359,7 @@ lazy_static! {
mod tests {
use std::mem;

use libhdf5_sys::{h5::haddr_t, h5i::H5I_INVALID_HID};
use hdf5_sys::{h5::haddr_t, h5i::H5I_INVALID_HID};

use super::{
H5E_DATASET, H5E_ERR_CLS, H5P_LST_LINK_ACCESS_ID, H5P_ROOT, H5R_DSET_REG_REF_BUF_SIZE,
Expand Down
2 changes: 1 addition & 1 deletion src/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::sync::Arc;
use lazy_static::lazy_static;
use parking_lot::{Mutex, RwLock};

use libhdf5_sys::h5i::{H5I_type_t, H5Idec_ref, H5Iget_type, H5Iinc_ref, H5Iis_valid};
use hdf5_sys::h5i::{H5I_type_t, H5Idec_ref, H5Iget_type, H5Iinc_ref, H5Iis_valid};

use crate::internal_prelude::*;

Expand Down
4 changes: 2 additions & 2 deletions src/hl/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use std::ops::Deref;
use ndarray::{Array, Array1, Array2, ArrayD, ArrayView, ArrayView1};
use ndarray::{SliceInfo, SliceOrIndex};

use libhdf5_sys::h5a::{H5Aget_space, H5Aget_storage_size, H5Aget_type, H5Aread, H5Awrite};
use libhdf5_sys::h5d::{H5Dget_space, H5Dget_storage_size, H5Dget_type, H5Dread, H5Dwrite};
use hdf5_sys::h5a::{H5Aget_space, H5Aget_storage_size, H5Aget_type, H5Aread, H5Awrite};
use hdf5_sys::h5d::{H5Dget_space, H5Dget_storage_size, H5Dget_type, H5Dread, H5Dwrite};

use crate::internal_prelude::*;

Expand Down
Loading