Skip to content

Check pre-commit against the codebase #332

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

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: pre-commit

# Trigger: This workflow runs on every push to the repository
on:
push:

# Permissions: Only read access to repository contents is needed
permissions:
contents: read

jobs:
# Job: pre-commit
# Purpose: Executes the pre-commit checks against the codebase
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout [${{ github.repository }}]
uses: actions/checkout@v4

- name: Install Node 20
uses: actions/setup-node@v4
with:
node-version: '20'

- uses: pre-commit/action@v3.0.1
with:
extra_args: '--all-files --config src/py/.pre-commit-config.yaml'
12 changes: 8 additions & 4 deletions .github/workflows/publish_testpypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,15 @@ jobs:
# don't modify sync file! messes up version!
- run: uv sync --all-extras --frozen # does order matter?
- run: uv build
#- name: Reinstall from wheel
# run: >
# uv pip install dist/kaleido-$(uv
# run --no-sync --with setuptools-git-versioning
# setuptools-git-versioning)-py3-none-any.whl
- name: Reinstall from wheel
run: >
uv pip install dist/kaleido-$(uv
run --no-sync --with setuptools-git-versioning
setuptools-git-versioning)-py3-none-any.whl
run: |
WHEEL_PATH=$(ls dist/kaleido-*-py3-none-any.whl)
uv pip install "$WHEEL_PATH"
- run: uv run --no-sync kaleido_get_chrome -v # --i ${{ matrix.chrome_v }}
- name: Diagnose
run: uv run --no-sync choreo_diagnose --no-run
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ src/py/integration_tests/report*
# avoid ignore .gitkeep
!src/py/integration_tests/renders/.gitkeep
node_modules/

# IDE
.idea
5 changes: 5 additions & 0 deletions .markdown.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# MD026: Trailing punctuation in header - Disallows headers ending with specified punctuation characters
rule 'MD026', :punctuation => '.,;:!'

# MD013: Line length - Enforces a maximum line length, but ignores code blocks
rule 'MD013', :ignore_code_blocks => true

# MD033: Inline HTML - This rule is excluded, allowing inline HTML in Markdown files
exclude_rule 'MD033'
2 changes: 1 addition & 1 deletion src/py/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exclude: |
(?x)(
src/py/site/.*|
src/py/integration_tests/mocks/.*|
src/py/intergation_tests/renders/.*|
src/py/integration_tests/renders/.*|
src/js/.*|
\.js$
)
Expand Down
File renamed without changes.
19 changes: 15 additions & 4 deletions src/py/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,32 @@

# Pre-Launch Kaleido v1.0.0

Kaleido allows you to convert plotly figures to images. Kaleido v1 is currently available as a release candidate.
Kaleido allows you to convert plotly figures to images.
Kaleido v1 is currently available as a release candidate.

## Migrating from v0 to v1

Kaleido v1 introduces a new API. If you're currently using v0, you'll need to make changes to your code and environment where you are running Kaleido.
Kaleido v1 introduces a new API. If you're currently using v0,
you'll need to make changes to your code and environment
where you are running Kaleido.

- Chrome is no longer included with Kaleido.
Kaleido will look for an existing Chrome installation,
but also provides commands for installing Chrome.
If you don't have Chrome, you'll need to install it.
See the following installation section for more details.
- `kaleido.scopes.plotly` has been removed in v1.
Kaleido v1 provides `write_fig` and `write_fig_sync`
for exporting Plotly figures.

- Chrome is no longer included with Kaleido. Kaleido will look for an existing Chrome installation, but also provides commands for installing Chrome. If you don't have Chrome, you'll need to install it. See the following installation section for more details.
- `kaleido.scopes.plotly` has been removed in v1. Kaleido v1 provides `write_fig` and `write_fig_sync` for exporting Plotly figures.
```
from kaleido import write_fig_sync
import plotly.graph_objects as go

fig = go.Figure(data=[go.Scatter(y=[1, 3, 2])])
kaleido.write_fig_sync(fig, path="figure.png")
```

See the Quickstart section below for more details on usage for v1.

Note: Kaleido v1 works with Plotly v6.1.0 and later.
Expand Down
2 changes: 1 addition & 1 deletion src/py/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ kaleido = ['vendor/**']
[project]
name = "kaleido"
description = "Plotly graph export library"
license = {file = "LICENSE.md"}
license = {file = "LICENSE"}
readme = "README.md"
requires-python = ">=3.8"
dynamic = ["version"]
Expand Down
Loading