Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to Pixi, Hatchling, Pre-commit, and Ruff #142

Merged
merged 36 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
9b29faf
Add pixi.toml
hoxbro Aug 4, 2024
6258e2f
Add upperpins for now
hoxbro Aug 4, 2024
1b124bf
Move tool settings to pyproject.toml
hoxbro Aug 4, 2024
24f3e1f
Move to simple ruff
hoxbro Aug 4, 2024
0e835d3
Add simple pre-commit for now
hoxbro Aug 4, 2024
8c2f04d
Add core test run
hoxbro Aug 4, 2024
1864e97
Format test.yaml
hoxbro Aug 4, 2024
f839804
Update test.yaml
hoxbro Aug 4, 2024
9f453fd
Add test-example
hoxbro Aug 4, 2024
fbdade1
Remove script
hoxbro Aug 4, 2024
4e5ad57
Switch to hatchling as build-backend
hoxbro Aug 4, 2024
5ca0c2b
Update __version__ file
hoxbro Aug 4, 2024
b6adcc3
Update pixi toml with build and lint
hoxbro Aug 4, 2024
740fbe3
Try pygeos for 3.9
hoxbro Aug 4, 2024
4c480de
Update conda build
hoxbro Aug 4, 2024
fd38836
Remove pytest-rerunfailures
hoxbro Aug 4, 2024
5cf401d
Clean up
hoxbro Aug 4, 2024
c40cbaa
Lit build.yaml
hoxbro Aug 4, 2024
1f46a13
Update build file
hoxbro Aug 4, 2024
d67c42b
Add nighly lock
hoxbro Aug 4, 2024
0258c63
run ruff lint on code
hoxbro Aug 4, 2024
5c9b2ea
Remove config files
hoxbro Aug 4, 2024
305ae7d
Lower pin s3fs
hoxbro Aug 4, 2024
2713e21
Always use shapely backend for geopandas
hoxbro Aug 4, 2024
cebba92
Add moto back
hoxbro Aug 4, 2024
c53e2cf
Change s3fs pin to be spec 0 compatible
hoxbro Aug 4, 2024
404cdac
Add lower pins to fsspec and pyarrow and remove param
hoxbro Aug 4, 2024
faa82e4
Update to work with moto 5
hoxbro Aug 4, 2024
048fda0
Parameterize dask_remote test
hoxbro Aug 4, 2024
9b45db9
Misc. changes
hoxbro Aug 5, 2024
7242989
Reduce hypothesis runtime from 500 to 100
hoxbro Aug 5, 2024
23e46bb
Automate conda meta
hoxbro Aug 5, 2024
7cb36bf
Add rtree dependency as geopandas no longer use pygeos
hoxbro Aug 5, 2024
c3b2b56
Ignore test_intersection if point
hoxbro Aug 5, 2024
8403b1c
Restore examples file
hoxbro Aug 7, 2024
b080a29
Remove clean notebook pre-commit
hoxbro Aug 7, 2024
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
170 changes: 139 additions & 31 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,158 @@ on:
- main
pull_request:
branches:
- '*'
- "*"
workflow_dispatch:
inputs:
target:
description: "How much of the test suite to run"
type: choice
default: default
options:
- default
- full
- downstream
cache:
description: "Use cache"
type: boolean
default: true

schedule:
- cron: '0 01 * * SUN'
- cron: "0 01 * * SUN"

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash -el {0}

env:
COLUMNS: 120
DISPLAY: ":99.0"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COV: "--cov=./spatialpandas --cov-report=xml"

jobs:
test_suite:
name: Tests on ${{ matrix.os }} with Python ${{ matrix.python-version }}
pre_commit:
name: Run pre-commit
runs-on: "ubuntu-latest"
steps:
- uses: holoviz-dev/holoviz_tasks/pre-commit@v0

setup:
name: Setup workflow
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
code_change: ${{ steps.filter.outputs.code }}
matrix: ${{ env.MATRIX }}
steps:
- uses: actions/checkout@v4
if: github.event_name != 'pull_request'
- name: Check for code changes
uses: dorny/paths-filter@v3
id: filter
with:
filters: |
code:
- 'spatialpandas/**'
- 'examples/**'
- 'pixi.toml'
- 'pyproject.toml'
- '.github/workflows/test.yaml'
- name: Set matrix option
run: |
if [[ '${{ github.event_name }}' == 'workflow_dispatch' ]]; then
OPTION=${{ github.event.inputs.target }}
elif [[ '${{ github.event_name }}' == 'schedule' ]]; then
OPTION="full"
elif [[ '${{ github.event_name }}' == 'push' && '${{ github.ref_type }}' == 'tag' ]]; then
OPTION="full"
else
OPTION="default"
fi
echo "MATRIX_OPTION=$OPTION" >> $GITHUB_ENV
- name: Set test matrix with 'default' option
if: env.MATRIX_OPTION == 'default'
run: |
MATRIX=$(jq -nsc '{
"os": ["ubuntu-latest", "macos-latest", "windows-latest"],
"environment": ["test-39", "test-312"]
}')
echo "MATRIX=$MATRIX" >> $GITHUB_ENV
- name: Set test matrix with 'full' option
if: env.MATRIX_OPTION == 'full'
run: |
MATRIX=$(jq -nsc '{
"os": ["ubuntu-latest", "macos-latest", "windows-latest"],
"environment": ["test-39", "test-310", "test-311", "test-312"]
}')
echo "MATRIX=$MATRIX" >> $GITHUB_ENV
- name: Set test matrix with 'downstream' option
if: env.MATRIX_OPTION == 'downstream'
run: |
MATRIX=$(jq -nsc '{
"os": ["ubuntu-latest"],
"environment": ["test-311"]
}')
echo "MATRIX=$MATRIX" >> $GITHUB_ENV

pixi_lock:
name: Pixi lock
runs-on: ubuntu-latest
steps:
- uses: holoviz-dev/holoviz_tasks/pixi_lock@pixi
with:
cache: ${{ github.event.inputs.cache == 'true' || github.event.inputs.cache == '' }}

unit_test_suite:
name: unit:${{ matrix.environment }}:${{ matrix.os }}
needs: [pre_commit, setup, pixi_lock]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.setup.outputs.matrix) }}
timeout-minutes: 120
steps:
- uses: holoviz-dev/holoviz_tasks/pixi_install@pixi
if: needs.setup.outputs.code_change == 'true'
with:
environments: ${{ matrix.environment }}
- name: Test Unit
if: needs.setup.outputs.code_change == 'true'
run: |
pixi run -e ${{ matrix.environment }} test-unit $COV
- name: Test Examples
if: needs.setup.outputs.code_change == 'true'
run: |
pixi run -e ${{ matrix.environment }} test-example
- uses: codecov/codecov-action@v4
if: needs.setup.outputs.code_change == 'true'
with:
token: ${{ secrets.CODECOV_TOKEN }}

core_test_suite:
name: core:${{ matrix.environment }}:${{ matrix.os }}
needs: [pre_commit, setup, pixi_lock]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
python-version: ["3.9", "3.10", "3.11"]
timeout-minutes: 90
defaults:
run:
shell: bash -l {0}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
os: ["ubuntu-latest"]
environment: ["test-core"]
timeout-minutes: 120
steps:
- uses: holoviz-dev/holoviz_tasks/[email protected]
- uses: holoviz-dev/holoviz_tasks/pixi_install@pixi
if: needs.setup.outputs.code_change == 'true'
with:
name: unit_test_suite
python-version: ${{ matrix.python-version }}
channel-priority: strict
channels: pyviz/label/dev,conda-forge,nodefaults
envs: "-o tests"
cache: true
conda-update: true
id: install
- name: doit test_lint
if: runner.os != 'Windows'
run: |
conda activate test-environment
doit test_lint
- name: doit test_unit_deploy
run: |
conda activate test-environment
doit test_unit_deploy
environments: ${{ matrix.environment }}
- name: Check packages latest version
if: needs.setup.outputs.code_change == 'true'
run: |
pixi run -e ${{ matrix.environment }} check-latest-packages numpy pandas bokeh panel param
- name: Test Unit
if: needs.setup.outputs.code_change == 'true'
run: |
pixi run -e ${{ matrix.environment }} test-unit
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,12 @@ spatialpandas/.version
monkeytype.sqlite3

.doit.db

# pixi + hatch
.pixi
pixi.lock
_version.py

# Exampel files
examples/world.parq
examples/world_packed.parq/
7 changes: 0 additions & 7 deletions .isort.cfg

This file was deleted.

37 changes: 37 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
exclude: (\.(js|svg)$)

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-builtin-literals
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-toml
- id: detect-private-key
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.6
hooks:
- id: ruff
files: datashader/
- repo: https://github.com/hoxbro/clean_notebook
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we should add this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think so, at least for now. The examples notebooks are deliberately checked in with the output.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have restored the output of the notebooks

rev: v0.1.15
hooks:
- id: clean-notebook
# - repo: https://github.com/codespell-project/codespell
# rev: v2.3.0
# hooks:
# - id: codespell
# additional_dependencies:
# - tomli
# - repo: https://github.com/pycqa/isort
# rev: 5.13.2
# hooks:
# - id: isort
# name: isort (python)

ci:
autofix_prs: false
Loading
Loading