plotjs 0.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. plotjs-0.0.2/.coverage +0 -0
  2. plotjs-0.0.2/.gitattributes +1 -0
  3. plotjs-0.0.2/.github/workflows/doc.yaml +41 -0
  4. plotjs-0.0.2/.github/workflows/lint.yaml +28 -0
  5. plotjs-0.0.2/.github/workflows/pypi.yaml +98 -0
  6. plotjs-0.0.2/.github/workflows/tests.yaml +28 -0
  7. plotjs-0.0.2/.github/workflows/type.yaml +25 -0
  8. plotjs-0.0.2/.gitignore +30 -0
  9. plotjs-0.0.2/.pre-commit-config.yaml +21 -0
  10. plotjs-0.0.2/LICENSE +21 -0
  11. plotjs-0.0.2/PKG-INFO +47 -0
  12. plotjs-0.0.2/README.md +25 -0
  13. plotjs-0.0.2/coverage-badge.svg +1 -0
  14. plotjs-0.0.2/docs/guides/advanced/advanced.py +2 -0
  15. plotjs-0.0.2/docs/guides/advanced/index.md +1 -0
  16. plotjs-0.0.2/docs/guides/css/CSS-2.html +1376 -0
  17. plotjs-0.0.2/docs/guides/css/CSS.html +1372 -0
  18. plotjs-0.0.2/docs/guides/css/CSS.py +47 -0
  19. plotjs-0.0.2/docs/guides/css/index.md +80 -0
  20. plotjs-0.0.2/docs/guides/javascript/index.md +130 -0
  21. plotjs-0.0.2/docs/guides/javascript/javascript.html +1185 -0
  22. plotjs-0.0.2/docs/guides/javascript/javascript.py +85 -0
  23. plotjs-0.0.2/docs/guides/javascript/javascript2.html +1274 -0
  24. plotjs-0.0.2/docs/guides/troubleshooting/index.md +28 -0
  25. plotjs-0.0.2/docs/how-it-works.md +158 -0
  26. plotjs-0.0.2/docs/iframes/quickstart.html +1180 -0
  27. plotjs-0.0.2/docs/iframes/quickstart2.html +1180 -0
  28. plotjs-0.0.2/docs/iframes/quickstart3.html +1180 -0
  29. plotjs-0.0.2/docs/iframes/quickstart4.html +1180 -0
  30. plotjs-0.0.2/docs/iframes/quickstart5.html +1406 -0
  31. plotjs-0.0.2/docs/iframes/quickstart6.html +961 -0
  32. plotjs-0.0.2/docs/iframes/quickstart7.html +1244 -0
  33. plotjs-0.0.2/docs/iframes/quickstart8.html +1704 -0
  34. plotjs-0.0.2/docs/img/how-it-works-1.png +0 -0
  35. plotjs-0.0.2/docs/img/how-it-works-2.png +0 -0
  36. plotjs-0.0.2/docs/index.md +308 -0
  37. plotjs-0.0.2/docs/index.qmd +283 -0
  38. plotjs-0.0.2/docs/index_files/figure-commonmark/cell-2-output-1.png +0 -0
  39. plotjs-0.0.2/docs/index_files/figure-commonmark/cell-3-output-1.png +0 -0
  40. plotjs-0.0.2/docs/reference/css.md +13 -0
  41. plotjs-0.0.2/docs/reference/datasets.md +19 -0
  42. plotjs-0.0.2/docs/reference/javascript.md +5 -0
  43. plotjs-0.0.2/docs/reference/magic-plot.md +1 -0
  44. plotjs-0.0.2/docs/static/style.css +4 -0
  45. plotjs-0.0.2/docs/stylesheets/style.css +106 -0
  46. plotjs-0.0.2/mkdocs.yaml +65 -0
  47. plotjs-0.0.2/overrides/partials/footer.html +20 -0
  48. plotjs-0.0.2/plotjs/__init__.py +6 -0
  49. plotjs-0.0.2/plotjs/css.py +100 -0
  50. plotjs-0.0.2/plotjs/data/__init__.py +3 -0
  51. plotjs-0.0.2/plotjs/data/datasets.py +138 -0
  52. plotjs-0.0.2/plotjs/data/iris.csv +151 -0
  53. plotjs-0.0.2/plotjs/data/mtcars.csv +33 -0
  54. plotjs-0.0.2/plotjs/data/titanic.csv +892 -0
  55. plotjs-0.0.2/plotjs/javascript.py +23 -0
  56. plotjs-0.0.2/plotjs/main.py +256 -0
  57. plotjs-0.0.2/plotjs/static/d3.min.js +2 -0
  58. plotjs-0.0.2/plotjs/static/default.css +40 -0
  59. plotjs-0.0.2/plotjs/static/main.js +143 -0
  60. plotjs-0.0.2/plotjs/static/template.html +163 -0
  61. plotjs-0.0.2/plotjs/utils.py +30 -0
  62. plotjs-0.0.2/plotjs.egg-info/PKG-INFO +47 -0
  63. plotjs-0.0.2/plotjs.egg-info/SOURCES.txt +75 -0
  64. plotjs-0.0.2/plotjs.egg-info/dependency_links.txt +1 -0
  65. plotjs-0.0.2/plotjs.egg-info/requires.txt +3 -0
  66. plotjs-0.0.2/plotjs.egg-info/top_level.txt +1 -0
  67. plotjs-0.0.2/pyproject.toml +70 -0
  68. plotjs-0.0.2/scripts/coverage.sh +5 -0
  69. plotjs-0.0.2/scripts/release.sh +36 -0
  70. plotjs-0.0.2/setup.cfg +4 -0
  71. plotjs-0.0.2/tests/__init__.py +0 -0
  72. plotjs-0.0.2/tests/static/script.js +21 -0
  73. plotjs-0.0.2/tests/static/style.css +9 -0
  74. plotjs-0.0.2/tests/test_css_and_js_utils.py +79 -0
  75. plotjs-0.0.2/tests/test_data.py +80 -0
  76. plotjs-0.0.2/tests/test_magic_plot.py +19 -0
  77. plotjs-0.0.2/tests/test_main.py +79 -0
plotjs-0.0.2/.coverage ADDED
Binary file
@@ -0,0 +1 @@
1
+ *.html linguist-detectable=false
@@ -0,0 +1,41 @@
1
+ name: ci
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+
7
+ permissions:
8
+ contents: write
9
+
10
+ jobs:
11
+ deploy:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - name: Configure Git Credentials
16
+ run: |
17
+ git config user.name github-actions[bot]
18
+ git config user.email 41898282+github-actions[bot]@users.noreply.github.com
19
+ - uses: actions/setup-python@v5
20
+ with:
21
+ python-version: 3.x
22
+ - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
23
+ - uses: actions/cache@v4
24
+ with:
25
+ key: mkdocs-material-${{ env.cache_id }}
26
+ path: .cache
27
+ restore-keys: |
28
+ mkdocs-material-
29
+
30
+ - name: Install uv
31
+ uses: astral-sh/setup-uv@v5
32
+ with:
33
+ enable-cache: true
34
+
35
+ - name: Install the project
36
+ run: uv sync --all-groups
37
+
38
+ - name: Deploy MkDocs
39
+ env:
40
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41
+ run: PYTHONPATH=$(pwd) uv run mkdocs gh-deploy --force
@@ -0,0 +1,28 @@
1
+ name: Check Code Formatting
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ check-formatting:
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - name: Checkout repository
14
+ uses: actions/checkout@v3
15
+
16
+ - name: Set up Python
17
+ uses: actions/setup-python@v4
18
+ with:
19
+ python-version: "3.13"
20
+
21
+ - name: Install Ruff
22
+ run: pip install ruff==0.9.10
23
+
24
+ - name: Run Ruff format check
25
+ run: ruff format --check .
26
+
27
+ - name: Run Ruff linting and auto-fix
28
+ run: ruff check --fix .
@@ -0,0 +1,98 @@
1
+ # This is taken from
2
+ # https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#the-whole-ci-cd-workflow
3
+ # but with the following differences
4
+ # - removed the TestPyPI part
5
+ # - instead of `on: push`, we have `tags` in there too
6
+
7
+ name: Publish Python 🐍 distribution 📦 to PyPI
8
+
9
+ on:
10
+ push:
11
+ tags:
12
+ - "v[0-9]+.[0-9]+.[0-9]+*"
13
+
14
+ jobs:
15
+ build:
16
+ name: Build distribution 📦
17
+ runs-on: ubuntu-latest
18
+
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ with:
22
+ persist-credentials: false
23
+ - name: Set up Python
24
+ uses: actions/setup-python@v5
25
+ with:
26
+ python-version: "3.x"
27
+ - name: Install pypa/build
28
+ run: python3 -m pip install build --user
29
+ - name: Build a binary wheel and a source tarball
30
+ run: python3 -m build
31
+ - name: Store the distribution packages
32
+ uses: actions/upload-artifact@v4
33
+ with:
34
+ name: python-package-distributions
35
+ path: dist/
36
+
37
+ publish-to-pypi:
38
+ name: >-
39
+ Publish Python 🐍 distribution 📦 to PyPI
40
+ if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
41
+ needs:
42
+ - build
43
+ runs-on: ubuntu-latest
44
+ environment:
45
+ name: pypi
46
+ url: https://pypi.org/p/pytest-cov
47
+ permissions:
48
+ id-token: write # IMPORTANT: mandatory for trusted publishing
49
+
50
+ steps:
51
+ - name: Download all the dists
52
+ uses: actions/download-artifact@v4
53
+ with:
54
+ name: python-package-distributions
55
+ path: dist/
56
+ - name: Publish distribution 📦 to PyPI
57
+ uses: pypa/gh-action-pypi-publish@release/v1
58
+
59
+ github-release:
60
+ name: >-
61
+ Sign the Python 🐍 distribution 📦 with Sigstore
62
+ and upload them to GitHub Release
63
+ needs:
64
+ - publish-to-pypi
65
+ runs-on: ubuntu-latest
66
+ permissions:
67
+ contents: write # IMPORTANT: mandatory for making GitHub Releases
68
+ id-token: write # IMPORTANT: mandatory for sigstore
69
+ steps:
70
+ - name: Download all the dists
71
+ uses: actions/download-artifact@v4
72
+ with:
73
+ name: python-package-distributions
74
+ path: dist/
75
+ - name: Sign the dists with Sigstore
76
+ uses: sigstore/gh-action-sigstore-python@v3.0.0
77
+ with:
78
+ inputs: >-
79
+ ./dist/*.tar.gz
80
+ ./dist/*.whl
81
+ - name: Create GitHub Release
82
+ env:
83
+ GITHUB_TOKEN: ${{ github.token }}
84
+ run: >-
85
+ gh release create
86
+ "$GITHUB_REF_NAME"
87
+ --repo "$GITHUB_REPOSITORY"
88
+ --notes ""
89
+ - name: Upload artifact signatures to GitHub Release
90
+ env:
91
+ GITHUB_TOKEN: ${{ github.token }}
92
+ # Upload to GitHub Release using the `gh` CLI.
93
+ # `dist/` contains the built packages, and the
94
+ # sigstore-produced signatures and certificates.
95
+ run: >-
96
+ gh release upload
97
+ "$GITHUB_REF_NAME" dist/**
98
+ --repo "$GITHUB_REPOSITORY"
@@ -0,0 +1,28 @@
1
+ name: Unit tests
2
+
3
+ on:
4
+ pull_request:
5
+ branches: [main]
6
+
7
+ jobs:
8
+ build:
9
+ runs-on: ${{ matrix.os }}
10
+ strategy:
11
+ matrix:
12
+ os: [ubuntu-latest, macos-latest, windows-latest]
13
+ python-version: ["3.10", "3.13"]
14
+ env:
15
+ UV_PYTHON: ${{ matrix.python-version }}
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Install uv
20
+ uses: astral-sh/setup-uv@v5
21
+ with:
22
+ enable-cache: true
23
+
24
+ - name: Install the project
25
+ run: uv sync --all-groups
26
+
27
+ - name: Run tests
28
+ run: uv run pytest
@@ -0,0 +1,25 @@
1
+ name: Check Static Typing
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ check-formatting:
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - name: Checkout repository
14
+ uses: actions/checkout@v3
15
+
16
+ - name: Install uv
17
+ uses: astral-sh/setup-uv@v5
18
+ with:
19
+ enable-cache: true
20
+
21
+ - name: Install the project
22
+ run: uv sync --all-groups
23
+
24
+ - name: Run tests
25
+ run: uv run ty check
@@ -0,0 +1,30 @@
1
+ __pycache__/
2
+ *.py[oc]
3
+ build/
4
+ dist/
5
+ wheels/
6
+ *.egg-info
7
+ .env
8
+ uv.lock
9
+
10
+ .venv/
11
+ venv/
12
+ .env/
13
+ env/
14
+
15
+ .vscode/
16
+
17
+ .DS_Store
18
+
19
+ *cache*
20
+
21
+ *.zip
22
+ sandbox.*
23
+ sandbox/
24
+
25
+ *.html
26
+ !plotjs/static/template.html
27
+ !docs/**/*.html
28
+
29
+ *.svg
30
+ !coverage-badge.svg
@@ -0,0 +1,21 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: v0.11.7
4
+ hooks:
5
+ - id: ruff
6
+ types_or: [python, pyi]
7
+ args: [--fix]
8
+ - id: ruff-format
9
+ types_or: [python, pyi]
10
+ - repo: https://github.com/pre-commit/pre-commit-hooks
11
+ rev: v5.0.0
12
+ hooks:
13
+ - id: check-yaml
14
+ - id: trailing-whitespace
15
+ - id: end-of-file-fixer
16
+ - id: check-added-large-files
17
+ - repo: https://github.com/python-jsonschema/check-jsonschema
18
+ rev: 0.28.2
19
+ hooks:
20
+ - id: check-github-workflows
21
+ args: ["--verbose"]
plotjs-0.0.2/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Joseph Barbier
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
plotjs-0.0.2/PKG-INFO ADDED
@@ -0,0 +1,47 @@
1
+ Metadata-Version: 2.4
2
+ Name: plotjs
3
+ Version: 0.0.2
4
+ Summary: Bridge between static matplotlib and interactive storytelling
5
+ Author-email: Joseph Barbier <joseph.barbierdarnal@mail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://y-sunflower.github.io/plotjs/
8
+ Project-URL: Issues, https://github.com/y-sunflower/plotjs/issues
9
+ Project-URL: Documentation, https://y-sunflower.github.io/plotjs/
10
+ Project-URL: Repository, https://github.com/y-sunflower/plotjs
11
+ Keywords: matplotlib,interactive,javascript,web,css,d3,mpld3,plotnine
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Development Status :: 3 - Alpha
15
+ Requires-Python: >=3.10
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: jinja2>=3.0.0
19
+ Requires-Dist: matplotlib>=3.10.0
20
+ Requires-Dist: narwhals>=2.0.0
21
+ Dynamic: license-file
22
+
23
+ # `plotjs`: bridge between static matplotlib and interactive storytelling
24
+
25
+ `plotjs` is a proof of concept, inspired by [mpld3](https://github.com/mpld3/mpld3), to make matplotlib plots interactive (for the browser) with minimum user inputs.
26
+
27
+ The goal is also to give users a large customization power.
28
+
29
+ > Consider that the project is still **very unstable**.
30
+
31
+ [Online demo](https://y-sunflower.github.io/plotjs/)
32
+
33
+ <br><br>
34
+
35
+ ## Installation
36
+
37
+ From PyPI:
38
+
39
+ ```
40
+ pip install plotjs
41
+ ```
42
+
43
+ Latest dev version:
44
+
45
+ ```
46
+ pip install git+https://github.com/y-sunflower/plotjs.git
47
+ ```
plotjs-0.0.2/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # `plotjs`: bridge between static matplotlib and interactive storytelling
2
+
3
+ `plotjs` is a proof of concept, inspired by [mpld3](https://github.com/mpld3/mpld3), to make matplotlib plots interactive (for the browser) with minimum user inputs.
4
+
5
+ The goal is also to give users a large customization power.
6
+
7
+ > Consider that the project is still **very unstable**.
8
+
9
+ [Online demo](https://y-sunflower.github.io/plotjs/)
10
+
11
+ <br><br>
12
+
13
+ ## Installation
14
+
15
+ From PyPI:
16
+
17
+ ```
18
+ pip install plotjs
19
+ ```
20
+
21
+ Latest dev version:
22
+
23
+ ```
24
+ pip install git+https://github.com/y-sunflower/plotjs.git
25
+ ```
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="114" height="20" role="img" aria-label="coverage: 92.48%"><title>coverage: 92.48%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="114" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="61" height="20" fill="#555"/><rect x="61" width="53" height="20" fill="#4c1"/><rect width="114" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="315" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="510">coverage</text><text x="315" y="140" transform="scale(.1)" fill="#fff" textLength="510">coverage</text><text aria-hidden="true" x="865" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">92.48%</text><text x="865" y="140" transform="scale(.1)" fill="#fff" textLength="430">92.48%</text></g></svg>
@@ -0,0 +1,2 @@
1
+ import matplotlib.pyplot as plt
2
+ from plotjs import MagicPlot
@@ -0,0 +1 @@
1
+ # TODO: find cool examples to showcase here