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
4 changes: 2 additions & 2 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
- run: uv sync
- run: uv sync --locked
- run: uv run ruff check .
- run: uv run ruff format --check .
ty:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
- run: uv sync
- run: uv sync --locked
- run: uv run ty check
27 changes: 27 additions & 0 deletions .github/workflows/lock-upgrade.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: lock-upgrade
# Monthly refresh of uv.lock, opened as a pull request so CI runs against the
# new resolution before it lands. Trigger by hand from the Actions tab to
# upgrade sooner.
on:
schedule:
- cron: "0 6 1 * *" # 06:00 UTC on the first of every month
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
upgrade:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
- run: uv lock --upgrade
- uses: peter-evans/create-pull-request@v7
with:
branch: chore/lock-upgrade
commit-message: "Upgrade uv.lock"
title: "Upgrade uv.lock"
body: |
Monthly `uv lock --upgrade`. Close and reopen this PR to trigger CI
if the checks did not start.
delete-branch: true
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- run: uv sync --resolution ${{ matrix.resolution }}
- run: uv run pytest --cov=src --cov-report=term-missing --cov-report=xml
- run: uv run pytest --cov --cov-report=term-missing --cov-report=xml
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ build
*.egg-info
*.pyc
.coverage

# pytest-cov output
coverage.xml
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
[![tests](https://github.com/funkelab/funlib.geometry/actions/workflows/tests.yaml/badge.svg)](https://github.com/funkelab/funlib.geometry/actions/workflows/tests.yaml)
[![lint](https://github.com/funkelab/funlib.geometry/actions/workflows/lint.yaml/badge.svg)](https://github.com/funkelab/funlib.geometry/actions/workflows/lint.yaml)
[![publish](https://github.com/funkelab/funlib.geometry/actions/workflows/publish.yaml/badge.svg)](https://pypi.org/project/funlib.geometry/)

# funlib.geometry
A package for Coordinates, Rois and common operations in Coordinate spaces

## Installation
## Install

`pip install funlib.geometry`
```bash
pip install funlib.geometry # or: uv add funlib.geometry
```

## Usage

Expand Down Expand Up @@ -79,3 +82,18 @@ roi.snap_to_grid(Coordinate(4, 4), mode="grow") # Roi((0, 4), (16, 16))
data = np.zeros((100, 100))
region = data[roi.to_slices()] # equivalent to data[3:13, 7:17]
```

## Contributing

The commands below are the ones CI runs, so a green local run means a green PR.

```bash
git clone https://github.com/funkelab/funlib.geometry
cd funlib.geometry
uv sync # Python, dependencies, dev tools (from uv.lock)
uv run pytest # tests with coverage
uv run ruff check . && uv run ruff format --check . # lint and formatting
uv run ty check # types
```

`uv.lock` pins the development environment; the `lock-upgrade` workflow refreshes it monthly and opens a pull request.
21 changes: 18 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@ requires-python = ">=3.10"

dependencies = []

[project.urls]
Source = "https://github.com/funkelab/funlib.geometry"
Issues = "https://github.com/funkelab/funlib.geometry/issues"

[dependency-groups]
dev = [
"pytest>=8.4.2",
"pytest-cov>=7.0.0",
# pinned with == until uv.lock is committed: both change their rule sets between releases
"ruff==0.17.3",
"ty==0.0.96",
# versions come from uv.lock; `uv lock --upgrade` moves them
"ruff>=0.17.3",
"ty>=0.0.96",
]

[tool.setuptools.dynamic]
Expand All @@ -51,3 +55,14 @@ ignore = ["E501"] # the formatter owns line length
"tutorials/**/*.py" = ["E402"] # jupytext cells import mid-file
"examples/**/*.py" = ["E402"]
"__init__.py" = ["F401"] # re-exports

[tool.coverage.run]
branch = true
source = ["funlib.geometry"]

[tool.coverage.report]
# Floor measured from the first branch-enabled run; raise it when measured
# coverage is two or more points ahead, never lower it without saying why.
fail_under = 81
show_missing = true
skip_covered = true
Loading
Loading