diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 00000000..39e48fe7 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -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' diff --git a/.github/workflows/publish_testpypi.yml b/.github/workflows/publish_testpypi.yml index be56130a..5ff7f498 100644 --- a/.github/workflows/publish_testpypi.yml +++ b/.github/workflows/publish_testpypi.yml @@ -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 diff --git a/.gitignore b/.gitignore index 48dbaac5..66aa7eec 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,6 @@ src/py/integration_tests/report* # avoid ignore .gitkeep !src/py/integration_tests/renders/.gitkeep node_modules/ + +# IDE +.idea diff --git a/.markdown.rb b/.markdown.rb index 338ef020..aba50030 100644 --- a/.markdown.rb +++ b/.markdown.rb @@ -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' diff --git a/src/py/.pre-commit-config.yaml b/src/py/.pre-commit-config.yaml index 2a672b12..c0686a7b 100644 --- a/src/py/.pre-commit-config.yaml +++ b/src/py/.pre-commit-config.yaml @@ -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$ ) diff --git a/src/py/LICENSE.md b/src/py/LICENSE similarity index 100% rename from src/py/LICENSE.md rename to src/py/LICENSE diff --git a/src/py/README.md b/src/py/README.md index 6f28da29..a672a292 100644 --- a/src/py/README.md +++ b/src/py/README.md @@ -8,14 +8,24 @@ # 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 @@ -23,6 +33,7 @@ Kaleido v1 introduces a new API. If you're currently using v0, you'll need to ma 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. diff --git a/src/py/pyproject.toml b/src/py/pyproject.toml index 59547c95..f09ce74b 100644 --- a/src/py/pyproject.toml +++ b/src/py/pyproject.toml @@ -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"]