Skip to content

Commit

Permalink
Merge branch 'main' into remove_direct_pandas
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro committed Feb 21, 2025
2 parents dc063df + 01a80f2 commit 026810b
Show file tree
Hide file tree
Showing 172 changed files with 6,263 additions and 4,622 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# The "shellcheck" pre-commit hook requires shell scripts to end lines with LF
# regardless of git's "core.autocrlf" setting.
*.sh text eol=lf
2 changes: 1 addition & 1 deletion .github/workflows/nightly_lock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ env:

jobs:
pixi_lock:
if: ${{ !github.event.repository.fork }}
name: Pixi lock
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: holoviz-dev/holoviz_tasks/pixi_lock@v0
- 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 }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ jobs:
run: |
MATRIX=$(jq -nsc '{
"os": ["ubuntu-latest", "macos-latest", "windows-latest"],
"environment": ["test-39", "test-312"]
"environment": ["test-39", "test-313"]
}')
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"]
"environment": ["test-39", "test-310", "test-311", "test-312", "test-313"]
}')
echo "MATRIX=$MATRIX" >> $GITHUB_ENV
- name: Set test matrix with 'downstream' option
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ repos:
- id: check-json
- id: detect-private-key
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.1
rev: v0.9.3
hooks:
- id: ruff
files: holoviews/|scripts/
exclude: \.ipynb$
- repo: https://github.com/hoxbro/clean_notebook
rev: v0.1.15
hooks:
- id: clean-notebook
args: [--strip-trailing-newlines]
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.0
hooks:
- id: codespell
additional_dependencies:
Expand All @@ -43,7 +43,7 @@ repos:
hooks:
- id: shellcheck
- repo: https://github.com/hoxbro/prettier-pre-commit
rev: v3.4.1
rev: v3.4.2
hooks:
- id: prettier
exclude: conda.recipe/meta.yaml
Expand Down
18 changes: 11 additions & 7 deletions doc/conf.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
# -*- coding: utf-8 -*-

import param

param.parameterized.docstring_signature = False
param.parameterized.docstring_describe_params = False

from nbsite.shared_conf import *
from nbsite.shared_conf import * # noqa: F403

# Declare information specific to this project.
project = 'HoloViews'
authors = 'HoloViz developers'
copyright = '2005 ' + authors
description = 'Stop plotting your data - annotate your data and let it visualize itself.'

import holoviews
version = release = base_version(holoviews.__version__)
# Setting this to not error out if no install is done
root_path = os.path.dirname(os.path.dirname(__file__))
sys.path.insert(0, root_path)
os.environ["PYTHONPATH"] = root_path

import holoviews as hv

version = release = base_version(hv.__version__)

holoviews.extension.inline = False
hv.extension.inline = False

html_theme = 'pydata_sphinx_theme'
html_logo = '_static/logo_horizontal.png'
Expand Down Expand Up @@ -107,7 +111,7 @@

html_context.update({
# Used to add binder links to the latest released tag.
"last_release": f"v{'.'.join(holoviews.__version__.split('.')[:3])}",
"last_release": f"v{'.'.join(hv.__version__.split('.')[:3])}",
'github_user': 'holoviz',
'github_repo': 'holoviews',
"default_mode": "light"
Expand Down
100 changes: 83 additions & 17 deletions doc/developer_guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ To contribute to HoloViews, you will also need [Github account](https://github.c

### Pixi

Developing all aspects of HoloViews requires a wide range of packages in different environments. To make this more manageable, Pixi manages the developer experience. To install Pixi, follow [this guide](https://pixi.sh/latest/#installation).
Developing all aspects of HoloViews requires a wide range of packages in different environments, but for new contributors the `default` environment will be more than enough.

To make this more manageable, Pixi manages the developer experience. To install Pixi, follow [this guide](https://pixi.sh/latest/#installation).

#### Glossary

Expand All @@ -43,6 +45,7 @@ For more information, see the [Pixi documentation](https://pixi.sh/latest/).
The first time you run `pixi`, it will create a `.pixi` directory in the source directory.
This directory will contain all the files needed for the virtual environments.
The `.pixi` directory can be large, so it is advised not to put the source directory into a cloud-synced directory.

:::

## Installing the Project
Expand All @@ -60,13 +63,30 @@ This `holoviews` directory is the _source checkout_ for the remainder of this do

## Start developing

To start developing, run the following command
To start developing, run the following command, this will create an environment called `default` and install HoloViews in [editable mode](https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs):

```bash
pixi run install
```

:::{admonition} Note
:class: info

The first time you run it, it will create a `pixi.lock` file with information for all available environments.
This command will take a minute or so to run.

:::
:::{admonition} Advanced usage
:class: tip

Currently, an editable install needs to be run in each environment. So, if you want to install in the `test-core` environment, you can add `--environment` / `-e` to the command:

```bash
pixi install
pixi run -e test-core install
```

The first time you run it, it will create a `pixi.lock` file with information for all available environments. This command will take a minute or so to run.
:::

When this is finished, it is possible to run the following command to download the data HoloViews tests and examples depend upon.

```bash
Expand All @@ -75,6 +95,14 @@ pixi run download-data

All available tasks can be found by running `pixi task list`, the following sections will give a brief introduction to the most common tasks.

For setting up a complete development you can run:

```bash
pixi run setup-dev
```

This will run the `install` and `download-data` tasks, among other tasks deemed necessary for a development environment.

### Syncing Git tags with upstream repository

If you are working from a forked repository of HoloViews, you will need to sync the tags with the upstream repo.
Expand All @@ -85,24 +113,41 @@ Syncing the git tags can be done with:
pixi run sync-git-tags
```

### Editable install
## Developer Environment

It can be advantageous to install the HoloViews in [editable mode](https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs):
The `default` environment is meant to provide all the tools needed to develop HoloViews.

```bash
pixi run install
```
This environment can be created by running `pixi run install`, which will set up the environment and make an editable install of HoloViews.

:::{admonition} Note
:class: info
To activate this environment you can run `pixi shell`, this is equivalent to `source venv/bin/activate` in a virtual environment or `conda activate` in a conda environment.

Currently, this needs to be run for each environment. So, if you want to install in the `test-ui` environment, you can add `--environment` / `-e` to the command:
If you need to run a command directly instead of via `pixi`, you activate the environment and run your command (e.g. `pytest holoviews/tests/<somefile.py>`).

```bash
pixi run -e test-ui install
```
### VS Code

:::
This environment can also be selected in your IDE. In VS Code, this can be done by running the command `Python: Select Interpreter` and choosing `{'default': Pixi}`.

<p style="text-align: center">
<img
src="https://assets.holoviews.org/static/dev_guide/001.png"
alt="001"
style="width: 45%; display: inline-block"
/>
<img
src="https://assets.holoviews.org/static/dev_guide/002.png"
alt="002"
style="width: 45%; display: inline-block"
/>
</p>

To confirm you are using this dev environment, check the bottom right corner:

![003](https://assets.holoviews.org/static/dev_guide/003.png)

### Jupyter Lab

You can launch Jupyter lab with the `default` environment with `pixi run lab`.
This can be advantageous when you need to edit the documentation or debug an example notebook.

## Linting

Expand All @@ -118,6 +163,18 @@ Linting can also be set up to run automatically with each commit; this is the re
pixi run lint-install
```

:::{admonition} Note
:class: info

Alternatively, if you have `pre-commit` installed elsewhere you can run

```bash
pre-commit install # To install
pre-commit run --all-files # To run on all files
```

:::

## Testing

To help keep HoloViews maintainable, all Pull Requests (PR) with code changes should typically be accompanied by relevant tests. While exceptions may be made for specific circumstances, the default assumption should be that a Pull Request without tests will not be merged.
Expand All @@ -133,9 +190,18 @@ Unit tests can be run with the `test-unit` task:
pixi run test-unit
```

:::{admonition} Advanced usage
:class: tip

The task is available in the following environments: `test-39`, `test-310`, `test-311`, `test-312`, and `test-core`. Where the first ones have the same environments except for different Python versions, and `test-core` only has a core set of dependencies.

If you haven't set the environment flag in the command, a menu will help you select which one of the environments to use.
You can run the task in a specific environment with the `-e` flag. For example, to run the `test-unit` task in the `test-39` environment, you can run:

```bash
pixi run -e test-39 test-unit
```

:::

### Example tests

Expand Down
41 changes: 19 additions & 22 deletions doc/generate_modules.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
sphinx-autopackage-script
This script parses a directory tree looking for python modules and packages and
Expand Down Expand Up @@ -31,9 +30,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.


import os
import optparse

import os

# automodule options
OPTIONS = ['members',
Expand All @@ -59,45 +57,44 @@ def write_file(name, text, opts):
"""Write the output file for module/package <name>."""
if opts.dryrun:
return
fname = os.path.join(opts.destdir, "%s.%s" % (name, opts.suffix))
fname = os.path.join(opts.destdir, f"{name}.{opts.suffix}")
if not opts.force and os.path.isfile(fname):
print('File %s already exists, skipping.' % fname)
print(f'File {fname} already exists, skipping.')
else:
print('Creating file %s.' % fname)
print(f'Creating file {fname}.')
f = open(fname, 'w')
f.write(text)
f.close()

def format_heading(level, text):
"""Create a heading of <level> [1, 2 or 3 supported]."""
underlining = ['=', '-', '~', ][level-1] * len(text)
return '%s\n%s\n\n' % (text, underlining)
return f'{text}\n{underlining}\n\n'

def format_directive(module, package=None):
"""Create the automodule directive and add the options."""
directive = '.. automodule:: %s\n' % makename(package, module)
directive = f'.. automodule:: {makename(package, module)}\n'
for option in OPTIONS:
directive += ' :%s:\n' % option
directive += f' :{option}:\n'
return directive

def format_inheritance_diagram(module, package=None):
"""Create the inheritance_diagram directive and add the options."""
directive = '.. inheritance-diagram:: %s\n' % makename(package, module)
directive = f'.. inheritance-diagram:: {makename(package, module)}\n'
return directive

def create_module_file(package, module, opts):
"""Build the text of the file and write the file."""

text = format_heading(1, '%s Module' % module)
text = format_heading(1, f'{module} Module')
text += format_inheritance_diagram(package, module)
text += format_heading(2, ':mod:`%s` Module' % module)
text += format_heading(2, f':mod:`{module}` Module')
text += format_directive(module, package)
write_file(makename(package, module), text, opts)

def create_package_file(root, master_package, subroot, py_files, opts, subs):
"""Build the text of the file and write the file."""
package = os.path.split(root)[-1]
text = format_heading(1, '%s.%s Package' % (master_package, package))
text = format_heading(1, f'{master_package}.{package} Package')
text += '\n---------\n\n'
# add each package's module
for py_file in py_files:
Expand All @@ -107,9 +104,9 @@ def create_package_file(root, master_package, subroot, py_files, opts, subs):
py_file = os.path.splitext(py_file)[0]
py_path = makename(subroot, py_file)
if is_package:
heading = ':mod:`%s` Package' % package
heading = f':mod:`{package}` Package'
else:
heading = ':mod:`%s` Module' % py_file
heading = f':mod:`{py_file}` Module'
text += format_heading(2, heading)
text += format_inheritance_diagram(is_package and subroot or py_path, master_package)
text += '\n\n'
Expand All @@ -123,7 +120,7 @@ def create_package_file(root, master_package, subroot, py_files, opts, subs):
text += format_heading(2, 'Subpackages')
text += '.. toctree::\n\n'
for sub in subs:
text += ' %s.%s\n' % (makename(master_package, subroot), sub)
text += f' {makename(master_package, subroot)}.{sub}\n'
text += '\n'

write_file(makename(master_package, subroot), text, opts)
Expand All @@ -132,9 +129,9 @@ def create_modules_toc_file(master_package, modules, opts, name='modules'):
"""
Create the module's index.
"""
text = format_heading(1, '%s Modules' % opts.header)
text = format_heading(1, f'{opts.header} Modules')
text += '.. toctree::\n'
text += ' :maxdepth: %s\n\n' % opts.maxdepth
text += f' :maxdepth: {opts.maxdepth}\n\n'

modules.sort()
prev_module = ''
Expand All @@ -143,7 +140,7 @@ def create_modules_toc_file(master_package, modules, opts, name='modules'):
if module.startswith(prev_module + '.'):
continue
prev_module = module
text += ' %s\n' % module
text += f' {module}\n'

write_file(name, text, opts)

Expand Down Expand Up @@ -270,9 +267,9 @@ def main():
excludes = normalize_excludes(rootpath, excludes)
recurse_tree(rootpath, excludes, opts)
else:
print('%s is not a valid output destination directory.' % opts.destdir)
print(f'{opts.destdir} is not a valid output destination directory.')
else:
print('%s is not a valid directory.' % rootpath)
print(f'{rootpath} is not a valid directory.')


if __name__ == '__main__':
Expand Down
Loading

0 comments on commit 026810b

Please sign in to comment.