diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d5d20d3..4e6b15e7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,12 +58,14 @@ jobs: run: | wget https://github.com/duckdb/duckdb/releases/download/v1.1.3/libduckdb-linux-amd64.zip unzip libduckdb-linux-amd64.zip -d /opt/duckdb - - name: Lint - run: scripts/lint + - name: Format + run: cargo fmt --check + - name: Clippy + run: cargo clippy --workspace --no-default-features -- -D warnings - name: Build # need to build first to get the executable for CLI tests - run: cargo build --all-features + run: cargo build --no-default-features - name: Test - run: cargo test --all-features + run: cargo test --no-default-features - name: Validate stac-server run: uv run --group stac-api-validator scripts/validate-stac-server - name: Validate stac-geoparquet diff --git a/.github/workflows/python-cli.yml b/.github/workflows/python-cli.yml deleted file mode 100644 index c4561ba2..00000000 --- a/.github/workflows/python-cli.yml +++ /dev/null @@ -1,180 +0,0 @@ -name: PyPI - -on: - push: - tags: - - "stac-cli-*" - workflow_dispatch: - -permissions: - contents: read - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - linux: - runs-on: ${{ matrix.platform.runner }} - strategy: - matrix: - platform: - - runner: ubuntu-22.04 - target: x86_64 - manylinux: auto - - runner: ubuntu-22.04 - target: x86 - manylinux: auto - - runner: ubuntu-22.04 - target: aarch64 - manylinux: "2_28" - - runner: ubuntu-22.04 - target: armv7 - manylinux: auto - - runner: ubuntu-22.04 - target: s390x - manylinux: auto - - runner: ubuntu-22.04 - target: ppc64le - manylinux: auto - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: 3.x - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - target: ${{ matrix.platform.target }} - args: --release --out dist --manifest-path crates/cli/Cargo.toml -F duckdb/bundled - sccache: "true" - manylinux: ${{ matrix.platform.manylinux }} - - name: Upload wheels - uses: actions/upload-artifact@v4 - with: - name: wheels-linux-${{ matrix.platform.target }} - path: dist - - musllinux: - runs-on: ${{ matrix.platform.runner }} - strategy: - matrix: - platform: - - runner: ubuntu-22.04 - target: x86_64 - - runner: ubuntu-22.04 - target: x86 - - runner: ubuntu-22.04 - target: aarch64 - - runner: ubuntu-22.04 - target: armv7 - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: 3.x - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - target: ${{ matrix.platform.target }} - args: --release --out dist --manifest-path crates/cli/Cargo.toml -F duckdb/bundled - sccache: "true" - manylinux: musllinux_1_2 - - name: Upload wheels - uses: actions/upload-artifact@v4 - with: - name: wheels-musllinux-${{ matrix.platform.target }} - path: dist - - windows: - runs-on: ${{ matrix.platform.runner }} - strategy: - matrix: - platform: - - runner: windows-latest - target: x64 - - runner: windows-latest - target: x86 - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: 3.x - architecture: ${{ matrix.platform.target }} - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - target: ${{ matrix.platform.target }} - args: --release --out dist --manifest-path crates/cli/Cargo.toml -F duckdb/bundled - sccache: "true" - - name: Upload wheels - uses: actions/upload-artifact@v4 - with: - name: wheels-windows-${{ matrix.platform.target }} - path: dist - - macos: - runs-on: ${{ matrix.platform.runner }} - strategy: - matrix: - platform: - - runner: macos-13 - target: x86_64 - - runner: macos-14 - target: aarch64 - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: 3.x - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - target: ${{ matrix.platform.target }} - args: --release --out dist --manifest-path crates/cli/Cargo.toml -F duckdb/bundled - sccache: "true" - - name: Upload wheels - uses: actions/upload-artifact@v4 - with: - name: wheels-macos-${{ matrix.platform.target }} - path: dist - - sdist: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Build sdist - uses: PyO3/maturin-action@v1 - with: - command: sdist - args: --out dist --manifest-path crates/cli/Cargo.toml - - name: Upload sdist - uses: actions/upload-artifact@v4 - with: - name: wheels-sdist - path: dist - - release: - name: Release - runs-on: ubuntu-latest - if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} - needs: [linux, musllinux, windows, macos, sdist] - environment: - name: pypi - url: https://pypi.org/p/stacrs-cli - permissions: - id-token: write - contents: write - attestations: write - steps: - - uses: actions/download-artifact@v4 - - name: Generate artifact attestation - uses: actions/attest-build-provenance@v1 - with: - subject-path: "wheels-*/*" - - name: Publish to PyPI - if: ${{ startsWith(github.ref, 'refs/tags/') }} - uses: PyO3/maturin-action@v1 - with: - command: upload - args: --non-interactive --skip-existing wheels-*/* diff --git a/README.md b/README.md index 433ffae1..6b7e3f88 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Our command line interface (CLI) can query STAC APIs, validate STAC, and more. Install: ```shell -pip install stacrs-cli +pip install stacrs # or cargo install stac-cli ``` diff --git a/crates/cli/CHANGELOG.md b/crates/cli/CHANGELOG.md index 87cf77fb..1099bbd5 100644 --- a/crates/cli/CHANGELOG.md +++ b/crates/cli/CHANGELOG.md @@ -12,6 +12,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Always bundle DuckDB (again) ([#631](https://github.com/stac-utils/stac-rs/pull/631)) +### Removed + +- **stacrs-cli** (moved to ) ([#633](https://github.com/stac-utils/stac-rs/pull/633)) + ## [0.5.0] - 2025-01-31 ### Changed diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index e286d2f7..2c622510 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "stac-cli" description = "Command line interface for stac-rs" -version = "0.5.1-rc.3" +version = "0.5.1" keywords = ["geospatial", "stac", "metadata", "geo", "raster"] authors.workspace = true edition.workspace = true @@ -12,21 +12,17 @@ categories.workspace = true rust-version.workspace = true [features] -default = ["pgstac"] +default = ["duckdb-bundled", "pgstac"] pgstac = ["stac-server/pgstac", "dep:tokio-postgres"] -python = ["dep:pyo3", "pgstac"] +duckdb-bundled = ["duckdb/bundled"] [dependencies] anyhow.workspace = true axum.workspace = true clap = { workspace = true, features = ["derive"] } -duckdb = { workspace = true, features = ["bundled"] } +duckdb = { workspace = true } libduckdb-sys = { workspace = true } object_store.workspace = true -pyo3 = { workspace = true, optional = true, features = [ - "abi3-py39", - "extension-module", -] } reqwest.workspace = true serde.workspace = true serde_json.workspace = true diff --git a/crates/cli/README.md b/crates/cli/README.md index 6a63c68b..b7484445 100644 --- a/crates/cli/README.md +++ b/crates/cli/README.md @@ -10,12 +10,6 @@ Command Line Interface (CLI) for [STAC](https://stacspec.org/), named `stacrs`. ## Installation -```shell -python -m pip install stacrs-cli -``` - -Or: - ```sh cargo install stac-cli ``` @@ -64,7 +58,6 @@ Use the `--help` flag to see all available options for the CLI and the subcomman This crate has two features: - `pgstac`: enable a [pgstac](https://github.com/stac-utils/pgstac) backend for `stacrs serve` (enabled by default) -- `python`: create an entrypoint that can be called from Python (used to enable `python -m pip install stacrs-cli`) ## Other info diff --git a/crates/cli/pyproject.toml b/crates/cli/pyproject.toml deleted file mode 100644 index de119f8e..00000000 --- a/crates/cli/pyproject.toml +++ /dev/null @@ -1,35 +0,0 @@ -[build-system] -requires = ["maturin>=1.7,<2.0"] -build-backend = "maturin" - -[project] -name = "stacrs-cli" -description = "A STAC command-line interface written in Rust" -readme = "README.md" -authors = [{ name = "Pete Gadomski", email = "pete.gadomski@gmail.com" }] -requires-python = ">=3.10" -classifiers = [ - "Development Status :: 3 - Alpha", - "Intended Audience :: Science/Research", - "Natural Language :: English", - "Programming Language :: Rust", - "Programming Language :: Python :: Implementation :: CPython", - "Programming Language :: Python :: Implementation :: PyPy", - "License :: OSI Approved :: Apache Software License", - "License :: OSI Approved :: MIT License", -] -keywords = ["stac", "geospatial"] -dynamic = ["version"] -dependencies = [] - -[project.urls] -Repository = "https://github.com/stac-utils/stac-rs" -Issues = "https://github.com/stac-utils/stac-rs/issues" - -[project.scripts] -stacrs = "stacrs_cli:main" - -[tool.maturin] -no-default-features = true -features = ["python"] -module-name = "stacrs_cli" diff --git a/crates/cli/release.toml b/crates/cli/release.toml deleted file mode 100644 index a38fbea7..00000000 --- a/crates/cli/release.toml +++ /dev/null @@ -1 +0,0 @@ -enable-all-features = false diff --git a/crates/cli/src/lib.rs b/crates/cli/src/lib.rs index c5ba9b9e..5a587051 100644 --- a/crates/cli/src/lib.rs +++ b/crates/cli/src/lib.rs @@ -11,9 +11,6 @@ use std::{collections::HashMap, io::Write, str::FromStr}; use tokio::{io::AsyncReadExt, net::TcpListener, runtime::Handle}; use tracing::metadata::Level; -#[cfg(feature = "python")] -mod python; - /// stacrs: A command-line interface for the SpatioTemporal Asset Catalog (STAC) #[derive(Debug, Parser)] pub struct Stacrs { @@ -372,7 +369,7 @@ impl Stacrs { } #[cfg(not(feature = "pgstac"))] { - return Err(anyhow!("stacrs is not compiled with pgstac support")); + Err(anyhow!("stacrs is not compiled with pgstac support")) } } else { let backend = stac_server::MemoryBackend::new(); diff --git a/crates/cli/src/python.rs b/crates/cli/src/python.rs deleted file mode 100644 index 44fa8b23..00000000 --- a/crates/cli/src/python.rs +++ /dev/null @@ -1,42 +0,0 @@ -use crate::Stacrs; -use clap::Parser; -use pyo3::{ - prelude::{PyModule, PyModuleMethods}, - pyfunction, pymodule, - types::PyAnyMethods, - wrap_pyfunction, Bound, PyResult, Python, -}; - -#[pyfunction] -fn main(py: Python<'_>) -> PyResult { - let signal = py.import("signal")?; - let _ = signal - .getattr("signal")? - .call1((signal.getattr("SIGINT")?, signal.getattr("SIG_DFL")?))?; - let args = Stacrs::parse_from(std::env::args_os().skip(1)); - tracing_subscriber::fmt() - .with_max_level(args.log_level()) - .init(); - std::process::exit( - tokio::runtime::Builder::new_multi_thread() - .enable_all() - .build() - .unwrap() - .block_on(async { - // We skip one because the first argument is going to be the python interpreter. - match args.run().await { - Ok(()) => 0, - Err(err) => { - eprintln!("ERROR: {}", err); - 1 - } - } - }), - ) -} - -#[pymodule] -fn stacrs_cli(m: &Bound<'_, PyModule>) -> PyResult<()> { - m.add_function(wrap_pyfunction!(main, m)?)?; - Ok(()) -} diff --git a/docs/cli/index.md b/docs/cli/index.md index 9165fccd..bca48df8 100644 --- a/docs/cli/index.md +++ b/docs/cli/index.md @@ -14,7 +14,7 @@ cargo install stac-cli If you have Python, use `pip`: ```shell -python -m pip install stacrs-cli +python -m pip install stacrs ``` The CLI is called **stacrs**: