Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ jobs:
MPLBACKEND: Agg # https://github.com/orgs/community/discussions/26434

- name: Create test reports directory
if: matrix.pytest && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13'
if: matrix.pytest && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' && matrix.resolution == 'highest'
run: mkdir -p ./test-reports

- name: Upload coverage reports
if: matrix.pytest && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13'
if: matrix.pytest && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' && matrix.resolution == 'highest'
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: coverage-reports
Expand Down Expand Up @@ -126,7 +126,7 @@ jobs:
cat > sonar-project.properties << EOF
sonar.projectKey=${SONAR_PROJECT_KEY}
sonar.language=py
sonar.python.version=3.13
sonar.python.version=3.10
sonar.sources=./src
sonar.tests=./tests
sonar.python.coverage.reportPaths=./test-reports/coverage.xml
Expand Down
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.12.11
3.10.18
36 changes: 32 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
<a href="https://github.com/tonkintaylor/geopins/"><img src="https://raw.githubusercontent.com/tonkintaylor/geopins/refs/heads/develop/docs/logo.svg" align="right" height="138" /></a>

<!-- -->
# geopins
<a href="https://github.com/tonkintaylor/geopins/"><img src="https://raw.githubusercontent.com/tonkintaylor/geopins/refs/heads/develop/docs/logo.svg" align="right" height="138" /></a>

[![PyPI Version](https://img.shields.io/pypi/v/geopins.svg)](<https://pypi.python.org/pypi/geopins>)
[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![usethis](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/usethis-python/usethis-python/main/assets/badge/v1.json)](https://github.com/usethis-python/usethis-python)

Geospatial support for the [Python pins package](https://github.com/rstudio/pins-python).
The geopins package provides geospatial support for the [Python pins package](https://github.com/rstudio/pins-python). The package publishes data, models, and other Python objects, making it easy to share them across projects and with your colleagues. With `geopins`, there is support for geospatial datatypes (e.g. `geopandas.GeoDatFrame`, and `rastr.Raster`) and filetypes (e.g. `GeoPackage`, and `GeoTIFF`), fully compatible with your existing pins boards.

## Installation

Expand All @@ -20,6 +18,36 @@ uv add geopins
pip install geopins
```

## Quick Start

```python
from pins import board_local

# Patch pins to support geospatial data
import geopins
geopins.patch()

# Define any pins board as usual
b = board_local()

# Save a GeoDataFrame
import geopandas as gpd
gdf = b.pin_write(
gpd.GeoDataFrame({"x": [1, 2, 3]}, geometry=gpd.points_from_xy([1, 2, 3], [4, 5, 6])),
"gdf_example",
)

# Read it back
gdf = b.pin_read("gdf_example")

# Save a raster
from rastr.raster import Raster
b.pin_write(Raster.example(), "raster_example")

# Read it back
raster = b.pin_read("raster_example")
```

## Contributing

See the
Expand Down
26 changes: 15 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ classifiers = [
]
dynamic = [ "urls", "version" ]
dependencies = [
"geopandas>=1.1.1",
"pins>=0.9.1",
"pyarrow>=21.0.0",
"rastr>=0.6.0",
]

[dependency-groups]
Expand Down Expand Up @@ -56,6 +60,7 @@ dev = [
test = [
"coverage[toml]>=7.10.1",
"detect-test-pollution>=1.2.0",
"pandas>=2.3.3",
"pytest>=8.4.1",
"pytest-cov>=6.2.1",
"pytest-emoji>=0.2.0",
Expand Down Expand Up @@ -170,16 +175,6 @@ lint.per-file-ignores."tests/**/*.py" = [
]
lint.allowed-confusables = [ "ℹ", "–", "σ" ]
lint.flake8-tidy-imports.banned-api."pytz".msg = "'zoneinfo' should be preferred to 'pytz' when using Python 3.9 and later, see https://tonkintaylor-sonarqube.azurewebsites.net/coding_rules?open=python%3AS6890&rule_key=python%3AS6890"
lint.flake8-tidy-imports.banned-module-level-imports = [
"branca",
"folium",
"geopandas",
"matplotlib",
"mpl_toolkits",
"pandas",
"scipy",
"tqdm",
]

lint.flake8-type-checking.quote-annotations = true
lint.flake8-type-checking.runtime-evaluated-base-classes = [ "pydantic.BaseModel" ]
Expand All @@ -193,6 +188,8 @@ ignore-words-list = [ "..." ]
[tool.deptry]
extend_exclude = [ "src/notebooks", "src/scripts", "src/archive" ]
experimental_namespace_package = true
[tool.deptry.per_rule_ignores]
DEP002 = [ "pyarrow" ]

[tool.pyproject-fmt]
keep_full_version = true
Expand Down Expand Up @@ -249,7 +246,14 @@ root_packages = [ "geopins" ]
[[tool.importlinter.contracts]]
name = "geopins"
type = "layers"
layers = [ ]
layers = [ "patch_", "boards", "drivers", "meta", "filetypes | interfaces" ]
containers = [ "geopins" ]
exhaustive = true
exhaustive_ignores = [ "_version" ]

[[tool.importlinter.contracts]]
name = "geopins.drivers"
type = "layers"
layers = [ "gdf | raster", "exceptions | infer" ]
containers = [ "geopins.drivers" ]
exhaustive = true
Loading