Skip to content

Commit

Permalink
fix(cli): configure features for python
Browse files Browse the repository at this point in the history
  • Loading branch information
gadomski committed Sep 4, 2024
1 parent 55d5f6d commit 96ec314
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 24 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- "-p stac-async"
- "-p stac-cli --no-default-features"
- "-p stac-cli --no-default-features -F geoparquet"
- "-p stac-duckdb -F duckdb/bundled"
- "-p stac-duckdb -F bundled"
- "-p stac-server"
- "-p stac-server -F axum"
- "-p stac-validate"
Expand All @@ -50,7 +50,7 @@ jobs:
sudo apt-get update
sudo apt-get install libgdal-dev
- name: Test
run: cargo test -p stac -p stac-cli # gdal is default for stac-cli
run: cargo test -p stac -p stac-cli --all-features
test-ubuntu-with-pgstac:
runs-on: ubuntu-latest
services:
Expand Down Expand Up @@ -102,6 +102,22 @@ jobs:
run: ruff check python && ruff format --check python && mypy python
- name: Test
run: pytest python/tests
test-python-cli:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install dev requirements
run: pip install maturin
- name: Build
run: maturin build --manifest-path cli/Cargo.toml --out dist
- name: Install stacrs-cli
run: pip install stacrs-cli --find-links dist --no-index
- name: Smoke test
run: stacrs --version
check:
runs-on: ubuntu-latest
steps:
Expand Down
10 changes: 1 addition & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,4 @@ members = [
"server",
"validate",
]
default-members = [
"api",
"async",
"cli",
"core",
"python",
"server",
"validate",
]
default-members = ["api", "async", "cli", "core", "server", "validate"]
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ duckdb = ["dep:stac-duckdb"]
gdal = ["stac/gdal"]
geoparquet = ["dep:bytes", "stac/geoparquet-compression"]
pgstac = ["stac-server/pgstac"]
python = ["dep:pyo3"]
python = ["dep:pyo3", "pgstac", "duckdb", "stac-duckdb/bundled", "geoparquet"]

[dependencies]
axum = "0.7"
Expand Down
20 changes: 8 additions & 12 deletions cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,29 @@
![Crates.io](https://img.shields.io/crates/l/stac-cli?style=for-the-badge)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg?style=for-the-badge)](./CODE_OF_CONDUCT)

Command Line Interface (CLI), named `stacrs` for [STAC](https://stacspec.org/) built with [stac-rs](https://github.com/stac-utils/stac-rs).

![stac-cli gif](./img/stac-cli.gif)
Command Line Interface (CLI) for [STAC](https://stacspec.org/), named `stacrs`.

## Installation

Install rust, e.g. with [rustup](https://rustup.rs/).
Then:

```sh
cargo install stac-cli
```

You can also install it from PyPI, where it is named **stacrs**:
Or:

```shell
pip install stacrs
pip install stacrs-cli
```

### Homebrew

If you use [homebrew](https://brew.sh/), you can use [gadomski's](https://github.com/gadomski/) tap to install:
Then:

```shell
brew install gadomski/gadomski/stac
stacrs --help
```

**NOTE:** the version from PyPI (installed with `pip`) does not include GDAL support.
If you need to use [gdal](../core/README.md#gdal) features, install via `cargo install`.

## Usage

**stacrs** provides the following subcommands:
Expand Down
Binary file removed cli/img/stac-cli.gif
Binary file not shown.
1 change: 1 addition & 0 deletions cli/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ Issues = "https://github.com/stac-utils/stac-rs/issues"
stacrs = "stacrs_cli:main"

[tool.maturin]
no-default-features = true
features = ["pyo3/extension-module", "python"]
module-name = "stacrs_cli"
3 changes: 3 additions & 0 deletions duckdb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name = "stac-duckdb"
version = "0.1.0"
edition = "2021"

[features]
bundled = ["duckdb/bundled"]

[dependencies]
arrow = "52"
duckdb = "1"
Expand Down

0 comments on commit 96ec314

Please sign in to comment.