Skip to content

Commit 9a75298

Browse files
authored
Simplify dev tooling, remove colorcet examples, drop 3.7, add 3.12 (#120)
* use mostly pip on the CI * remove colorcet examples cmd * move to pyproject * improve git archive * remove unused manifest * simplify building the docs * update dev instructions * drop 3.7 and try all python versions * simplify version definition
1 parent 34b3992 commit 9a75298

45 files changed

Lines changed: 306 additions & 1296 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.flake8

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[flake8]
2+
include = *.py
3+
exclude = .git,__pycache__,.tox,.eggs,*.egg,doc,dist,build,_build,.ipynb_checkpoints,run_test.py
4+
ignore = E,
5+
W

.git_archival.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node: $Format:%H$
2+
node-date: $Format:%cI$
3+
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
4+
ref-names: $Format:%D$

.gitattributes

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
colorcet/__init__.py export-subst
2-
setup.cfg export-subst
1+
# For setuptools_scm with .git_archival.txt
2+
.git_archival.txt export-subst
3+
# Line Endings configuration file for Git
4+
# Set the default behavior, in case people don't have or can't have core.autocrlf set.
5+
* text=auto

.github/workflows/build.yaml

Lines changed: 27 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -19,92 +19,57 @@ jobs:
1919
defaults:
2020
run:
2121
shell: bash -l {0}
22-
env:
23-
CHANS: "-c pyviz -c bokeh"
24-
PKG_TEST_PYTHON: "--test-python=py37"
25-
PYTHON_VERSION: "3.7"
26-
MPLBACKEND: "Agg"
27-
CONDA_UPLOAD_TOKEN: ${{ secrets.CONDA_UPLOAD_TOKEN }}
2822
steps:
29-
- uses: actions/checkout@v3
30-
with:
31-
fetch-depth: "100"
32-
- uses: actions/setup-python@v4
33-
with:
34-
python-version: ${{ matrix.python-version }}
23+
- uses: actions/checkout@v4
24+
- name: Fetch unshallow
25+
run: git fetch --prune --tags --unshallow -f
3526
- uses: conda-incubator/setup-miniconda@v2
3627
with:
3728
miniconda-version: "latest"
38-
python-version: ${{ env.PYTHON_VERSION }}
39-
- name: Fetch
40-
run: git fetch --prune --tags -f
29+
python-version: "3.11"
30+
auto-update-conda: true
4131
- name: Set output
4232
id: vars
4333
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
4434
- name: conda setup
4535
run: |
46-
conda config --set always_yes True
47-
conda install -c pyviz "pyctdev>=0.5"
48-
doit ecosystem_setup
36+
conda install anaconda-client conda-build setuptools_scm
4937
- name: conda build
50-
run: doit package_build $CHANS $PKG_TEST_PYTHON --test-group=unit
38+
run: |
39+
VERSION=`python -m setuptools_scm` conda build conda.recipe/
5140
- name: conda dev upload
5241
if: (github.event_name == 'push' && (contains(steps.vars.outputs.tag, 'a') || contains(steps.vars.outputs.tag, 'b') || contains(steps.vars.outputs.tag, 'rc')))
53-
run: doit package_upload --token=$CONDA_UPLOAD_TOKEN --label=dev
42+
run: |
43+
anaconda --token ${{ secrets.CONDA_UPLOAD_TOKEN }} upload --user pyviz --label=dev $(VERSION=`python -m setuptools_scm` conda build --output conda.recipe)
5444
- name: conda main upload
5545
if: (github.event_name == 'push' && !(contains(steps.vars.outputs.tag, 'a') || contains(steps.vars.outputs.tag, 'b') || contains(steps.vars.outputs.tag, 'rc')))
56-
run: doit package_upload --token=$CONDA_UPLOAD_TOKEN --label=dev --label=main
46+
run: |
47+
anaconda --token ${{ secrets.CONDA_UPLOAD_TOKEN }} upload --user pyviz --label=dev --label=main $(VERSION=`python -m setuptools_scm` conda build --output conda.recipe)
5748
pip_build:
5849
name: Build PyPI Packages
5950
runs-on: 'ubuntu-latest'
6051
defaults:
6152
run:
6253
shell: bash -l {0}
63-
env:
64-
CHANS: "-c pyviz -c bokeh"
65-
PKG_TEST_PYTHON: "--test-python=py37"
66-
PYTHON_VERSION: "3.7"
67-
MPLBACKEND: "Agg"
68-
PPU: ${{ secrets.PPU }}
69-
PPP: ${{ secrets.PPP }}
70-
PYPI: "https://upload.pypi.org/legacy/"
7154
steps:
72-
- uses: actions/checkout@v3
73-
with:
74-
fetch-depth: "100"
75-
- uses: actions/setup-python@v4
76-
with:
77-
python-version: ${{ matrix.python-version }}
78-
- uses: conda-incubator/setup-miniconda@v2
55+
- uses: actions/checkout@v4
56+
- name: Fetch unshallow
57+
run: git fetch --prune --tags --unshallow -f
58+
- name: Set up Python
59+
uses: actions/setup-python@v5
7960
with:
80-
miniconda-version: "latest"
81-
python-version: ${{ env.PYTHON_VERSION }}
82-
- name: Fetch
83-
run: git fetch --prune --tags -f
84-
- name: conda setup
85-
run: |
86-
conda config --set always_yes True
87-
conda install -c pyviz "pyctdev>=0.5"
88-
doit ecosystem_setup
89-
doit env_create $CHANS --python=$PYTHON_VERSION
61+
python-version: "3.11"
9062
- name: env setup
9163
run: |
92-
eval "$(conda shell.bash hook)"
93-
conda activate test-environment
94-
doit develop_install $CHANS_DEV -o unit_tests
95-
doit pip_on_conda
96-
- name: doit env_capture
97-
run: |
98-
conda activate test-environment
99-
doit env_capture
64+
python -m pip install --upgrade pip
65+
python -m pip install build
10066
- name: pip build
10167
run: |
102-
eval "$(conda shell.bash hook)"
103-
conda activate test-environment
104-
doit ecosystem=pip package_build
105-
- name: pip upload
68+
python -m build
69+
- name: Publish package to PyPI
10670
if: github.event_name == 'push'
107-
run: |
108-
eval "$(conda shell.bash hook)"
109-
conda activate test-environment
110-
doit ecosystem=pip package_upload -u $PPU -p $PPP -r $PYPI
71+
uses: pypa/gh-action-pypi-publish@release/v1
72+
with:
73+
user: ${{ secrets.PPU }}
74+
password: ${{ secrets.PPP }}
75+
packages-dir: dist/

.github/workflows/docs.yaml

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -31,42 +31,25 @@ jobs:
3131
run:
3232
shell: bash -l {0}
3333
env:
34-
DESC: "Documentation build"
3534
MPLBACKEND: "Agg"
3635
DISPLAY: ":99.0"
37-
PYTHON_DOCS_VERSION: "3.9"
3836
steps:
39-
- uses: actions/checkout@v3
37+
- uses: actions/checkout@v4
4038
with:
4139
fetch-depth: "100"
42-
- uses: conda-incubator/setup-miniconda@v2
43-
with:
44-
miniconda-version: "latest"
4540
- name: Fetch
4641
run: git fetch --prune --tags -f
4742
- name: Set output
4843
id: vars
4944
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
50-
- name: conda setup
51-
# conda-forge is required to install pydata-sphinx-theme and sphinx-copybutton.
52-
run: |
53-
conda create -n test-environment
54-
conda activate test-environment
55-
conda config --env --append channels pyviz/label/dev --append channels conda-forge
56-
conda config --env --remove channels defaults
57-
conda install python=${{ env.PYTHON_DOCS_VERSION}} pyctdev
58-
- name: doit develop_install
59-
run: |
60-
conda activate test-environment
61-
doit develop_install -o doc -o examples
62-
- name: doit env_capture
63-
run: |
64-
conda activate test-environment
65-
doit env_capture
45+
- name: Set up Python
46+
uses: actions/setup-python@v5
47+
with:
48+
python-version: '3.11'
49+
- name: install
50+
run: pip install ."[doc, examples]"
6651
- name: build docs
67-
run: |
68-
conda activate test-environment
69-
doit build_website
52+
run: sphinx-build -b html doc builtdocs
7053
- name: git status
7154
run: |
7255
git status

.github/workflows/test.yaml

Lines changed: 27 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -16,71 +16,51 @@ concurrency:
1616
cancel-in-progress: true
1717

1818
jobs:
19+
pre_commit:
20+
name: Run pre-commit
21+
runs-on: 'ubuntu-latest'
22+
steps:
23+
- uses: holoviz-dev/holoviz_tasks/[email protected]
1924
test_suite:
2025
name: Pytest on ${{ matrix.python-version }}, ${{ matrix.os }}
26+
needs: [pre_commit]
2127
runs-on: ${{ matrix.os }}
2228
strategy:
2329
fail-fast: false
2430
matrix:
2531
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
2632
# Run on the full set on schedule, workflow_dispatch and push&tags events, otherwise on a subset.
27-
python-version: ${{ ( github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || ( github.event_name == 'push' && github.ref_type == 'tag' ) ) && fromJSON('["3.7", "3.8", "3.9", "3.10", "3.11"]') || fromJSON('["3.7", "3.11"]') }}
33+
# python-version: ${{ ( github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || ( github.event_name == 'push' && github.ref_type == 'tag' ) ) && fromJSON('["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]') || fromJSON('["3.7", "3.12"]') }}
34+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
2835
timeout-minutes: 60
2936
defaults:
3037
run:
31-
shell: bash -l {0}
38+
shell: bash -l {0}
3239
env:
33-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34-
ENV_NAME: "colorcet"
3540
MPLBACKEND: "Agg"
3641
DISPLAY: ":99.0"
3742
steps:
38-
- uses: actions/checkout@v3
43+
- uses: actions/checkout@v4
3944
with:
4045
fetch-depth: "100"
41-
- uses: conda-incubator/setup-miniconda@v2
42-
with:
43-
miniconda-version: "latest"
4446
- name: Fetch
4547
run: git fetch --prune --tags -f
46-
- name: conda setup
47-
run: |
48-
conda update -n base conda
49-
conda create -n ${{ env.ENV_NAME }}
50-
conda activate ${{ env.ENV_NAME }}
51-
conda config --env --prepend channels pyviz/label/dev
52-
conda config --env --show-sources
53-
conda install python=${{ matrix.python-version }} pyctdev
54-
- name: doit develop_install
55-
run: |
56-
conda activate ${{ env.ENV_NAME }}
57-
doit develop_install -o tests -o examples
58-
- name: pin bokeh on Python 3.8
59-
if: matrix.python-version == '3.8'
60-
# Pin to avoid pulling an old version of Bokeh and Panel.
61-
run: |
62-
conda activate ${{ env.ENV_NAME }}
63-
conda install "bokeh >=3"
64-
- name: doit env_capture
65-
run: |
66-
conda activate ${{ env.ENV_NAME }}
67-
doit env_capture
68-
- name: doit test_lint
69-
run: |
70-
conda activate ${{ env.ENV_NAME }}
71-
doit test_lint
72-
- name: doit test_unit
73-
run: |
74-
conda activate ${{ env.ENV_NAME }}
75-
doit test_unit
76-
- name: doit test_examples
77-
run: |
78-
conda activate ${{ env.ENV_NAME }}
79-
doit test_examples
48+
- name: Set up Python ${{ matrix.python-version }}
49+
uses: actions/setup-python@v5
50+
with:
51+
python-version: ${{ matrix.python-version }}
52+
allow-prereleases: true
53+
- name: pip update
54+
run: pip install --upgrade pip
55+
- name: install
56+
run: pip install -e ."[tests,tests_examples,tests_extra]"
57+
- name: pip list
58+
run: pip list
59+
- name: unit tests
60+
run: pytest colorcet --cov=colorcet --cov-append --cov-report xml
61+
- name: examples tests
62+
run: pytest doc --nbval-lax -p no:python
8063
- name: doit test_unit_extra
81-
run: |
82-
conda activate ${{ env.ENV_NAME }}
83-
pip install pytest-mpl
84-
doit test_unit_extra
85-
- uses: codecov/codecov-action@v3
64+
run: pytest colorcet --mpl
65+
- uses: codecov/codecov-action@v4
8666
if: github.event_name == 'push'

.gitignore

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,23 @@ coverage.xml
1818
__pycache__
1919
.doit*
2020
*.egg-info
21-
*/.version
2221
pip-wheel-metadata
2322
**.ipynb_checkpoints
2423
/build
24+
dist/
25+
.venv/
26+
venv/
2527

2628
# nbsite
2729
# these files normally shouldn't be checked in as they should be
2830
# dynamically built from notebooks
29-
doc/**/*.rst
30-
doc/**/*.ipynb
31-
doc/**/*.json
3231
# this dir contains the whole website and should not be checked in on main
3332
builtdocs/
3433
# myst-nb output dir
3534
jupyter_execute/
3635

3736
# CET_updates.py is an intermediate file and should not be versioned.
3837
assets/CET_updates.py
38+
39+
# setuptools_scm
40+
colorcet/_version.py

.pre-commit-config.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# This is the configuration for pre-commit, a local framework for managing pre-commit hooks
2+
# Check out the docs at: https://pre-commit.com/
3+
4+
default_stages: [commit]
5+
6+
# Exclude Matlab files
7+
exclude: '.+\.m$'
8+
9+
repos:
10+
- repo: https://github.com/nbQA-dev/nbQA
11+
rev: 1.7.1
12+
hooks:
13+
- id: nbqa-flake8
14+
- repo: https://github.com/pre-commit/pre-commit-hooks
15+
rev: v4.5.0
16+
hooks:
17+
- id: check-builtin-literals
18+
- id: check-case-conflict
19+
- id: check-docstring-first
20+
- id: check-executables-have-shebangs
21+
- id: check-toml
22+
- id: detect-private-key
23+
- id: end-of-file-fixer
24+
exclude: (\.min\.js$|\.svg$)
25+
- id: trailing-whitespace
26+
- repo: https://github.com/PyCQA/flake8
27+
rev: 7.0.0
28+
hooks:
29+
- id: flake8 # See 'setup.cfg' for args
30+
args: [colorcet]
31+
files: colorcet/
32+
- repo: https://github.com/hoxbro/clean_notebook
33+
rev: v0.1.15a2
34+
hooks:
35+
- id: clean-notebook

MANIFEST.in

Lines changed: 0 additions & 8 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ by Peter Kovesi at the Center for Exploration Targeting.
2828

2929
## Installation
3030

31-
Colorcet supports Python 3.7, 3.8, 3.9, 3.10 and 3.11 on Linux, Windows, or Mac
31+
Colorcet supports Python 3.7 and greater on Linux, Windows, or Mac
3232
and can be installed with conda:
3333

3434
```sh
@@ -41,16 +41,6 @@ or with pip:
4141
python -m pip install colorcet
4242
```
4343

44-
Once installed you can copy the examples into the current directory using the colorcet command and run them using the Jupyter notebook:
45-
46-
```sh
47-
colorcet examples
48-
cd colorcet-examples
49-
jupyter notebook
50-
```
51-
52-
(Here colorcet examples is a shorthand for colorcet copy-examples --path colorcet-examples && colorcet fetch-data --path colorcet-examples.)
53-
5444
To work with JupyterLab you will also need the PyViz JupyterLab extension:
5545

5646
```sh

0 commit comments

Comments
 (0)