Skip to content

Commit 9321159

Browse files
authored
General maintenance (#1320)
1 parent 7261610 commit 9321159

5 files changed

Lines changed: 151 additions & 103 deletions

File tree

.github/workflows/build.yaml

Lines changed: 119 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -2,113 +2,146 @@ name: packages
22
on:
33
push:
44
tags:
5-
- 'v[0-9]+.[0-9]+.[0-9]+'
6-
- 'v[0-9]+.[0-9]+.[0-9]+a[0-9]+'
7-
- 'v[0-9]+.[0-9]+.[0-9]+b[0-9]+'
8-
- 'v[0-9]+.[0-9]+.[0-9]+rc[0-9]+'
5+
- "v[0-9]+.[0-9]+.[0-9]+"
6+
- "v[0-9]+.[0-9]+.[0-9]+a[0-9]+"
7+
- "v[0-9]+.[0-9]+.[0-9]+b[0-9]+"
8+
- "v[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
99
# Dry-run only
1010
workflow_dispatch:
1111
schedule:
12-
- cron: '0 16 * * SUN'
12+
- cron: "0 16 * * SUN"
13+
14+
defaults:
15+
run:
16+
shell: bash -l {0}
17+
18+
env:
19+
PYTHON_VERSION: "3.11"
20+
PACKAGE: "datashader"
21+
MPLBACKEND: "Agg"
22+
DASK_DATAFRAME__QUERY_PLANNING: false
1323

1424
jobs:
25+
waiting_room:
26+
name: Waiting Room
27+
runs-on: ubuntu-latest
28+
needs: [conda_build, pip_install]
29+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
30+
environment:
31+
name: publish
32+
steps:
33+
- run: echo "All builds have finished, have been approved, and ready to publish"
34+
1535
conda_build:
16-
name: Build Conda Packages
17-
runs-on: 'ubuntu-latest'
18-
timeout-minutes: 60
19-
defaults:
20-
run:
21-
shell: bash -l {0}
22-
env:
23-
PKG_TEST_PYTHON: "--test-python=py39"
24-
MPLBACKEND: "Agg"
25-
CONDA_UPLOAD_TOKEN: ${{ secrets.CONDA_UPLOAD_TOKEN }}
36+
name: Build Conda
37+
runs-on: "ubuntu-latest"
2638
steps:
27-
- uses: actions/checkout@v3
39+
- uses: actions/checkout@v4
2840
with:
2941
fetch-depth: "100"
30-
- uses: conda-incubator/setup-miniconda@v2
31-
with:
32-
miniconda-version: "latest"
33-
python-version: 3.9
34-
channels: pyviz/label/dev,conda-forge,nodefaults
3542
- name: Fetch unshallow
3643
run: git fetch --prune --tags --unshallow -f
37-
- name: Set output
38-
id: vars
39-
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
44+
- uses: conda-incubator/setup-miniconda@v3
45+
with:
46+
miniconda-version: "latest"
4047
- name: conda setup
4148
run: |
42-
conda install "pyctdev>=0.5"
43-
doit ecosystem_setup
44-
# FIXME: downgrade urllib3 until this issue is fixed:
45-
# https://github.com/Anaconda-Platform/anaconda-client/issues/654
46-
conda install -c conda-forge "urllib3<2.0.0"
47-
- name: doit env_capture
48-
run: |
49-
doit env_capture
49+
# pyct is for running setup.py
50+
conda install -y conda-build build pyct -c pyviz/label/dev
5051
- name: conda build
51-
run: doit package_build $PKG_TEST_PYTHON --no-pkg-tests
52-
- name: dev deploy
53-
if: (github.event_name == 'push' && (contains(steps.vars.outputs.tag, 'a') || contains(steps.vars.outputs.tag, 'b') || contains(steps.vars.outputs.tag, 'rc')))
5452
run: |
55-
doit package_upload --token=$CONDA_UPLOAD_TOKEN --label=dev
56-
- name: main deploy
57-
if: (github.event_name == 'push' && !(contains(steps.vars.outputs.tag, 'a') || contains(steps.vars.outputs.tag, 'b') || contains(steps.vars.outputs.tag, 'rc')))
58-
run: |
59-
doit package_upload --token=$CONDA_UPLOAD_TOKEN --label=dev --label=main
60-
pip_build:
61-
name: Build PyPI Packages
62-
runs-on: 'ubuntu-latest'
63-
timeout-minutes: 120
64-
defaults:
65-
run:
66-
shell: bash -l {0}
67-
env:
68-
PKG_TEST_PYTHON: "--test-python=py39"
69-
PYTHON_VERSION: "3.9"
70-
MPLBACKEND: "Agg"
71-
PPU: ${{ secrets.PPU }}
72-
PPP: ${{ secrets.PPP }}
73-
PYPI: "https://upload.pypi.org/legacy/"
74-
MAMBA_NO_BANNER: 1
53+
source ./scripts/conda/build.sh
54+
echo "CONDA_FILE="$CONDA_PREFIX/conda-bld/noarch/$PACKAGE-$VERSION-py_0.tar.bz2"" >> $GITHUB_ENV
55+
- uses: actions/upload-artifact@v4
56+
if: always()
57+
with:
58+
name: conda
59+
path: ${{ env.CONDA_FILE }}
60+
if-no-files-found: error
61+
62+
conda_publish:
63+
name: Publish Conda
64+
runs-on: ubuntu-latest
65+
needs: [conda_build, waiting_room]
66+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
7567
steps:
76-
- uses: actions/checkout@v3
68+
- uses: actions/download-artifact@v4
7769
with:
78-
fetch-depth: "100"
79-
- uses: conda-incubator/setup-miniconda@v2
70+
name: conda
71+
path: dist/
72+
- name: Set environment variables
73+
run: |
74+
echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
75+
echo "CONDA_FILE=$(ls dist/*.tar.bz2)" >> $GITHUB_ENV
76+
- uses: conda-incubator/setup-miniconda@v3
8077
with:
81-
channel-priority: strict
8278
miniconda-version: "latest"
83-
channels: pyviz/label/dev,conda-forge,nodefaults
84-
mamba-version: "*"
85-
- name: Fetch unshallow
86-
run: git fetch --prune --tags --unshallow -f
8779
- name: conda setup
8880
run: |
89-
conda install "pyctdev>=0.5"
90-
doit ecosystem_setup
91-
conda create -n test-environment python=$PYTHON_VERSION pyctdev
92-
- name: env setup
93-
run: |
94-
eval "$(conda shell.bash hook)"
95-
conda activate test-environment
96-
doit develop_install -o tests --conda-mode=mamba
97-
pip uninstall -y datashader
98-
doit pip_on_conda
99-
- name: doit env_capture
81+
conda install -y anaconda-client
82+
- name: conda dev upload
83+
if: contains(env.TAG, 'a') || contains(env.TAG, 'b') || contains(env.TAG, 'rc')
10084
run: |
101-
eval "$(conda shell.bash hook)"
102-
conda activate test-environment
103-
doit env_capture
104-
- name: pip build
85+
anaconda --token ${{ secrets.CONDA_UPLOAD_TOKEN }} upload --user pyviz --label=dev $CONDA_FILE
86+
- name: conda main upload
87+
if: (!(contains(env.TAG, 'a') || contains(env.TAG, 'b') || contains(env.TAG, 'rc')))
10588
run: |
106-
eval "$(conda shell.bash hook)"
107-
conda activate test-environment
108-
doit ecosystem=pip package_build $PKG_TEST_PYTHON --test-group=unit
109-
- name: pip upload
110-
if: github.event_name == 'push'
89+
anaconda --token ${{ secrets.CONDA_UPLOAD_TOKEN }} upload --user pyviz --label=dev --label=main $CONDA_FILE
90+
91+
pip_build:
92+
name: Build PyPI
93+
runs-on: "ubuntu-latest"
94+
steps:
95+
- uses: actions/checkout@v4
96+
with:
97+
fetch-depth: "100"
98+
- name: Fetch unshallow
99+
run: git fetch --prune --tags --unshallow -f
100+
- uses: actions/setup-python@v5
101+
with:
102+
python-version: ${{ env.PYTHON_VERSION }}
103+
- name: Install build
111104
run: |
112-
eval "$(conda shell.bash hook)"
113-
conda activate test-environment
114-
doit ecosystem=pip package_upload -u $PPU -p $PPP -r $PYPI
105+
python -m pip install build
106+
- name: Build package
107+
run: python -m build .
108+
- uses: actions/upload-artifact@v4
109+
if: always()
110+
with:
111+
name: pip
112+
path: dist/
113+
if-no-files-found: error
114+
115+
pip_install:
116+
name: Install PyPI
117+
runs-on: "ubuntu-latest"
118+
needs: [pip_build]
119+
steps:
120+
- uses: actions/setup-python@v5
121+
with:
122+
python-version: ${{ env.PYTHON_VERSION }}
123+
- uses: actions/download-artifact@v4
124+
with:
125+
name: pip
126+
path: dist/
127+
- name: Install package
128+
run: python -m pip install dist/*.whl
129+
- name: Test package
130+
run: python -c "import $PACKAGE; print($PACKAGE.__version__)"
131+
132+
pip_publish:
133+
name: Publish PyPI
134+
runs-on: ubuntu-latest
135+
needs: [pip_build, waiting_room]
136+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
137+
steps:
138+
- uses: actions/download-artifact@v4
139+
with:
140+
name: pip
141+
path: dist/
142+
- name: Publish to PyPI
143+
uses: pypa/gh-action-pypi-publish@release/v1
144+
with:
145+
user: ${{ secrets.PPU }}
146+
password: ${{ secrets.PPP }}
147+
repository-url: "https://upload.pypi.org/legacy/"

.github/workflows/docs.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
shell: bash -l {0}
3131
env:
3232
DESC: "Documentation build"
33+
DASK_DATAFRAME__QUERY_PLANNING: false
3334
steps:
3435
- uses: holoviz-dev/holoviz_tasks/install@v0
3536
with:

.pre-commit-config.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ exclude: (\.(js|svg)$)
22

33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.5.0
5+
rev: v4.6.0
66
hooks:
77
- id: check-builtin-literals
88
- id: check-case-conflict
@@ -13,18 +13,18 @@ repos:
1313
- id: end-of-file-fixer
1414
- id: trailing-whitespace
1515
- repo: https://github.com/astral-sh/ruff-pre-commit
16-
rev: v0.0.292
16+
rev: v0.3.5
1717
hooks:
1818
- id: ruff
1919
files: datashader/
2020
- repo: https://github.com/codespell-project/codespell
2121
rev: v2.2.6
2222
hooks:
23-
- id: codespell
24-
additional_dependencies:
25-
- tomli
23+
- id: codespell
24+
additional_dependencies:
25+
- tomli
2626
- repo: https://github.com/hoxbro/clean_notebook
27-
rev: v0.1.13
27+
rev: v0.1.14
2828
hooks:
2929
- id: clean-notebook
3030

scripts/conda/build.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
set -euxo pipefail
4+
5+
git status
6+
7+
python -m build -w .
8+
9+
git diff --exit-code
10+
11+
VERSION=$(find dist -name "*.whl" -exec basename {} \; | cut -d- -f2)
12+
export VERSION
13+
14+
# Note: pyct is needed in the same environment as conda-build!
15+
conda build scripts/conda/recipe --no-anaconda-upload --no-verify
Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
{% set sdata = load_setup_py_data() %}
1+
{% set sdata = load_setup_py_data(setup_file="../../../setup.py", from_recipe_dir=True) %}
2+
{% set pyproject = load_file_data('../../../pyproject.toml', from_recipe_dir=True) %}
23

34
package:
4-
name: datashader
5-
version: {{ sdata['version'] }}
5+
name: {{ sdata['name'] }}
6+
version: {{ VERSION }}
67

78
source:
8-
path: ..
9+
url: ../../../dist/{{ sdata['name'] }}-{{ VERSION }}-py2.py3-none-any.whl
910

1011
build:
1112
noarch: python
12-
script: python setup.py install --single-version-externally-managed --record=record.txt
13+
script: {{ PYTHON }} -m pip install -vv {{ sdata['name'] }}-{{ VERSION }}-py2.py3-none-any.whl
1314
entry_points:
1415
{% for group,epoints in sdata.get("entry_points",{}).items() %}
1516
{% for entry_point in epoints %}
@@ -18,18 +19,16 @@ build:
1819
{% endfor %}
1920

2021
requirements:
21-
build:
22+
host:
2223
- python {{ sdata['python_requires'] }}
23-
- param >=1.7.0
24-
- pyct-core >=0.4.4
25-
- setuptools >30.3.0
24+
{% for dep in pyproject['build-system']['requires'] %}
25+
- {{ dep }}
26+
{% endfor %}
2627
run:
2728
- python {{ sdata['python_requires'] }}
2829
{% for dep in sdata.get('install_requires',{}) %}
2930
- {{ dep if dep != 'dask' else 'dask-core'}}
3031
{% endfor %}
31-
# adding pyct here is temporary (this conda recipe template will disappear when new pyctdev is released)
32-
- pyct
3332
run_constrained:
3433
- cudf >=0.10.0
3534
test:

0 commit comments

Comments
 (0)