Skip to content

Commit

Permalink
Merge branch 'main' into filter
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaMarconato committed Jan 22, 2025
2 parents fc09cc0 + 03d3be8 commit a9f2b62
Show file tree
Hide file tree
Showing 113 changed files with 6,112 additions and 2,051 deletions.
53 changes: 53 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
name: Bug report
about: Create a report to help us improve
title: ""
labels: ""
assignees: ""
---

**Recommendation: attach a minimal working example**
Generally, the easier it is for us to reproduce the issue, the faster we can work on it. It is not required, but if you can, please:

1. Reproduce using the [`blobs` dataset](https://spatialdata.scverse.org/en/latest/generated/spatialdata.datasets.blobs.html)

```python
from spatialdata.datasets import blobs

sdata = blobs()
```

You can also use [`blobs_annotating_element`](https://spatialdata.scverse.org/en/latest/generated/spatialdata.datasets.blobs_annotating_element.html) for more control:

```
from spatialdata.datasets import blobs_annotating_element
sdata = blobs_annotating_element('blobs_labels')
```

2. If the above is not possible, reproduce using a public dataset and explain how we can download the data.
3. If the data is private, consider sharing an anonymized version/subset via a [Zulip private message](https://scverse.zulipchat.com/#user/480560), or provide screenshots/GIFs showing the behavior.

**Describe the bug**
A clear and concise description of what the bug is; please report only one bug per issue.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (optional):**

- OS: [e.g. macOS, Windows, Linux]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Feature request
about: Suggest an idea for this project
title: ""
labels: ""
assignees: ""
---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
28 changes: 28 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
changelog:
exclude:
labels:
- release-ignore
authors:
- pre-commit-ci
categories:
- title: Added
labels:
- "release-added"
- title: Changed
labels:
- "release-changed"
- title: Deprecated
labels:
- "release-deprecated"
- title: Removed
labels:
- "release-removed"
- title: Fixed
labels:
- "release-fixed"
- title: Security
labels:
- "release-security"
- title: Other Changes
labels:
- "*"
24 changes: 0 additions & 24 deletions .github/workflows/build.yaml

This file was deleted.

100 changes: 100 additions & 0 deletions .github/workflows/build_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Build Docker image

on:
workflow_dispatch:
# schedule:
# - cron: '0 0 * * *' # run daily at midnight UTC

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest

defaults:
run:
shell: bash -e {0} # -e to fail on error

permissions:
contents: read
packages: write
attestations: write
id-token: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Upgrade pip
run: pip install pip

- name: Get latest versions
id: get_versions
run: |
SPATIALDATA_VERSION=$(pip index versions spatialdata | grep "Available versions" | sed 's/Available versions: //' | awk -F', ' '{print $1}')
SPATIALDATA_IO_VERSION=$(pip index versions spatialdata-io | grep "Available versions" | sed 's/Available versions: //' | awk -F', ' '{print $1}')
SPATIALDATA_PLOT_VERSION=$(pip index versions spatialdata-plot | grep "Available versions" | sed 's/Available versions: //' | awk -F', ' '{print $1}')
echo "SPATIALDATA_VERSION=${SPATIALDATA_VERSION}" >> $GITHUB_ENV
echo "SPATIALDATA_IO_VERSION=${SPATIALDATA_IO_VERSION}" >> $GITHUB_ENV
echo "SPATIALDATA_PLOT_VERSION=${SPATIALDATA_PLOT_VERSION}" >> $GITHUB_ENV
- name: Check if image tag exists
id: check_tag
env:
IMAGE_TAG_SUFFIX: spatialdata${{ env.SPATIALDATA_VERSION }}_spatialdata-io${{ env.SPATIALDATA_IO_VERSION }}_spatialdata-plot${{ env.SPATIALDATA_PLOT_VERSION }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Define the API URL
API_URL="https://api.github.com/orgs/scverse/packages/container/spatialdata/versions"
# Fetch all existing versions
existing_tags=$(curl -s -H "Authorization: token $GITHUB_TOKEN" $API_URL | jq -r '.[].metadata.container.tags[]')
# Debug: Output all existing tags
echo "Existing tags:"
echo "$existing_tags"
# Check if the constructed tag exists
if echo "$existing_tags" | grep -q "$IMAGE_TAG_SUFFIX"; then
echo "Image tag $IMAGE_TAG_SUFFIX already exists. Skipping build."
echo "skip_build=true" >> $GITHUB_ENV
else
echo "Image tag $IMAGE_TAG_SUFFIX does not exist. Proceeding with build."
echo "skip_build=false" >> $GITHUB_ENV
echo "IMAGE_TAG_SUFFIX=${IMAGE_TAG_SUFFIX}" >> $GITHUB_ENV
fi
- name: Login to GitHub Container Registry
if: ${{ env.skip_build == 'false' }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/build-push-action@v5
if: ${{ env.skip_build == 'false' }}
env:
IMAGE_TAG: ${{ env.REGISTRY }}/scverse/spatialdata:${{ env.IMAGE_TAG_SUFFIX }}
with:
context: .
file: ./Dockerfile
push: true
cache-from: type=registry,ref=${{ env.REGISTRY }}/scverse/spatialdata:buildcache
cache-to: type=inline,ref=${{ env.REGISTRY }}/scverse/spatialdata:buildcache
build-args: |
SPATIALDATA_VERSION=${{ env.SPATIALDATA_VERSION }}
SPATIALDATA_IO_VERSION=${{ env.SPATIALDATA_IO_VERSION }}
SPATIALDATA_PLOT_VERSION=${{ env.SPATIALDATA_PLOT_VERSION }}
tags: ${{ env.IMAGE_TAG }}
20 changes: 10 additions & 10 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ on:
types: [published]

jobs:
release:
# requires that you have put your twine API key in your
# github secrets (see readme for details)
package_and_release:
runs-on: ubuntu-latest
if: contains(github.ref, 'tags')
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout code
uses: actions/checkout@v3

- uses: actions/checkout@v3
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.12"

cache: pip
- name: Install build dependencies
run: python -m pip install --upgrade pip wheel twine build
- name: Build package
run: python -m build
- name: Check package
run: twine check --strict dist/*.whl
- name: Install hatch
run: pip install hatch

- name: Build project for distribution
run: hatch build

- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ["3.9", "3.12"]
python: ["3.10", "3.12"]
os: [ubuntu-latest]
include:
- os: macos-latest
python: "3.9"
python: "3.10"
- os: macos-latest
python: "3.12"
pip-flags: "--pre"
Expand Down
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ __pycache__/
/data/

# docs
/docs
docs/_build
!docs/api/.md
docs/**/generated

# IDEs
/.idea/
Expand All @@ -29,8 +31,6 @@ __pycache__/
# temp files
temp/

# rst generated from myst
docs/generated

# symlinks (luca) for extending the refactoring to satellite projects
napari-spatialdata
Expand All @@ -47,3 +47,5 @@ _version.py

# other
node_modules/

.asv/
2 changes: 1 addition & 1 deletion .mypy.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[mypy]
python_version = 3.9
python_version = 3.10
plugins = numpy.typing.mypy_plugin

ignore_errors = False
Expand Down
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@ fail_fast: false
default_language_version:
python: python3
default_stages:
- commit
- push
- pre-commit
- pre-push
minimum_pre_commit_version: 2.16.0
ci:
skip: []
repos:
- repo: https://github.com/psf/black
rev: 24.4.2
rev: 24.10.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.4.2
hooks:
- id: prettier
- repo: https://github.com/asottile/blacken-docs
rev: 1.18.0
rev: 1.19.1
hooks:
- id: blacken-docs
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.1
rev: v1.14.1
hooks:
- id: mypy
additional_dependencies: [numpy, types-requests]
exclude: tests/|docs/
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.0
rev: v0.9.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
1 change: 1 addition & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ python:
path: .
extra_requirements:
- docs
- torch
submodules:
include:
- "docs/tutorials/notebooks"
Expand Down
Loading

0 comments on commit a9f2b62

Please sign in to comment.