diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3abebdba..61b5df2a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,11 +45,17 @@ jobs: - name: Install maturin run: uv tool install maturin - - name: Check Rust formatting + - name: Check Rust formatting (qubed workspace) run: cargo fmt -- --check - - name: Run Rust tests - run: cargo test -p qubed qubed_meteo + - name: Check Rust formatting (qubed_meteo workspace) + run: cargo fmt --manifest-path qubed_meteo/qubed_meteo/Cargo.toml -- --check + + - name: Run Rust tests (qubed workspace) + run: cargo test -p qubed + + - name: Run Rust tests (qubed_meteo workspace) + run: cargo test --manifest-path qubed_meteo/qubed_meteo/Cargo.toml # Build the two Python extension packages that wrap the Rust crates. - name: Build qubed wheel @@ -59,19 +65,21 @@ jobs: working-directory: qubed_meteo run: | uv tool run maturin build \ - -m ../py_qubed_meteo/Cargo.toml + -m py_qubed_meteo/Cargo.toml # Install built wheels into an isolated uv-managed venv and run pytest. - name: Run Python binding tests run: | uv venv .ci-venv - uv pip install --python .ci-venv pytest target/wheels/qubed-*.whl + uv pip install --python .ci-venv pytest target/wheels/qubed-*.whl .ci-venv/bin/python -m pytest -q py_qubed/tests - uv pip install --python .ci-venv pytest py_qubed_meteo/target/wheels/qubed_meteo-*.whl - .ci-venv/bin/python -m pytest -q py_qubed_meteo/tests + uv pip install --python .ci-venv qubed_meteo/target/wheels/qubed_meteo-*.whl + .ci-venv/bin/python -m pytest -q qubed_meteo/py_qubed_meteo/tests - name: Upload wheel artifacts uses: actions/upload-artifact@v4 with: name: wheels-linux - path: target/wheels/*.whl + path: | + target/wheels/*.whl + qubed_meteo/target/wheels/*.whl diff --git a/.github/workflows/publish-crates.yml b/.github/workflows/publish-crates.yml index 69adb02e..a0d98e68 100644 --- a/.github/workflows/publish-crates.yml +++ b/.github/workflows/publish-crates.yml @@ -27,4 +27,4 @@ jobs: - name: Publish qubed_meteo env: CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} - run: cargo publish --manifest-path qubed_meteo/Cargo.toml \ No newline at end of file + run: cargo publish --manifest-path qubed_meteo/qubed_meteo/Cargo.toml \ No newline at end of file diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 60571dc3..80d62514 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -19,6 +19,11 @@ jobs: matrix: target: [x86_64, aarch64] package: [py_qubed, py_qubed_meteo] + include: + - package: py_qubed + manifest_path: py_qubed/Cargo.toml + - package: py_qubed_meteo + manifest_path: qubed_meteo/py_qubed_meteo/Cargo.toml steps: - uses: actions/checkout@v4 @@ -33,7 +38,7 @@ jobs: manylinux: auto args: > --release - --manifest-path ${{ matrix.package }}/Cargo.toml + --manifest-path ${{ matrix.manifest_path }} --out dist - name: Upload wheels diff --git a/Cargo.toml b/Cargo.toml index 16d8a413..29323e56 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,5 +8,4 @@ members = [ exclude = [ "qubed_meteo", - "py_qubed_meteo", ] \ No newline at end of file diff --git a/py_qubed/Cargo.toml b/py_qubed/Cargo.toml index 2a52d477..dcc8c982 100644 --- a/py_qubed/Cargo.toml +++ b/py_qubed/Cargo.toml @@ -13,5 +13,3 @@ name = "qubed" path = "src/lib.rs" crate-type = ["cdylib"] -[tool.maturin] -module-name = "qubed" diff --git a/pyproject.toml b/pyproject.toml index b6e7dd76..3c33841a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,6 @@ dependencies = [] [tool.uv.workspace] members = [ "py_qubed", - "py_qubed_meteo", ] # optional shared dev deps diff --git a/qubed_meteo/Cargo.toml b/qubed_meteo/Cargo.toml index a34d6849..a9b44819 100644 --- a/qubed_meteo/Cargo.toml +++ b/qubed_meteo/Cargo.toml @@ -1,30 +1,7 @@ -[package] -name = "qubed_meteo" -version = "0.1.1" -edition = "2024" -description = "Meteorological adapters to the Qubed library." -license = "Apache-2.0" -readme = "../README.md" -repository = "https://github.com/ecmwf/qubed" -homepage = "https://github.com/ecmwf/qubed" -documentation = "https://ecmwf.github.io/qubed/" - [workspace] +resolver = "3" + members = [ - "../py_qubed_meteo", + "qubed_meteo", + "py_qubed_meteo", ] - -[dependencies] -qubed = { path = "../qubed" } -serde = "1.0.228" -serde_json = "1.0.145" -rsfdb = { git = "https://github.com/ecmwf/rsfdb" , optional = true} - -[features] -default = [] -rsfdb-support = ["dep:rsfdb"] - -[lib] -path = "src/lib.rs" -crate-type = ["rlib"] - diff --git a/py_qubed_meteo/Cargo.toml b/qubed_meteo/py_qubed_meteo/Cargo.toml similarity index 89% rename from py_qubed_meteo/Cargo.toml rename to qubed_meteo/py_qubed_meteo/Cargo.toml index 9a50b0e1..e1a92200 100644 --- a/py_qubed_meteo/Cargo.toml +++ b/qubed_meteo/py_qubed_meteo/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.1" edition = "2024" [dependencies] -qubed = { path = "../qubed" } +qubed = { path = "../../qubed" } qubed_meteo = { path = "../qubed_meteo" } serde_json = "1.0.145" pyo3 = { version = "0.28", features = ["extension-module", "abi3-py38"] } diff --git a/py_qubed_meteo/pyproject.toml b/qubed_meteo/py_qubed_meteo/pyproject.toml similarity index 88% rename from py_qubed_meteo/pyproject.toml rename to qubed_meteo/py_qubed_meteo/pyproject.toml index b30e5322..6a816681 100644 --- a/py_qubed_meteo/pyproject.toml +++ b/qubed_meteo/py_qubed_meteo/pyproject.toml @@ -13,10 +13,6 @@ classifiers = [ "Programming Language :: Python :: Implementation :: CPython", ] -[features] -default = [] -rsfdb-support = ["dep:rsfdb"] - [tool.maturin] manifest-path = "Cargo.toml" features = [] diff --git a/py_qubed_meteo/src/lib.rs b/qubed_meteo/py_qubed_meteo/src/lib.rs similarity index 100% rename from py_qubed_meteo/src/lib.rs rename to qubed_meteo/py_qubed_meteo/src/lib.rs diff --git a/py_qubed_meteo/tests/test_api.py b/qubed_meteo/py_qubed_meteo/tests/test_api.py similarity index 100% rename from py_qubed_meteo/tests/test_api.py rename to qubed_meteo/py_qubed_meteo/tests/test_api.py diff --git a/py_qubed_meteo/tests/test_qubed_meteo_api.py b/qubed_meteo/py_qubed_meteo/tests/test_qubed_meteo_api.py similarity index 100% rename from py_qubed_meteo/tests/test_qubed_meteo_api.py rename to qubed_meteo/py_qubed_meteo/tests/test_qubed_meteo_api.py diff --git a/qubed_meteo/pyproject.toml b/qubed_meteo/pyproject.toml new file mode 100644 index 00000000..cabe730b --- /dev/null +++ b/qubed_meteo/pyproject.toml @@ -0,0 +1,10 @@ +[tool.uv.workspace] +members = [ + "py_qubed_meteo", +] + +[dependency-groups] +dev = [ + "pytest", + "maturin", +] diff --git a/qubed_meteo/qubed_meteo/Cargo.toml b/qubed_meteo/qubed_meteo/Cargo.toml new file mode 100644 index 00000000..3513bb02 --- /dev/null +++ b/qubed_meteo/qubed_meteo/Cargo.toml @@ -0,0 +1,33 @@ +[package] +name = "qubed_meteo" +version = "0.1.1" +edition = "2024" +description = "Meteorological adapters to the Qubed library." +license = "Apache-2.0" +repository = "https://github.com/ecmwf/qubed" +homepage = "https://github.com/ecmwf/qubed" +documentation = "https://ecmwf.github.io/qubed/" + +[dependencies] +qubed = { path = "../../qubed", version = "0.1.1" } +serde = "1.0.228" +serde_json = "1.0.145" + +[features] +default = [] +# Enable FDB (Fields DataBase) support via rsfdb. +# When enabling this feature you must also add rsfdb to your own workspace +# dependencies, e.g.: +# rsfdb = { git = "https://github.com/ecmwf/rsfdb" } +# rsfdb is intentionally not declared here so Cargo does not attempt to +# fetch the private git repository during normal CI builds. +rsfdb-support = [] + +[lib] +path = "src/lib.rs" +crate-type = ["rlib"] + +[[example]] +name = "read_from_fdb_list" +required-features = ["rsfdb-support"] + diff --git a/qubed_meteo/bin/fdb_db_reader.rs b/qubed_meteo/qubed_meteo/bin/fdb_db_reader.rs similarity index 100% rename from qubed_meteo/bin/fdb_db_reader.rs rename to qubed_meteo/qubed_meteo/bin/fdb_db_reader.rs diff --git a/qubed_meteo/examples/read_from_dss_constraints.rs b/qubed_meteo/qubed_meteo/examples/read_from_dss_constraints.rs similarity index 100% rename from qubed_meteo/examples/read_from_dss_constraints.rs rename to qubed_meteo/qubed_meteo/examples/read_from_dss_constraints.rs diff --git a/qubed_meteo/examples/read_from_fdb_list.rs b/qubed_meteo/qubed_meteo/examples/read_from_fdb_list.rs similarity index 100% rename from qubed_meteo/examples/read_from_fdb_list.rs rename to qubed_meteo/qubed_meteo/examples/read_from_fdb_list.rs diff --git a/qubed_meteo/examples/read_from_mars_list.rs b/qubed_meteo/qubed_meteo/examples/read_from_mars_list.rs similarity index 100% rename from qubed_meteo/examples/read_from_mars_list.rs rename to qubed_meteo/qubed_meteo/examples/read_from_mars_list.rs diff --git a/qubed_meteo/src/adapters/dss_constraints.rs b/qubed_meteo/qubed_meteo/src/adapters/dss_constraints.rs similarity index 100% rename from qubed_meteo/src/adapters/dss_constraints.rs rename to qubed_meteo/qubed_meteo/src/adapters/dss_constraints.rs diff --git a/qubed_meteo/src/adapters/fdb.rs b/qubed_meteo/qubed_meteo/src/adapters/fdb.rs similarity index 100% rename from qubed_meteo/src/adapters/fdb.rs rename to qubed_meteo/qubed_meteo/src/adapters/fdb.rs diff --git a/qubed_meteo/src/adapters/mars_list.rs b/qubed_meteo/qubed_meteo/src/adapters/mars_list.rs similarity index 100% rename from qubed_meteo/src/adapters/mars_list.rs rename to qubed_meteo/qubed_meteo/src/adapters/mars_list.rs diff --git a/qubed_meteo/src/adapters/mod.rs b/qubed_meteo/qubed_meteo/src/adapters/mod.rs similarity index 70% rename from qubed_meteo/src/adapters/mod.rs rename to qubed_meteo/qubed_meteo/src/adapters/mod.rs index 1038e331..b860c0bc 100644 --- a/qubed_meteo/src/adapters/mod.rs +++ b/qubed_meteo/qubed_meteo/src/adapters/mod.rs @@ -1,4 +1,5 @@ pub mod dss_constraints; +#[cfg(feature = "rsfdb-support")] pub mod fdb; pub mod mars_list; pub mod to_constraints; diff --git a/qubed_meteo/src/adapters/to_constraints.rs b/qubed_meteo/qubed_meteo/src/adapters/to_constraints.rs similarity index 100% rename from qubed_meteo/src/adapters/to_constraints.rs rename to qubed_meteo/qubed_meteo/src/adapters/to_constraints.rs diff --git a/qubed_meteo/src/lib.rs b/qubed_meteo/qubed_meteo/src/lib.rs similarity index 100% rename from qubed_meteo/src/lib.rs rename to qubed_meteo/qubed_meteo/src/lib.rs