Skip to content

Commit

Permalink
Add pre-commit config (#3514)
Browse files Browse the repository at this point in the history
* Add pre-commit config

* Add pre-commit job to CI

* Ensure repo is checked out

* Fix file endings

* Add cache

* Fix cache

* Only run tests if pre-commit passes

* Improve ReactiveHTML whitespace handling
  • Loading branch information
philippjfr authored May 13, 2022
1 parent 869549c commit 95c8d16
Show file tree
Hide file tree
Showing 146 changed files with 388 additions and 376 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
*.gif binary
*.gif binary
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- name: conda setup
run: |
conda config --set always_yes True
conda install "pip<21.2.1"
conda install "pip<21.2.1"
conda install -c pyviz "pyctdev>=0.5"
doit ecosystem_setup
- name: conda build
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
run: |
eval "$(conda shell.bash hook)"
conda activate test-environment
conda install ${{ env.CHANS_DEV }} "pip<21.2.1"
conda install ${{ env.CHANS_DEV }} "pip<21.2.1"
doit develop_install $CHANS_DEV -o build
pip uninstall -y panel
doit pip_on_conda
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ jobs:
run: |
eval "$(conda shell.bash hook)"
conda activate test-environment
conda install "pip<21.2.1"
conda install "pip<21.2.1"
conda list
doit develop_install -o doc -o examples
pip install pyecharts idom==0.24
- name: temporarily pin jinja2
run: |
eval "$(conda shell.bash hook)"
conda activate test-environment
conda install "jinja2<=3.0.3"
conda install "jinja2<=3.0.3"
- name: doit env_capture
run: |
eval "$(conda shell.bash hook)"
Expand Down
25 changes: 18 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,24 @@ on:
- cron: '0 19 * * SUN'

jobs:
pre_commit:
name: Run pre-commit hooks
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v2
with:
fetch-depth: "1"
- name: set PY
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v1
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: pre-commit
uses: pre-commit/[email protected]
test_suite:
name: Pytest on ${{ matrix.os }} with Python ${{ matrix.python-version }}
needs: [pre_commit]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -25,7 +41,7 @@ jobs:
timeout-minutes: 60
defaults:
run:
shell: bash -l {0}
shell: bash -l {0}
env:
DESC: "Python ${{ matrix.python-version }} tests"
PYTHON_VERSION: ${{ matrix.python-version }}
Expand Down Expand Up @@ -67,7 +83,7 @@ jobs:
run: |
eval "$(conda shell.bash hook)"
conda activate test-environment
conda install "pip<21.2.1" "toml"
conda install "pip<21.2.1" "toml"
conda list
doit develop_install -o examples -o recommended -o tests -o build
pip install pyecharts idom
Expand All @@ -84,11 +100,6 @@ jobs:
eval "$(conda shell.bash hook)"
conda activate test-environment
doit env_capture
- name: doit test_flakes
run: |
eval "$(conda shell.bash hook)"
conda activate test-environment
doit test_flakes
- name: doit test_unit
run: |
eval "$(conda shell.bash hook)"
Expand Down
23 changes: 23 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This is the configuration for pre-commit, a local framework for managing pre-commit hooks
# Check out the docs at: https://pre-commit.com/

default_stages: [commit]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
hooks:
- id: check-builtin-literals
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-toml
- id: detect-private-key
- id: end-of-file-fixer
exclude: \.min\.js$
- id: trailing-whitespace
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8 # See 'setup.cfg' for args
args: [panel]
files: panel/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

## What is it?

[Panel](https://panel.holoviz.org/) provides tools for easily composing widgets, plots, tables, and other viewable objects and controls into custom analysis tools, apps, and dashboards. Panel works with visualizations from [Altair](https://altair-viz.github.io/), [Bokeh](https://bokeh.pydata.org), [HoloViews](https://holoviews.org), [Matplotlib](https://matplotlib.org/), [Plotly](https://plotly.com/), [pydeck](https://pydeck.gl/), [PyVista](https://docs.pyvista.org/) and many other Python plotting libraries, making them instantly viewable either individually or when combined with interactive widgets that control them.
[Panel](https://panel.holoviz.org/) provides tools for easily composing widgets, plots, tables, and other viewable objects and controls into custom analysis tools, apps, and dashboards. Panel works with visualizations from [Altair](https://altair-viz.github.io/), [Bokeh](https://bokeh.pydata.org), [HoloViews](https://holoviews.org), [Matplotlib](https://matplotlib.org/), [Plotly](https://plotly.com/), [pydeck](https://pydeck.gl/), [PyVista](https://docs.pyvista.org/) and many other Python plotting libraries, making them instantly viewable either individually or when combined with interactive widgets that control them.

Panel works equally well in [Jupyter Notebooks](http://jupyter.org), for creating quick data-exploration tools, or as standalone deployed apps and dashboards, and allows you to easily switch between those contexts as needed.

Expand Down
2 changes: 1 addition & 1 deletion binder/jupyter-panel-apps-server/examples-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion binder/jupyter-voila-docs-server/examples-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion binder/postBuild
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ SERVICE_URL=https://open-vsx.org/vscode/gallery ITEM_URL=https://open-vsx.org/vs
SERVICE_URL=https://open-vsx.org/vscode/gallery ITEM_URL=https://open-vsx.org/vscode/item code-server --install-extension ritwickdey.liveserver
bokeh sampledata
panel build panel
jupyter serverextension enable panel.io.jupyter_server_extension
jupyter serverextension enable panel.io.jupyter_server_extension
2 changes: 1 addition & 1 deletion binder/start
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ Xvfb :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
sleep 3
jupyter trust examples/**/*.ipynb
jupyter trust examples/**/**/*.ipynb
exec "$@"
exec "$@"
6 changes: 3 additions & 3 deletions doc/FAQ.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ When using the pandas plotting API we create the figure and axes in the same way

**Q: How can I deploy a Panel app for others to use?**

**A:** There are many options available; see the Deployment section of the user manual. The basic idea is if you can log into a machine and launch a web server process, you can use ``panel serve`` there
**A:** There are many options available; see the Deployment section of the user manual. The basic idea is if you can log into a machine and launch a web server process, you can use ``panel serve`` there


**Q: Is Panel 'Shiny for Python'?**
Expand Down Expand Up @@ -202,7 +202,7 @@ The `Comparisons page <about/comparisons.html>`__ describes some of these differ
| | Voila | | Voila | | | |
+--------------------------------------+-----------------+----------------------+-----------------+--------------------+------------------------+--------------------+

Each of these libraries are free, open-source software packages, but all of them can be used with the commercial
`Anaconda Enterprise (AE5) <https://www.anaconda.com/enterprise/>`__ server product, and some can be used with other commercial servers
Each of these libraries are free, open-source software packages, but all of them can be used with the commercial
`Anaconda Enterprise (AE5) <https://www.anaconda.com/enterprise/>`__ server product, and some can be used with other commercial servers
(Shiny, with `Shiny Server <https://www.rstudio.com/products/shiny-server-pro>`__, Streamlit, with `Streamlit Teams`, and Dash, with
`Dash Enterprise <https://plot.ly/dash>`__), to provide on-premises authenticated deployment within a private network. Most of the servers (including Jupyter, Bokeh Server, Voila, and Dash) can be also deployed on the public sites `mybinder.org <https://mybinder.org>`__ or `heroku <https://www.heroku.com>`__.
2 changes: 1 addition & 1 deletion doc/_static/wordmark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 95c8d16

Please sign in to comment.