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

Switch to Pixi for development / CI and hatchling for build system #6182

Merged
merged 94 commits into from
Apr 19, 2024

Conversation

hoxbro
Copy link
Member

@hoxbro hoxbro commented Apr 10, 2024

Just for playing around with it.

Task issue: holoviz-dev/holoviz_tasks#34

TODO (non-exhaustive)

  • Figure out how tsdownsample can only be added to certain arch
  • Add developer documentation (http://dev.holoviews.org/developer_guide/index.html)
  • Remove the hatch_build.py script, as I was trying things out. (Is needed for Panel)
  • Add comments and describe what has been done in this PR.
  • If we should use pixi.toml or put it into pyproject.toml (no strong opinions)
    • For now, let's keep them separated.
  • Figure out how to use editable as it currently solves each time you run pixi run or pixi shell
    • I have decided to have an install command. Which needs to be run if you like to editable install. It seems like pixi will likely support triggers like post-install which makes sense for this.
  • Why sdist is needed when building conda build - is because of Unable to install from sdist using force-include with hatchling>=1.19 pypa/hatch#1305.

A rough sketch of how I see things (aka. not something set in stone)
image

Current output of pixi info:

pixi info
      Pixi version: 0.19.1
          Platform: linux-64
  Virtual packages: __unix=0=0
                  : __linux=6.8.0=0
                  : __glibc=2.35=0
                  : __cuda=12.4=0
                  : __archspec=1=zen3
         Cache dir: /home/shh/.cache/rattler/cache
      Auth storage: /home/shh/.rattler/credentials.json

Project
------------
     Manifest file: /home/shh/projects/holoviz/repos/holoviews/pixi.toml
  Config locations: /home/shh/.config/pixi/config.toml, /home/shh/.config/pixi/config.toml
      Last updated: 18-04-2024 18:43:38

Environments
------------
       Environment: default
          Features: default
          Channels: conda-forge, pyviz/label/dev
  Dependency count: 13
      Dependencies: python, pip, param, panel, pyviz_comms, colorcet, numpy, packaging, pandas, ipython, notebook, matplotlib-base, bokeh
  Target platforms: win-64, linux-64, osx-arm64, osx-64
             Tasks: check-latest-packages, download-data, install

       Environment: test-39
          Features: py39, test-core, test, example, test-example, test-unit-task, default
          Channels: conda-forge, pyviz/label/dev
  Dependency count: 41
      Dependencies: python, pytest, pytest-cov, pytest-github-actions-annotate-failures, pytest-rerunfailures, nbconvert, pillow, plotly, contourpy, dask-core, ibis-sqlite, xarray, networkx, shapely, ffmpeg, cftime, scipy, selenium, spatialpandas, datashader, xyzservices, tsdownsample, streamz, netcdf4, scikit-image, pyarrow, pooch, notebook, nbval, pytest-xdist, pip, param, panel, pyviz_comms, colorcet, numpy, packaging, pandas, ipython, matplotlib-base, bokeh
  Target platforms: osx-64, win-64, linux-64, osx-arm64
             Tasks: download-data, check-latest-packages, test-unit, install, test-example

       Environment: test-310
          Features: py310, test-core, test, example, test-example, test-unit-task, default
          Channels: conda-forge, pyviz/label/dev
  Dependency count: 41
      Dependencies: python, pytest, pytest-cov, pytest-github-actions-annotate-failures, pytest-rerunfailures, nbconvert, pillow, plotly, contourpy, dask-core, ibis-sqlite, xarray, networkx, shapely, ffmpeg, cftime, scipy, selenium, spatialpandas, datashader, xyzservices, tsdownsample, streamz, netcdf4, scikit-image, pyarrow, pooch, notebook, nbval, pytest-xdist, pip, param, panel, pyviz_comms, colorcet, numpy, packaging, pandas, ipython, matplotlib-base, bokeh
  Target platforms: osx-64, win-64, linux-64, osx-arm64
             Tasks: check-latest-packages, test-unit, test-example, download-data, install

       Environment: test-311
          Features: py311, test-core, test, example, test-example, test-unit-task, default
          Channels: conda-forge, pyviz/label/dev
  Dependency count: 41
      Dependencies: python, pytest, pytest-cov, pytest-github-actions-annotate-failures, pytest-rerunfailures, nbconvert, pillow, plotly, contourpy, dask-core, ibis-sqlite, xarray, networkx, shapely, ffmpeg, cftime, scipy, selenium, spatialpandas, datashader, xyzservices, tsdownsample, streamz, netcdf4, scikit-image, pyarrow, pooch, notebook, nbval, pytest-xdist, pip, param, panel, pyviz_comms, colorcet, numpy, packaging, pandas, ipython, matplotlib-base, bokeh
  Target platforms: osx-arm64, linux-64, osx-64, win-64
             Tasks: check-latest-packages, test-example, test-unit, install, download-data

       Environment: test-312
          Features: py312, test-core, test, example, test-example, test-unit-task, default
          Channels: conda-forge, pyviz/label/dev
  Dependency count: 41
      Dependencies: python, pytest, pytest-cov, pytest-github-actions-annotate-failures, pytest-rerunfailures, nbconvert, pillow, plotly, contourpy, dask-core, ibis-sqlite, xarray, networkx, shapely, ffmpeg, cftime, scipy, selenium, spatialpandas, datashader, xyzservices, tsdownsample, streamz, netcdf4, scikit-image, pyarrow, pooch, notebook, nbval, pytest-xdist, pip, param, panel, pyviz_comms, colorcet, numpy, packaging, pandas, ipython, matplotlib-base, bokeh
  Target platforms: osx-64, win-64, osx-arm64, linux-64
             Tasks: install, download-data, check-latest-packages, test-example, test-unit

       Environment: test-ui
          Features: py312, test-core, test, test-ui, default
          Channels: conda-forge, pyviz/label/dev, microsoft
  Dependency count: 36
      Dependencies: python, pytest, pytest-cov, pytest-github-actions-annotate-failures, pytest-rerunfailures, nbconvert, pillow, plotly, contourpy, dask-core, ibis-sqlite, xarray, networkx, shapely, ffmpeg, cftime, scipy, selenium, spatialpandas, datashader, xyzservices, tsdownsample, playwright, pytest-playwright, pip, param, panel, pyviz_comms, colorcet, numpy, packaging, pandas, ipython, notebook, matplotlib-base, bokeh
  Target platforms: osx-arm64, osx-64, win-64, linux-64
             Tasks: check-latest-packages, test-ui, download-data, install-ui, install

       Environment: test-core
          Features: py312, test-core, test-unit-task, default
          Channels: conda-forge, pyviz/label/dev
  Dependency count: 21
      Dependencies: python, pytest, pytest-cov, pytest-github-actions-annotate-failures, pytest-rerunfailures, nbconvert, pillow, plotly, contourpy, pip, param, panel, pyviz_comms, colorcet, numpy, packaging, pandas, ipython, notebook, matplotlib-base, bokeh
  Target platforms: win-64, osx-arm64, linux-64, osx-64
             Tasks: download-data, check-latest-packages, install, test-unit

       Environment: docs
          Features: py311, example, doc, default
          Channels: conda-forge, pyviz/label/dev
  Dependency count: 31
      Dependencies: python, networkx, pillow, xarray, plotly, streamz, ffmpeg, cftime, netcdf4, dask-core, scipy, shapely, scikit-image, pyarrow, pooch, datashader, notebook, nbsite, graphviz, selenium, pip, param, panel, pyviz_comms, colorcet, numpy, packaging, pandas, ipython, matplotlib-base, bokeh
  Target platforms: osx-64, linux-64, osx-arm64, win-64
             Tasks: docs-build, check-latest-packages, install, docs-refmanual, download-data, docs-generate-rst, docs-generate

       Environment: build
          Features: py311, build, default
          Channels: conda-forge, pyviz/label/dev
  Dependency count: 15
      Dependencies: python, build, conda-build, pip, param, panel, pyviz_comms, colorcet, numpy, packaging, pandas, ipython, notebook, matplotlib-base, bokeh
  Target platforms: osx-arm64, linux-64, win-64, osx-64
             Tasks: build-conda, check-latest-packages, install, download-data, build-pip

       Environment: lint
          Features: py311, lint, default
          Channels: conda-forge, pyviz/label/dev
  Dependency count: 14
      Dependencies: python, pre-commit, pip, param, panel, pyviz_comms, colorcet, numpy, packaging, pandas, ipython, notebook, matplotlib-base, bokeh
  Target platforms: osx-arm64, linux-64, osx-64, win-64
             Tasks: install, lint, check-latest-packages, download-data, lint-install


@hoxbro hoxbro force-pushed the pixi_play branch 2 times, most recently from b40b746 to f5d0e56 Compare April 10, 2024 17:00
@hoxbro hoxbro added the type: maintenance infrastructure and maintenance of CI label Apr 10, 2024
@hoxbro
Copy link
Member Author

hoxbro commented Apr 18, 2024

Hatchling in pyproject.toml:

[tool.hatch.build.hooks.custom]
path = "scripts/hatch_build.py"
The hatchling script
from __future__ import annotations

import typing as t

from hatchling.builders.hooks.plugin.interface import BuildHookInterface


class BuildHook(BuildHookInterface):
    """The hatch jupyter builder build hook."""

    PLUGIN_NAME = "install"

    def initialize(self, version: str, _: dict[str, t.Any]) -> None:
        """Initialize the plugin."""
        if self.target_name not in ["wheel", "sdist"]:
            return

        if version == "editable":
            ...

doit test_examples
- name: codecov
pixi run -e ${{ matrix.environment }} test-example --cov=./holoviews --cov-report=xml --cov-append
- uses: codecov/codecov-action@v4
Copy link
Member Author

Choose a reason for hiding this comment

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

This is not strictly related to the Pixi, but I noticed that it was failing. So I updated it to use the official workflow.

.gitignore Show resolved Hide resolved
@@ -26,6 +26,8 @@ class TestOutputUtil(ComparisonTestCase):
def setUp(self):
if notebook is None:
raise SkipTest("Jupyter Notebook not available")
from holoviews.ipython import notebook_extension
Copy link
Member Author

@hoxbro hoxbro Apr 18, 2024

Choose a reason for hiding this comment

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

It seems like IPython is not part of the sys.module at the import time, but I'm not entirely sure why.


for file in dist/*.whl dist/*.tar.bz2; do
if [ -e "$file" ]; then
echo "dist folder already contains $(basename "$file"). Please delete it before running this script."
Copy link
Member Author

Choose a reason for hiding this comment

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

If not, this will give some obscure error when running conda-build.

export VERSION
conda build scripts/conda/recipe --no-anaconda-upload --no-verify

mv "$CONDA_PREFIX/conda-bld/noarch/$PACKAGE-$VERSION-py_0.tar.bz2" dist
Copy link
Member Author

Choose a reason for hiding this comment

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

To make it easier to get the file.

@@ -0,0 +1,13 @@
import bokeh.sampledata
Copy link
Member Author

Choose a reason for hiding this comment

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

Changed from bash to python because there was no need for it to be a bash file...

Comment on lines -40 to -46
OMP_NUM_THREADS: 1
OPENBLAS_NUM_THREADS: 1
MKL_NUM_THREADS: 1
VECLIB_MAXIMUM_THREADS: 1
NUMEXPR_NUM_THREADS: 1
NUMBA_NUM_THREADS: 1
PYDEVD_DISABLE_FILE_VALIDATION: 1
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 moved those to the install task.

@hoxbro hoxbro marked this pull request as ready for review April 18, 2024 17:29
@@ -90,153 +83,111 @@ jobs:
if: env.MATRIX_OPTION == 'default'
run: |
MATRIX=$(jq -nsc '{
"os": ["ubuntu-latest", "macos-latest", "windows-latest"],
"python-version": ["3.9", "3.12"]
"os": ["ubuntu-latest", "macos-14", "windows-latest"],
Copy link
Member Author

@hoxbro hoxbro Apr 19, 2024

Choose a reason for hiding this comment

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

I changed to using Mac-arm64 as this is both faster and the newer architecture.

@hoxbro hoxbro changed the title Try pixi out Switch to Pixi for development / CI and hatchling for build system Apr 19, 2024
@hoxbro hoxbro merged commit 4727470 into main Apr 19, 2024
14 of 15 checks passed
@hoxbro hoxbro deleted the pixi_play branch April 19, 2024 15:29
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: maintenance infrastructure and maintenance of CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants