Skip to content

Commit

Permalink
feat: more work on the python library
Browse files Browse the repository at this point in the history
  • Loading branch information
gadomski committed Aug 28, 2024
1 parent bb2c587 commit a3878fc
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 51 deletions.
93 changes: 47 additions & 46 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ jobs:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: x86
- runner: ubuntu-latest
target: aarch64
- runner: ubuntu-latest
target: armv7
- runner: ubuntu-latest
target: s390x
- runner: ubuntu-latest
target: ppc64le
# - runner: ubuntu-latest
# target: x86
# - runner: ubuntu-latest
# target: aarch64
# - runner: ubuntu-latest
# target: armv7
# - runner: ubuntu-latest
# target: s390x
# - runner: ubuntu-latest
# target: ppc64le
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand All @@ -40,48 +40,44 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter --manifest-path python/Cargo.toml -F openssl-vendored
args: --release --out dist --find-interpreter --manifest-path python/Cargo.toml
sccache: 'true'
manylinux: auto
before-script-linux: |
yum update -y
yum install openssl openssl-devel perl-IPC-Cmd -y
- 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-latest
target: x86_64
- runner: ubuntu-latest
target: x86
- runner: ubuntu-latest
target: aarch64
- runner: ubuntu-latest
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 --find-interpreter --manifest-path python/Cargo.toml -F openssl-vendored
sccache: 'true'
manylinux: musllinux_1_2
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-musllinux-${{ matrix.platform.target }}
path: dist
# musllinux:
# runs-on: ${{ matrix.platform.runner }}
# strategy:
# matrix:
# platform:
# - runner: ubuntu-latest
# target: x86_64
# - runner: ubuntu-latest
# target: x86
# - runner: ubuntu-latest
# target: aarch64
# - runner: ubuntu-latest
# 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 --find-interpreter --manifest-path python/Cargo.toml -F openssl-vendored
# 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 }}
Expand Down Expand Up @@ -154,7 +150,12 @@ jobs:
release:
name: Release
runs-on: ubuntu-latest
needs: [linux, musllinux, windows, macos, sdist]
needs:
- linux
# - musllinux
- windows
- macos
- sdist
if: startsWith(github.ref, 'refs/tags/python-')
permissions:
id-token: write
Expand Down
11 changes: 11 additions & 0 deletions python/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.0.1] - 2024-08-28

Initial release.

[0.0.1]: https://github.com/stac-utils/stac-rs/releases/tag/python-v0.0.1
5 changes: 0 additions & 5 deletions python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@ publish = false
name = "stacrs"
crate-type = ["cdylib"]

[features]
# Fixes cross-platform builds in the maturin action
openssl-vendored = ["openssl/vendored"]

[dependencies]
openssl = { version = "0.10", optional = true }
pyo3 = "0.22"
stac = { version = "0.8", path = "../stac", features = ["reqwest"] }
stac-validate = { version = "0.2", path = "../stac-validate" }
23 changes: 23 additions & 0 deletions python/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# stacrs

A Python package for working with [STAC](https://stacspec.org/), using Rust under the hood.

## Usage

Install via **pip**:

```shell
pip install stacrs
```

Then:

```python
import stacrs

stacrs.validate_href("https://raw.githubusercontent.com/radiantearth/stac-spec/v1.0.0/examples/simple-item.json")
```

## Other info

This crate is part of the [stac-rs](https://github.com/stac-utils/stac-rs) monorepo, see its README for contributing and license information.
14 changes: 14 additions & 0 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,27 @@ build-backend = "maturin"

[project]
name = "stacrs"
description = "Work with STAC, using Rust under the hood"
readme = "README.md"
authors = [{ name = "Pete Gadomski", email = "[email protected]" }]
requires-python = ">=3.8"
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",
"Typing :: Typed",
]
keywords = ["stac", "geospatial"]
dynamic = ["version"]

[project.urls]
Repository = "https://github.com/stac-utils/stac-rs/tree/main/python"
Issues = "https://github.com/stac-utils/stac-rs/issues"

[tool.maturin]
features = ["pyo3/extension-module"]

0 comments on commit a3878fc

Please sign in to comment.