From 0022ed4940cee98e81ffd6dfbfc0aafbef4baf0d Mon Sep 17 00:00:00 2001 From: Pete Gadomski Date: Mon, 11 Nov 2024 16:21:43 -0700 Subject: [PATCH 1/3] refactor: remove rust hydration It lives in https://github.com/gadomski/hydraters now --- src/pypgstac/Cargo.lock | 296 ------------------ src/pypgstac/Cargo.toml | 18 -- src/pypgstac/pyproject.toml | 33 +- src/pypgstac/src/lib.rs | 107 ------- .../{python => src}/pypgstac/__init__.py | 0 src/pypgstac/{python => src}/pypgstac/db.py | 0 .../{python => src}/pypgstac/hydration.py | 13 +- src/pypgstac/{python => src}/pypgstac/load.py | 0 .../{python => src}/pypgstac/migrate.py | 0 .../{python => src}/pypgstac/migrations | 0 .../{python => src}/pypgstac/py.typed | 0 .../{python => src}/pypgstac/pypgstac.py | 0 .../{python => src}/pypgstac/version.py | 0 13 files changed, 23 insertions(+), 444 deletions(-) delete mode 100644 src/pypgstac/Cargo.lock delete mode 100644 src/pypgstac/Cargo.toml delete mode 100644 src/pypgstac/src/lib.rs rename src/pypgstac/{python => src}/pypgstac/__init__.py (100%) rename src/pypgstac/{python => src}/pypgstac/db.py (100%) rename src/pypgstac/{python => src}/pypgstac/hydration.py (97%) rename src/pypgstac/{python => src}/pypgstac/load.py (100%) rename src/pypgstac/{python => src}/pypgstac/migrate.py (100%) rename src/pypgstac/{python => src}/pypgstac/migrations (100%) rename src/pypgstac/{python => src}/pypgstac/py.typed (100%) rename src/pypgstac/{python => src}/pypgstac/pypgstac.py (100%) rename src/pypgstac/{python => src}/pypgstac/version.py (100%) diff --git a/src/pypgstac/Cargo.lock b/src/pypgstac/Cargo.lock deleted file mode 100644 index af7fe4ec..00000000 --- a/src/pypgstac/Cargo.lock +++ /dev/null @@ -1,296 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "anyhow" -version = "1.0.75" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "indoc" -version = "2.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" - -[[package]] -name = "libc" -version = "0.2.148" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" - -[[package]] -name = "lock_api" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "memoffset" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" -dependencies = [ - "autocfg", -] - -[[package]] -name = "once_cell" -version = "1.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" - -[[package]] -name = "parking_lot" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets", -] - -[[package]] -name = "pgstacrs" -version = "0.0.0" -dependencies = [ - "anyhow", - "pyo3", -] - -[[package]] -name = "portable-atomic" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" - -[[package]] -name = "proc-macro2" -version = "1.0.67" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "pyo3" -version = "0.21.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e00b96a521718e08e03b1a622f01c8a8deb50719335de3f60b3b3950f069d8" -dependencies = [ - "anyhow", - "cfg-if", - "indoc", - "libc", - "memoffset", - "parking_lot", - "portable-atomic", - "pyo3-build-config", - "pyo3-ffi", - "pyo3-macros", - "unindent", -] - -[[package]] -name = "pyo3-build-config" -version = "0.21.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7883df5835fafdad87c0d888b266c8ec0f4c9ca48a5bed6bbb592e8dedee1b50" -dependencies = [ - "once_cell", - "target-lexicon", -] - -[[package]] -name = "pyo3-ffi" -version = "0.21.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01be5843dc60b916ab4dad1dca6d20b9b4e6ddc8e15f50c47fe6d85f1fb97403" -dependencies = [ - "libc", - "pyo3-build-config", -] - -[[package]] -name = "pyo3-macros" -version = "0.21.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77b34069fc0682e11b31dbd10321cbf94808394c56fd996796ce45217dfac53c" -dependencies = [ - "proc-macro2", - "pyo3-macros-backend", - "quote", - "syn", -] - -[[package]] -name = "pyo3-macros-backend" -version = "0.21.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08260721f32db5e1a5beae69a55553f56b99bd0e1c3e6e0a5e8851a9d0f5a85c" -dependencies = [ - "heck", - "proc-macro2", - "pyo3-build-config", - "quote", - "syn", -] - -[[package]] -name = "quote" -version = "1.0.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags", -] - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "smallvec" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" - -[[package]] -name = "syn" -version = "2.0.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee659fb5f3d355364e1f3e5bc10fb82068efbf824a1e9d1c9504244a6469ad53" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "target-lexicon" -version = "0.12.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d0e916b1148c8e263850e1ebcbd046f333e0683c724876bb0da63ea4373dc8a" - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unindent" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce" - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" diff --git a/src/pypgstac/Cargo.toml b/src/pypgstac/Cargo.toml deleted file mode 100644 index 0bdf2dbf..00000000 --- a/src/pypgstac/Cargo.toml +++ /dev/null @@ -1,18 +0,0 @@ -[package] -name = "pgstacrs" -version = "0.0.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html -[lib] -path = "src/lib.rs" -name = "pypgstac" -crate-type = ["cdylib"] - -[dependencies] -anyhow = "1" -pyo3 = { version = "0.21", features = [ - "abi3-py38", - "extension-module", - "anyhow", -] } diff --git a/src/pypgstac/pyproject.toml b/src/pypgstac/pyproject.toml index e689959c..c53a927a 100644 --- a/src/pypgstac/pyproject.toml +++ b/src/pypgstac/pyproject.toml @@ -20,14 +20,15 @@ classifiers = [ "Programming Language :: Python :: 3.11", ] dependencies = [ - "smart-open>=4.2", - "orjson>=3.5.2", - "python-dateutil==2.8.*", + "cachetools==5.3.*", "fire==0.4.*", + "hydraters==0.1.0", + "orjson>=3.5.2", "plpygis==0.2.*", "pydantic>=1.7", + "python-dateutil==2.8.*", + "smart-open>=4.2", "tenacity==8.1.*", - "cachetools==5.3.*", "version-parser>= 1.0.1", ] @@ -38,9 +39,6 @@ test = [ "pystac[validation]==1.*", "types-cachetools", ] -build = [ - "maturin>=1,<2", -] dev = [ "flake8==3.9.*", "black>=21.7b0", @@ -71,8 +69,8 @@ Changelog = "https://stac-utils.github.io/pgstac/release-notes/" pypgstac = "pypgstac.pypgstac:cli" [build-system] -requires = ["maturin>=1,<2"] -build-backend = "maturin" +requires = ["hatchling"] +build-backend = "hatchling.build" [tool.coverage.run] branch = true @@ -118,20 +116,11 @@ ignore = [ known-first-party = ["pypgstac"] [tool.mypy] -no_strict_optional = "True" -ignore_missing_imports = "True" -disallow_untyped_defs = "True" -namespace_packages = "True" +strict_optional = true +ignore_missing_imports = true +disallow_untyped_defs = true +namespace_packages = true [tool.pydocstyle] select = "D1" match = "(?!test).*.py" - -[tool.maturin] -python-source = "python" -module-name = "pypgstac.pgstacrs" -strip = true -sdist-generator = "cargo" -include = [ - "pypgstac/migrations/*.sql" -] diff --git a/src/pypgstac/src/lib.rs b/src/pypgstac/src/lib.rs deleted file mode 100644 index acf77459..00000000 --- a/src/pypgstac/src/lib.rs +++ /dev/null @@ -1,107 +0,0 @@ -#![deny( - elided_lifetimes_in_paths, - explicit_outlives_requirements, - keyword_idents, - macro_use_extern_crate, - meta_variable_misuse, - missing_abi, - missing_debug_implementations, - non_ascii_idents, - noop_method_call, - pointer_structural_match, - single_use_lifetimes, - trivial_casts, - trivial_numeric_casts, - unreachable_pub, - unused_crate_dependencies, - unused_extern_crates, - unused_import_braces, - unused_lifetimes, - unused_qualifications, - unused_results -)] - -use anyhow::anyhow; -use pyo3::pybacked::PyBackedStr; -use pyo3::{ - prelude::*, - types::{PyDict, PyList}, -}; - -const MAGIC_MARKER: &str = "𒍟※"; - -#[pyfunction] -fn hydrate<'py>( - base: &'py Bound<'py, PyAny>, - item: &'py Bound<'py, PyAny>, -) -> PyResult<&'py Bound<'py, PyAny>> { - hydrate_any(base, item) -} - -fn hydrate_any<'py>( - base: &'py Bound<'py, PyAny>, - item: &'py Bound<'py, PyAny>, -) -> PyResult<&'py Bound<'py, PyAny>> { - if let Ok(item) = item.downcast::() { - if let Ok(base) = base.downcast::() { - Ok(hydrate_dict(base, item)?.as_any()) - } else if base.is_none() { - Ok(item) - } else { - Err(anyhow!("type mismatch").into()) - } - } else if let Ok(item) = item.downcast::() { - if let Ok(base) = base.downcast::() { - Ok(hydrate_list(base, item)?.as_any()) - } else if base.is_none() { - Ok(item) - } else { - Err(anyhow!("type mismatch").into()) - } - } else { - Ok(item) - } -} - -fn hydrate_list<'py>( - base: &'py Bound<'py, PyList>, - item: &'py Bound<'py, PyList>, -) -> PyResult<&'py Bound<'py, PyList>> { - for i in 0..item.len() { - if i >= base.len() { - return Ok(item); - } else { - item.set_item(i, hydrate(&base.get_item(i)?, &item.get_item(i)?)?)?; - } - } - Ok(item) -} - -fn hydrate_dict<'py>( - base: &'py Bound<'py, PyDict>, - item: &'py Bound<'py, PyDict>, -) -> PyResult<&'py Bound<'py, PyDict>> { - for (key, base_value) in base { - if let Some(item_value) = item.get_item(&key)? { - if item_value - .extract::() - .ok() - .map(|s| >::as_ref(&s) == MAGIC_MARKER) - .unwrap_or(false) - { - item.del_item(key)?; - } else { - item.set_item(&key, hydrate(&base_value, &item_value)?)?; - } - } else { - item.set_item(key, base_value)?; - } - } - Ok(item) -} - -#[pymodule] -fn pgstacrs(_py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> { - m.add_function(wrap_pyfunction!(crate::hydrate, m)?)?; - Ok(()) -} diff --git a/src/pypgstac/python/pypgstac/__init__.py b/src/pypgstac/src/pypgstac/__init__.py similarity index 100% rename from src/pypgstac/python/pypgstac/__init__.py rename to src/pypgstac/src/pypgstac/__init__.py diff --git a/src/pypgstac/python/pypgstac/db.py b/src/pypgstac/src/pypgstac/db.py similarity index 100% rename from src/pypgstac/python/pypgstac/db.py rename to src/pypgstac/src/pypgstac/db.py diff --git a/src/pypgstac/python/pypgstac/hydration.py b/src/pypgstac/src/pypgstac/hydration.py similarity index 97% rename from src/pypgstac/python/pypgstac/hydration.py rename to src/pypgstac/src/pypgstac/hydration.py index 07b03be3..3044c2c6 100644 --- a/src/pypgstac/python/pypgstac/hydration.py +++ b/src/pypgstac/src/pypgstac/hydration.py @@ -1,18 +1,21 @@ """Hydrate data in pypgstac rather than on the database.""" + from copy import deepcopy from typing import Any, Dict -from pypgstac.pgstacrs import hydrate # noqa # pylint: disable=unused-import +from hydraters import hydrate # Marker value to indicate that a key should not be rehydrated DO_NOT_MERGE_MARKER = "𒍟※" + def hydrate_py(base_item: Dict[str, Any], item: Dict[str, Any]) -> Dict[str, Any]: """Hydrate item in-place with base_item properties. This will not perform a deep copy; values of the original item will be referenced in the return item. """ + # Merge will mutate i, but create deep copies of values in the base item # This will prevent the base item values from being mutated, e.g. by # filtering out fields in `filter_fields`. @@ -132,3 +135,11 @@ def apply_marked_keys( dehydrated.update(marked_dict) except TypeError: pass + + +__all__ = [ + "apply_marked_keys", + "dehydrate", + "hydrate", + "hydrate_py", +] diff --git a/src/pypgstac/python/pypgstac/load.py b/src/pypgstac/src/pypgstac/load.py similarity index 100% rename from src/pypgstac/python/pypgstac/load.py rename to src/pypgstac/src/pypgstac/load.py diff --git a/src/pypgstac/python/pypgstac/migrate.py b/src/pypgstac/src/pypgstac/migrate.py similarity index 100% rename from src/pypgstac/python/pypgstac/migrate.py rename to src/pypgstac/src/pypgstac/migrate.py diff --git a/src/pypgstac/python/pypgstac/migrations b/src/pypgstac/src/pypgstac/migrations similarity index 100% rename from src/pypgstac/python/pypgstac/migrations rename to src/pypgstac/src/pypgstac/migrations diff --git a/src/pypgstac/python/pypgstac/py.typed b/src/pypgstac/src/pypgstac/py.typed similarity index 100% rename from src/pypgstac/python/pypgstac/py.typed rename to src/pypgstac/src/pypgstac/py.typed diff --git a/src/pypgstac/python/pypgstac/pypgstac.py b/src/pypgstac/src/pypgstac/pypgstac.py similarity index 100% rename from src/pypgstac/python/pypgstac/pypgstac.py rename to src/pypgstac/src/pypgstac/pypgstac.py diff --git a/src/pypgstac/python/pypgstac/version.py b/src/pypgstac/src/pypgstac/version.py similarity index 100% rename from src/pypgstac/python/pypgstac/version.py rename to src/pypgstac/src/pypgstac/version.py From a81e4c02f1f365a2a47b93617adda02228223205 Mon Sep 17 00:00:00 2001 From: Pete Gadomski Date: Mon, 11 Nov 2024 16:26:26 -0700 Subject: [PATCH 2/3] ci: remove maturin --- .github/workflows/continuous-integration.yml | 150 +++---------------- .github/workflows/release.yml | 114 ++------------ 2 files changed, 39 insertions(+), 225 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 8bd159c0..57237ca7 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -24,26 +24,26 @@ jobs: buildpyrustdocker: ${{ steps.check.outputs.buildpy }} steps: - - uses: actions/checkout@v3 - - uses: dorny/paths-filter@v2 - id: filter - with: - filters: | - pgstac: - - 'docker/pgstac/**' - pypgstac: - - 'docker/pypgstac/**' - - id: check - run: | - buildpg=false; - ref=$(echo ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} | tr / _); - [[ "${{ steps.filter.outputs.pgstac }}" == "true" ]] && buildpg=true || ref=main; - echo "pgtag=${{ env.REGISTRY }}/stac-utils/pgstac-postgres:$ref" >>$GITHUB_OUTPUT; - echo "buildpg=$buildpg" >>$GITHUB_OUTPUT; - buildy=false; - [[ "${{ steps.filter.outputs.pypgstac }}" == "true" ]] && buildpy=true || ref=main; - echo "pytag=${{ env.REGISTRY }}/stac-utils/pgstac-pyrust:$ref" >>$GITHUB_OUTPUT; - echo "buildpy=$buildpg" >>$GITHUB_OUTPUT; + - uses: actions/checkout@v3 + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + pgstac: + - 'docker/pgstac/**' + pypgstac: + - 'docker/pypgstac/**' + - id: check + run: | + buildpg=false; + ref=$(echo ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} | tr / _); + [[ "${{ steps.filter.outputs.pgstac }}" == "true" ]] && buildpg=true || ref=main; + echo "pgtag=${{ env.REGISTRY }}/stac-utils/pgstac-postgres:$ref" >>$GITHUB_OUTPUT; + echo "buildpg=$buildpg" >>$GITHUB_OUTPUT; + buildy=false; + [[ "${{ steps.filter.outputs.pypgstac }}" == "true" ]] && buildpy=true || ref=main; + echo "pytag=${{ env.REGISTRY }}/stac-utils/pgstac-pyrust:$ref" >>$GITHUB_OUTPUT; + echo "buildpy=$buildpg" >>$GITHUB_OUTPUT; # This builds a base postgres image that has everything installed to be able to run pgstac. This image does not have pgstac itself installed. buildpg: @@ -103,7 +103,7 @@ jobs: needs: [changes, buildpg, buildpyrust] runs-on: ubuntu-latest container: - image: ${{ needs.changes.outputs.pyrustdocker }} + image: ${{ needs.changes.outputs.pyrustdocker }} env: PGPASSWORD: postgres PGHOST: postgres @@ -125,114 +125,10 @@ jobs: - uses: actions/checkout@v3 - name: Install pypgstac working-directory: /__w/pgstac/pgstac/src/pypgstac - run: | + run: | pip install .[dev,test,psycopg]; - name: Run tests working-directory: /__w/pgstac/pgstac/docker/pypgstac/bin - run: | + run: | ./test - - linux: - runs-on: ubuntu-latest - strategy: - matrix: - target: [x86_64, x86, aarch64, armv7, s390x, ppc64le] - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - working-directory: src/pypgstac - target: ${{ matrix.target }} - args: --release --out /home/runner/work/pgstac/pgstac/dist - sccache: 'true' - manylinux: auto - - name: Upload wheels - uses: actions/upload-artifact@v3 - with: - name: wheels - path: /home/runner/work/pgstac/pgstac/dist/* - - windows: - runs-on: windows-latest - strategy: - matrix: - target: [x64, x86] - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - architecture: ${{ matrix.target }} - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - working-directory: src/pypgstac - target: ${{ matrix.target }} - args: --release --out /home/runner/work/pgstac/pgstac/dist - sccache: 'true' - - name: Upload wheels - uses: actions/upload-artifact@v3 - with: - name: wheels - path: /home/runner/work/pgstac/pgstac/dist/* - - macos: - runs-on: macos-latest - strategy: - matrix: - target: [x86_64, aarch64] - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - working-directory: src/pypgstac - target: ${{ matrix.target }} - args: --release --out /tmp/dist - sccache: 'true' - - name: Upload wheels - uses: actions/upload-artifact@v3 - with: - name: wheels - path: /tmp/dist/* - - sdist: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Build sdist - uses: PyO3/maturin-action@v1 - with: - working-directory: src/pypgstac - command: sdist - args: --out /home/runner/work/pgstac/pgstac/dist - - name: Upload sdist - uses: actions/upload-artifact@v3 - with: - name: wheels - path: /home/runner/work/pgstac/pgstac/dist/* - - # release: - # name: Release - # runs-on: ubuntu-latest - # if: "startsWith(github.ref, 'refs/tags/')" - # needs: [linux, windows, macos, sdist] - # steps: - # - uses: actions/download-artifact@v3 - # with: - # name: wheels - # - name: Publish to PyPI - # uses: PyO3/maturin-action@v1 - # env: - # MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} - # with: - # command: upload - # args: --skip-existing * diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 535dcc3e..ad70062b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -151,106 +151,24 @@ jobs: cache-from: type=gha cache-to: type=gha, mode=max - linux: - runs-on: ubuntu-latest - strategy: - matrix: - target: [x86_64, x86, aarch64, armv7, s390x, ppc64le] - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - working-directory: src/pypgstac - target: ${{ matrix.target }} - args: --release --out /home/runner/work/pgstac/pgstac/dist - sccache: 'true' - manylinux: auto - - name: Upload wheels - uses: actions/upload-artifact@v3 - with: - name: wheels - path: /home/runner/work/pgstac/pgstac/dist/* - - windows: - runs-on: windows-latest - strategy: - matrix: - target: [x64, x86] - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - architecture: ${{ matrix.target }} - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - working-directory: src/pypgstac - target: ${{ matrix.target }} - args: --release --out /home/runner/work/pgstac/pgstac/dist - sccache: 'true' - - name: Upload wheels - uses: actions/upload-artifact@v3 - with: - name: wheels - path: /home/runner/work/pgstac/pgstac/dist/* - - macos: - runs-on: macos-latest - strategy: - matrix: - target: [x86_64, aarch64] - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - working-directory: src/pypgstac - target: ${{ matrix.target }} - args: --release --out /tmp/dist - sccache: 'true' - - name: Upload wheels - uses: actions/upload-artifact@v3 - with: - name: wheels - path: /tmp/dist/* - - sdist: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Build sdist - uses: PyO3/maturin-action@v1 - with: - working-directory: src/pypgstac - command: sdist - args: --out /home/runner/work/pgstac/pgstac/dist - - name: Upload sdist - uses: actions/upload-artifact@v3 - with: - name: wheels - path: /home/runner/work/pgstac/pgstac/dist/* - releasetopypi: name: Release runs-on: ubuntu-latest - needs: [linux, windows, macos, sdist] + permissions: + id-token: write + environment: + name: pypi + url: https://pypi.org/p/pypgstac steps: - - uses: actions/download-artifact@v3 - with: - name: wheels + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: Install build + run: pip install build + - name: Build + run: python -m build - name: Publish to PyPI - uses: PyO3/maturin-action@v1 - env: - MATURIN_USERNAME: ${{ secrets.PYPI_STACUTILS_USERNAME }} - MATURIN_PASSWORD: ${{ secrets.PYPI_STACUTILS_PASSWORD }} - with: - command: upload - args: --skip-existing * + uses: pypa/gh-action-pypi-publish@release/v1 From 6c56dc5c6513458600c88fc9a6a5bca56c9191f9 Mon Sep 17 00:00:00 2001 From: Pete Gadomski Date: Thu, 14 Nov 2024 05:28:20 -0700 Subject: [PATCH 3/3] deps: relax hydraters a bit --- src/pypgstac/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pypgstac/pyproject.toml b/src/pypgstac/pyproject.toml index c53a927a..a800e719 100644 --- a/src/pypgstac/pyproject.toml +++ b/src/pypgstac/pyproject.toml @@ -22,7 +22,7 @@ classifiers = [ dependencies = [ "cachetools==5.3.*", "fire==0.4.*", - "hydraters==0.1.0", + "hydraters==0.1.*", "orjson>=3.5.2", "plpygis==0.2.*", "pydantic>=1.7",