Skip to content

Commit

Permalink
Merge pull request #4 from metno/feature/naming-crates
Browse files Browse the repository at this point in the history
Rename hdf5* -> hdf5-metno*
  • Loading branch information
magnusuMET authored Aug 8, 2024
2 parents 8edce51 + de3e491 commit 64e1037
Show file tree
Hide file tree
Showing 38 changed files with 74 additions and 69 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Install HDF5
run: sudo apt-get update && sudo apt-get install libhdf5-dev
- name: Run cargo ${{matrix.command}}
run: cargo ${{matrix.command}} ${{matrix.command == 'fmt' && '--all -- --check' || '--workspace --exclude hdf5-src -- -D warnings -D clippy::cargo -A clippy::multiple-crate-versions'}}
run: cargo ${{matrix.command}} ${{matrix.command == 'fmt' && '--all -- --check' || '--workspace --exclude hdf5-metno-src -- -D warnings -D clippy::cargo -A clippy::multiple-crate-versions'}}

doc: # This task should mirror the procedure on docs.rs
runs-on: ubuntu-latest
Expand Down Expand Up @@ -152,9 +152,9 @@ jobs:
uses: dtolnay/rust-toolchain@stable
with: {toolchain: '${{matrix.rust}}'}
- name: Build and test all crates
run: cargo test --workspace -vvv --features hdf5-sys/static,hdf5-sys/zlib --exclude hdf5-derive
run: cargo test --workspace -vvv --features hdf5-sys/static,hdf5-sys/zlib --exclude hdf5-metno-derive
- name: Build and test with filters and other features
run: cargo test --workspace -v --features hdf5-sys/static,hdf5-sys/zlib,lzf,blosc,f16,complex --exclude hdf5-derive
run: cargo test --workspace -v --features hdf5-sys/static,hdf5-sys/zlib,lzf,blosc,f16,complex --exclude hdf5-metno-derive
if: matrix.rust != 'stable-gnu'
- name: Run examples
run: |
Expand Down Expand Up @@ -282,7 +282,7 @@ jobs:
with: {toolchain: "1.77"}
- name: Build and test all crates
run:
cargo test --workspace -vv --features=hdf5-sys/static,hdf5-sys/zlib --exclude=hdf5-derive
cargo test --workspace -vv --features=hdf5-sys/static,hdf5-sys/zlib --exclude=hdf5-metno-derive

# wine:
# name: wine
Expand All @@ -299,7 +299,7 @@ jobs:
# - name: Build and test
# env:
# CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUNNER: wine64
# run: cargo test --workspace --features hdf5-sys/static --target x86_64-pc-windows-gnu --exclude=hdf5-derive
# run: cargo test --workspace --features hdf5-sys/static --target x86_64-pc-windows-gnu --exclude=hdf5-metno-derive

addr_san:
name: Address sanitizer
Expand All @@ -314,4 +314,4 @@ jobs:
- name: Run test with sanitizer
env:
RUSTFLAGS: "-Z sanitizer=address"
run: cargo test --features hdf5-sys/static --target x86_64-unknown-linux-gnu --workspace --exclude hdf5-derive
run: cargo test --features hdf5-sys/static --target x86_64-unknown-linux-gnu --workspace --exclude hdf5-metno-derive
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ authors = [
]
keywords = ["hdf5"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/aldanor/hdf5-rust"
homepage = "https://github.com/aldanor/hdf5-rust"
repository = "https://github.com/metno/hdf5-rust"
homepage = "https://github.com/metno/hdf5-rust"
edition = "2021"

[workspace.dependencies]
Expand All @@ -26,8 +26,8 @@ mpi-sys = "0.2"
num-complex = { version = "0.4", default-features = false }
regex = "1.10"
# internal
hdf5 = { version = "0.8.1", path = "hdf5" } # !V
hdf5-derive = { version = "0.8.1", path = "hdf5-derive" } # !V
hdf5-src = { version = "0.8.1", path = "hdf5-src" } # !V
hdf5-sys = { version = "0.8.1", path = "hdf5-sys" } # !V
hdf5-types = { version = "0.8.1", path = "hdf5-types" } # !V
hdf5 = { package = "hdf5-metno", version = "0.8.1", path = "hdf5" } # !V
hdf5-derive = { package = "hdf5-metno-derive", version = "0.8.1", path = "hdf5-derive" } # !V
hdf5-src = { package = "hdf5-metno-src", version = "0.8.1", path = "hdf5-src" } # !V
hdf5-sys = { package = "hdf5-metno-sys", version = "0.8.1", path = "hdf5-sys" } # !V
hdf5-types = { package = "hdf5-metno-types", version = "0.8.1", path = "hdf5-types" } # !V
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

HDF5 for Rust.

[![Build](https://github.com/aldanor/hdf5-rust/workflows/CI/badge.svg)](https://github.com/aldanor/hdf5-rust/actions?query=branch%3Amaster)
[![Latest Version](https://img.shields.io/crates/v/hdf5.svg)](https://crates.io/crates/hdf5)
[![Documentation](https://docs.rs/hdf5/badge.svg)](https://docs.rs/hdf5)
[![Changelog](https://img.shields.io/github/v/release/aldanor/hdf5-rust)](https://github.com/aldanor/hdf5-rust/blob/master/CHANGELOG.md)
[![Build](https://github.com/metno/hdf5-rust/workflows/CI/badge.svg)](https://github.com/metno/hdf5-rust/actions?query=branch%3Amain)
[![Latest Version](https://img.shields.io/crates/v/hdf5-metno.svg)](https://crates.io/crates/hdf5-metno)
[![Documentation](https://docs.rs/hdf5-metno/badge.svg)](https://docs.rs/hdf5-metno)
[![Changelog](https://img.shields.io/github/v/release/metno/hdf5-rust)](https://github.com/metno/hdf5-rust/blob/master/CHANGELOG.md)
![hdf5: rustc 1.77+](https://img.shields.io/badge/hdf5-rustc_1.77+-lightblue.svg)
[![Total Lines](https://tokei.rs/b1/github/aldanor/hdf5-rust)](https://github.com/aldanor/hdf5-rust)
[![Total Lines](https://tokei.rs/b1/github/metno/hdf5-rust)](https://github.com/metno/hdf5-rust)
[![Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)

The `hdf5` crate (previously known as `hdf5-rs`) provides thread-safe Rust bindings and
The `hdf5-metno` crate (also known under the pre-fork name of `hdf5`) 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.
Expand All @@ -23,6 +23,12 @@ Direct low-level bindings are also available and are provided in the `hdf5-sys`

Requires HDF5 library of version 1.8.4 or later.

## Fork
This is a fork of https://github.com/aldanor/hdf5-rust used for publishing newer versions of the crate. This includes a change in the crate name to allow publishing on crates.io. For backwards compatibility consider using the following in your `Cargo.toml`:
```yaml
hdf5 = { package = "hdf5-metno", version = "0.8.1" }
```

## Example

```rust
Expand Down
4 changes: 2 additions & 2 deletions hdf5-derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "hdf5-derive"
name = "hdf5-metno-derive"
description = "Derive macro for HDF5 structs and enums."
categories = ["procedural-macro-helpers"]
readme = "README.md"
Expand All @@ -23,4 +23,4 @@ syn = { version = "2.0", features = ["derive", "extra-traits"]}

[dev-dependencies]
trybuild = "1.0"
hdf5.workspace = true
hdf5-metno = { path = "../hdf5" }
2 changes: 1 addition & 1 deletion hdf5-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub fn derive(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
let expanded = quote! {
#[allow(dead_code, unused_variables, unused_attributes)]
const #dummy: () = {
extern crate hdf5 as _h5;
use ::hdf5_metno as _h5;

#[automatically_derived]
unsafe impl #impl_generics _h5::types::H5Type for #name #ty_generics #where_clause {
Expand Down
3 changes: 1 addition & 2 deletions hdf5-derive/tests/compile-fail/empty-enum.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
extern crate hdf5_derive;
use hdf5_derive::H5Type;
use hdf5_metno_derive::H5Type;

#[derive(H5Type)]
//~^ ERROR proc-macro derive
Expand Down
4 changes: 2 additions & 2 deletions hdf5-derive/tests/compile-fail/empty-enum.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: cannot derive `H5Type` for empty enums
--> $DIR/empty-enum.rs:7:6
--> tests/compile-fail/empty-enum.rs:6:6
|
7 | enum Foo {}
6 | enum Foo {}
| ^^^
3 changes: 1 addition & 2 deletions hdf5-derive/tests/compile-fail/empty-struct.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
extern crate hdf5_derive;
use hdf5_derive::H5Type;
use hdf5_metno_derive::H5Type;

#[derive(H5Type)]
//~^ ERROR proc-macro derive
Expand Down
4 changes: 2 additions & 2 deletions hdf5-derive/tests/compile-fail/empty-struct.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: cannot derive `H5Type` for empty structs
--> $DIR/empty-struct.rs:7:8
--> tests/compile-fail/empty-struct.rs:6:8
|
7 | struct Foo {}
6 | struct Foo {}
| ^^^
3 changes: 1 addition & 2 deletions hdf5-derive/tests/compile-fail/empty-tuple-struct.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
extern crate hdf5_derive;
use hdf5_derive::H5Type;
use hdf5_metno_derive::H5Type;

#[derive(H5Type)]
//~^ ERROR proc-macro derive
Expand Down
4 changes: 2 additions & 2 deletions hdf5-derive/tests/compile-fail/empty-tuple-struct.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: cannot derive `H5Type` for empty tuple structs
--> $DIR/empty-tuple-struct.rs:7:8
--> tests/compile-fail/empty-tuple-struct.rs:6:8
|
7 | struct Foo();
6 | struct Foo();
| ^^^
3 changes: 1 addition & 2 deletions hdf5-derive/tests/compile-fail/enum-no-repr.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
extern crate hdf5_derive;
use hdf5_derive::H5Type;
use hdf5_metno_derive::H5Type;

#[derive(H5Type)]
//~^ ERROR proc-macro derive
Expand Down
4 changes: 2 additions & 2 deletions hdf5-derive/tests/compile-fail/enum-no-repr.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: `H5Type` can only be derived for enums with explicit representation
--> $DIR/enum-no-repr.rs:7:6
--> tests/compile-fail/enum-no-repr.rs:6:6
|
7 | enum Foo {
6 | enum Foo {
| ^^^
3 changes: 1 addition & 2 deletions hdf5-derive/tests/compile-fail/enum-non-scalar.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
extern crate hdf5_derive;
use hdf5_derive::H5Type;
use hdf5_metno_derive::H5Type;

#[derive(H5Type)]
//~^ ERROR proc-macro derive
Expand Down
4 changes: 2 additions & 2 deletions hdf5-derive/tests/compile-fail/enum-non-scalar.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: `H5Type` can only be derived for enums with scalar discriminants
--> $DIR/enum-non-scalar.rs:7:6
--> tests/compile-fail/enum-non-scalar.rs:6:6
|
7 | enum Foo {
6 | enum Foo {
| ^^^
3 changes: 1 addition & 2 deletions hdf5-derive/tests/compile-fail/pd-empty-struct.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
extern crate hdf5_derive;
use hdf5_derive::H5Type;
use hdf5_metno_derive::H5Type;

use std::marker::PhantomData;

Expand Down
4 changes: 2 additions & 2 deletions hdf5-derive/tests/compile-fail/pd-empty-struct.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: cannot derive `H5Type` for empty structs
--> $DIR/pd-empty-struct.rs:9:8
--> tests/compile-fail/pd-empty-struct.rs:8:8
|
9 | struct Foo<T> {
8 | struct Foo<T> {
| ^^^
3 changes: 1 addition & 2 deletions hdf5-derive/tests/compile-fail/pd-empty-tuple-struct.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
extern crate hdf5_derive;
use hdf5_derive::H5Type;
use hdf5_metno_derive::H5Type;

use std::marker::PhantomData;

Expand Down
4 changes: 2 additions & 2 deletions hdf5-derive/tests/compile-fail/pd-empty-tuple-struct.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: cannot derive `H5Type` for empty tuple structs
--> $DIR/pd-empty-tuple-struct.rs:9:8
--> tests/compile-fail/pd-empty-tuple-struct.rs:8:8
|
9 | struct Foo<T>(PhantomData<T>);
8 | struct Foo<T>(PhantomData<T>);
| ^^^
3 changes: 1 addition & 2 deletions hdf5-derive/tests/compile-fail/struct-no-repr.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
extern crate hdf5_derive;
use hdf5_derive::H5Type;
use hdf5_metno_derive::H5Type;

#[derive(H5Type)]
//~^ ERROR proc-macro derive
Expand Down
4 changes: 2 additions & 2 deletions hdf5-derive/tests/compile-fail/struct-no-repr.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: `H5Type` requires repr(C), repr(packed) or repr(transparent) for structs
--> $DIR/struct-no-repr.rs:7:8
--> tests/compile-fail/struct-no-repr.rs:6:8
|
7 | struct Foo {
6 | struct Foo {
| ^^^
3 changes: 1 addition & 2 deletions hdf5-derive/tests/compile-fail/tuple-struct-no-repr.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
extern crate hdf5_derive;
use hdf5_derive::H5Type;
use hdf5_metno_derive::H5Type;

#[derive(H5Type)]
//~^ ERROR proc-macro derive
Expand Down
4 changes: 2 additions & 2 deletions hdf5-derive/tests/compile-fail/tuple-struct-no-repr.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: `H5Type` requires repr(C), repr(packed) or repr(transparent) for tuple structs
--> $DIR/tuple-struct-no-repr.rs:7:8
--> tests/compile-fail/tuple-struct-no-repr.rs:6:8
|
7 | struct Foo(i64);
6 | struct Foo(i64);
| ^^^
3 changes: 1 addition & 2 deletions hdf5-derive/tests/compile-fail/unit-struct.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
extern crate hdf5_derive;
use hdf5_derive::H5Type;
use hdf5_metno_derive::H5Type;

#[derive(H5Type)]
//~^ ERROR proc-macro derive
Expand Down
4 changes: 2 additions & 2 deletions hdf5-derive/tests/compile-fail/unit-struct.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: cannot derive `H5Type` for unit structs
--> $DIR/unit-struct.rs:7:8
--> tests/compile-fail/unit-struct.rs:6:8
|
7 | struct Foo;
6 | struct Foo;
| ^^^
5 changes: 2 additions & 3 deletions hdf5-derive/tests/test.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#[macro_use]
extern crate hdf5_derive;

use std::marker::PhantomData;
use std::mem;

use hdf5::types::TypeDescriptor as TD;
use hdf5::types::*;
use hdf5_metno as hdf5;
use hdf5_metno_derive::H5Type;

#[derive(H5Type)]
#[repr(C)]
Expand Down
2 changes: 1 addition & 1 deletion hdf5-src/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "hdf5-src"
name = "hdf5-metno-src"
license-file = "ext/hdf5/COPYING"
build = "build.rs"
description = "Build script for compiling HDF5 C library from source."
Expand Down
2 changes: 1 addition & 1 deletion hdf5-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "hdf5-sys"
name = "hdf5-metno-sys"
build = "build.rs"
description = "Native bindings to the HDF5 library."
links = "hdf5"
Expand Down
2 changes: 1 addition & 1 deletion hdf5-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "hdf5-types"
name = "hdf5-metno-types"
description = "Native Rust equivalents of HDF5 types."
readme = "README.md"
build = "build.rs"
Expand Down
2 changes: 1 addition & 1 deletion hdf5/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "hdf5"
name = "hdf5-metno"
readme = "../README.md"
description = "Thread-safe Rust bindings for the HDF5 library."
build = "build.rs"
Expand Down
1 change: 1 addition & 0 deletions hdf5/examples/chunking.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Create, write, and read a chunked dataset

use hdf5::{File, Result};
use hdf5_metno as hdf5;
use ndarray::Array2;

fn main() -> Result<()> {
Expand Down
1 change: 1 addition & 0 deletions hdf5/examples/simple.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#[cfg(feature = "blosc")]
use hdf5::filters::blosc_set_nthreads;
use hdf5::{File, H5Type, Result};
use hdf5_metno as hdf5;
use ndarray::{arr2, s};

#[derive(H5Type, Clone, PartialEq, Debug)] // register with HDF5
Expand Down
1 change: 1 addition & 0 deletions hdf5/tests/common/gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::iter;

use hdf5::types::{FixedAscii, FixedUnicode, VarLenArray, VarLenAscii, VarLenUnicode};
use hdf5::H5Type;
use hdf5_metno as hdf5;

use half::f16;
use ndarray::{ArrayD, SliceInfo, SliceInfoElem};
Expand Down
2 changes: 2 additions & 0 deletions hdf5/tests/common/util.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use super::gen::gen_ascii;

use hdf5_metno as hdf5;

pub fn random_filename() -> String {
gen_ascii(&mut rand::thread_rng(), 8)
}
Expand Down
1 change: 1 addition & 0 deletions hdf5/tests/test_dataset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::io::{Read, Seek, SeekFrom};
use ndarray::{s, Array1, Array2, ArrayD, IxDyn, SliceInfo};
use rand::prelude::{Rng, SeedableRng, SmallRng};

use hdf5_metno as hdf5;
use hdf5_types::TypeDescriptor;

mod common;
Expand Down
1 change: 1 addition & 0 deletions hdf5/tests/test_datatypes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ mod common;

use hdf5::types::{TypeDescriptor as TD, *};
use hdf5::{from_id, Datatype, H5Type};
use hdf5_metno as hdf5;

use hdf5_sys::h5i::H5I_INVALID_HID;

Expand Down
1 change: 1 addition & 0 deletions hdf5/tests/test_plist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::str::FromStr;
use hdf5::dataset::*;
use hdf5::file::*;
use hdf5::plist::*;
use hdf5_metno as hdf5;

macro_rules! test_pl {
($ty:ident, $field:ident ($($arg:expr),+): $($name:ident=$value:expr),+) => (
Expand Down
2 changes: 2 additions & 0 deletions hdf5/tests/tests.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use hdf5_metno as hdf5;

#[test]
fn roundtrip_compound_type() {
use hdf5::H5Type;
Expand Down

0 comments on commit 64e1037

Please sign in to comment.