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 29 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
200 changes: 117 additions & 83 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,103 +2,137 @@ name: packages
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+a[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+b[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+rc[0-9]+'
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+a[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+b[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
# Dry-run only
workflow_dispatch:
inputs:
target:
description: 'Build mode'
type: choice
options:
- dryrun
required: true
default: dryrun
schedule:
- cron: '0 01 * * SUN'
- cron: "0 16 * * SUN"

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

env:
PYTHON_VERSION: "3.11"
PACKAGE: "spatialpandas"

jobs:
waiting_room:
name: Waiting Room
runs-on: ubuntu-latest
needs: [conda_build, pip_install]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
environment:
name: publish
steps:
- run: echo "All builds have finished, have been approved, and ready to publish"

pixi_lock:
name: Pixi lock
runs-on: ubuntu-latest
steps:
- uses: holoviz-dev/holoviz_tasks/pixi_lock@pixi

conda_build:
name: Build Conda Packages
runs-on: 'ubuntu-latest'
defaults:
run:
shell: bash -l {0}
env:
PKG_TEST_PYTHON: "--test-python=py39"
CONDA_UPLOAD_TOKEN: ${{ secrets.CONDA_UPLOAD_TOKEN }}
name: Build Conda
needs: [pixi_lock]
runs-on: "ubuntu-latest"
steps:
- uses: holoviz-dev/holoviz_tasks/pixi_install@pixi
with:
environments: "build"
download-data: false
install: false
- name: conda build
run: pixi run -e build build-conda
- uses: actions/upload-artifact@v4
if: always()
with:
name: conda
path: dist/*.tar.bz2
if-no-files-found: error

conda_publish:
name: Publish Conda
runs-on: ubuntu-latest
needs: [conda_build, waiting_room]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v4
with:
fetch-depth: "100"
- uses: conda-incubator/setup-miniconda@v2
name: conda
path: dist/
- name: Set environment variables
run: |
echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "CONDA_FILE=$(ls dist/*.tar.bz2)" >> $GITHUB_ENV
- uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
python-version: 3.9
channels: pyviz/label/dev,conda-forge,nodefaults
- name: Fetch unshallow
run: git fetch --prune --tags --unshallow -f
- name: Set output
id: vars
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: conda setup
run: |
conda install -c pyviz "pyctdev>=0.5"
doit ecosystem_setup
# FIXME: downgrade urllib3 until this issue is fixed:
# https://github.com/Anaconda-Platform/anaconda-client/issues/654
conda install -c conda-forge "urllib3<2.0.0"
- name: doit env_capture
run: |
doit env_capture
- name: conda build
run: doit package_build $PKG_TEST_PYTHON --no-pkg-tests
conda install -y anaconda-client
- name: conda dev upload
if: (github.event_name == 'push' && (contains(steps.vars.outputs.tag, 'a') || contains(steps.vars.outputs.tag, 'b') || contains(steps.vars.outputs.tag, 'rc')))
run: doit package_upload --token=$CONDA_UPLOAD_TOKEN --label=dev
if: contains(env.TAG, 'a') || contains(env.TAG, 'b') || contains(env.TAG, 'rc')
run: |
anaconda --token ${{ secrets.CONDA_UPLOAD_TOKEN }} upload --user pyviz --label=dev $CONDA_FILE
- name: conda main upload
if: (github.event_name == 'push' && !(contains(steps.vars.outputs.tag, 'a') || contains(steps.vars.outputs.tag, 'b') || contains(steps.vars.outputs.tag, 'rc')))
run: doit package_upload --token=$CONDA_UPLOAD_TOKEN --label=dev --label=main
if: (!(contains(env.TAG, 'a') || contains(env.TAG, 'b') || contains(env.TAG, 'rc')))
run: |
anaconda --token ${{ secrets.CONDA_UPLOAD_TOKEN }} upload --user pyviz --label=dev --label=main $CONDA_FILE

pip_build:
name: Build PyPI Packages
runs-on: 'ubuntu-latest'
defaults:
run:
shell: bash -l {0}
env:
CHANS_DEV: "-c pyviz/label/dev -c conda-forge"
PKG_TEST_PYTHON: "--test-python=py39"
PYTHON_VERSION: "3.9"
CHANS: "-c pyviz"
PPU: ${{ secrets.PPU }}
PPP: ${{ secrets.PPP }}
PYPI: "https://upload.pypi.org/legacy/"
name: Build PyPI
needs: [pixi_lock]
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v3
- name: Fetch unshallow
run: git fetch --prune --tags --unshallow -f
- uses: conda-incubator/setup-miniconda@v2
- uses: holoviz-dev/holoviz_tasks/pixi_install@pixi
with:
miniconda-version: "latest"
- name: conda setup
run: |
conda config --set always_yes True
conda install -c pyviz "pyctdev>=0.5"
doit ecosystem_setup
doit env_create $CHANS_DEV --python=$PYTHON_VERSION
- name: env setup
run: |
conda activate test-environment
doit develop_install $CHANS_DEV -o tests
doit pip_on_conda
- name: pip build
run: |
conda activate test-environment
doit ecosystem=pip package_build $PKG_TEST_PYTHON --no-pkg-test
- name: pip upload
if: github.event_name == 'push'
run: |
conda activate test-environment
doit ecosystem=pip package_upload -u $PPU -p $PPP -r $PYPI
environments: "build"
download-data: false
install: false
- name: Build package
run: pixi run -e build build-pip
- uses: actions/upload-artifact@v4
if: always()
with:
name: pip
path: dist/
if-no-files-found: error

pip_install:
name: Install PyPI
runs-on: "ubuntu-latest"
needs: [pip_build]
steps:
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: actions/download-artifact@v4
with:
name: pip
path: dist/
- name: Install package
run: python -m pip install dist/*.whl
- name: Import package
run: python -c "import $PACKAGE; print($PACKAGE.__version__)"

pip_publish:
name: Publish PyPI
runs-on: ubuntu-latest
needs: [pip_build, waiting_room]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v4
with:
name: pip
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: ${{ secrets.PPU }}
password: ${{ secrets.PPP }}
repository-url: "https://upload.pypi.org/legacy/"
25 changes: 25 additions & 0 deletions .github/workflows/nightly_lock.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: nightly_lock
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"

env:
PACKAGE: "spatialpandas"

jobs:
pixi_lock:
name: Pixi lock
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: holoviz-dev/holoviz_tasks/pixi_lock@pixi
- name: Upload lock-file to S3
if: "!github.event.pull_request.head.repo.fork"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: "eu-west-1"
run: |
zip $(date +%Y-%m-%d).zip pixi.lock pixi.toml
aws s3 cp ./$(date +%Y-%m-%d).zip s3://assets.holoviz.org/lock/$PACKAGE/
Loading
Loading