diff --git a/.github/workflows/pr-title.yml b/.github/workflows/pr-title.yml index 287b517..fa14a09 100644 --- a/.github/workflows/pr-title.yml +++ b/.github/workflows/pr-title.yml @@ -11,7 +11,7 @@ jobs: steps: - uses: deepakputhraya/action-pr-title@master with: - regex: "^(add:|build:|ci:|docs:|feat:|fix:|bug:|perf:|refactor:|revert:|style:|test:|security:).{12,60}$" + regex: "^(add:|build:|ci:|docs:|feat:|fix:|maintain:|bug:|perf:|refactor:|revert:|style:|test:|security:).{12,60}$" min_length: 10 max_length: 60 github_token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dc018d9..d66c693 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,4 +14,4 @@ jobs: prerelease: true default-branch: main pull-request-header: ":robot: I have created a release *beep* *boop*. This was predictable." - changelog-types: '[{"type":"resolve","section":"Miscellaneous","hidden":true},{"type":"add","section":"Features","hidden":false},{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"bug","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":true},{"type":"test","section":"Tests","hidden":false},{"type":"ci","section":"CI/CD","hidden":false},{"type":"refactor","section":"Maintenance","hidden":false},{"type":"perf","section":"Maintenance","hidden":false},{"type":"revert","section":"Maintenance","hidden":true},{"type":"docs","section":"Documentation","hidden":false},{"type":"security","section":"Security","hidden":false}]' + changelog-types: '[{"type":"maintain","section":"Maintenance","hidden":false},{"type":"resolve","section":"Miscellaneous","hidden":true},{"type":"add","section":"Features","hidden":false},{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"bug","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":true},{"type":"test","section":"Tests","hidden":false},{"type":"ci","section":"CI/CD","hidden":false},{"type":"refactor","section":"Maintenance","hidden":false},{"type":"perf","section":"Maintenance","hidden":false},{"type":"revert","section":"Maintenance","hidden":true},{"type":"docs","section":"Documentation","hidden":false},{"type":"security","section":"Security","hidden":false}]' diff --git a/.gitignore b/.gitignore index 6912735..31fe342 100644 --- a/.gitignore +++ b/.gitignore @@ -131,4 +131,4 @@ dmypy.json # Custom .DS_Store -/models +codecov diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a1e1372..ef5e424 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,6 +13,7 @@ repos: "ci", "docs", "feat", + "bug", "fix", "refactor", "revert", @@ -21,6 +22,7 @@ repos: "perf", "resolve", "merge", + "maintain", ] - repo: https://github.com/pre-commit/pre-commit-hooks @@ -41,6 +43,11 @@ repos: - id: fix-byte-order-marker - id: forbid-new-submodules + - repo: https://github.com/bwhmather/ssort + rev: v0.11.6 + hooks: + - id: ssort + - repo: https://github.com/asottile/pyupgrade rev: v3.3.1 hooks: diff --git a/.vscode/settings.json b/.vscode/settings.json index 6fbbf1b..85d383e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,4 +4,7 @@ ], "python.testing.unittestEnabled": false, "python.testing.pytestEnabled": true, + "cSpell.words": [ + "blitzly" + ], } diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index ed5b3a7..97d0a5a 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -56,6 +56,16 @@ Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +[christopher.lemke@invia.de](mailto:christopher.lemke@invia.de). +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + ## Enforcement Guidelines Community leaders will follow these Community Impact Guidelines in determining diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index c48d40d..09a5db0 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -1,5 +1,7 @@ # How to contribute +Thank 🙏 you for your interest in contributing to this project! Please read this document to get started. + ## Poetry We are using [Poetry](https://python-poetry.org/) to manage the dependencies, for deployment, and the virtual environment. If you have not used it before please check out the [documentation](https://python-poetry.org/docs/) to get started. @@ -16,7 +18,7 @@ pre-commit install --hook-type commit-msg ``` ## Homebrew -We are using [Homebrew](https://brew.sh/) to manage the dependencies for the development environment. Please install Homebrew and run +We are using [Homebrew](https://brew.sh/) to manage the dependencies for the development environment. Please install Homebrew and run: ```bash brew bundle ``` @@ -27,10 +29,9 @@ We are using [Conventional Commits](https://www.conventionalcommits.org) to ensu ```bash [optional scope]: ``` - E.g.: ```bash -feat: add a new fantastic plot 📈 +feat: new fantastic plot 📈 ``` ## How to contribute @@ -42,7 +43,7 @@ The following steps will give a short guide on how to contribute to this project - If you created your fork a while ago be sure to pull upstream changes into your local repository. - Create a new branch to work on! Start from `develop` if it exists, else from `main`. - Implement/fix your feature, comment your code, and add some examples. -- Follow the code style of the project, including indentation. [Black](https://github.com/psf/black), [isort](https://github.com/PyCQA/isort), [Pylint](https://github.com/PyCQA/pylint), and [mypy](https://github.com/python/mypy) can help you with it. +- Follow the code style of the project, including indentation. [Black](https://github.com/psf/black), [isort](https://github.com/PyCQA/isort), [Pylint](https://github.com/PyCQA/pylint), [mypy](https://github.com/python/mypy), and [ssort](https://github.com/bwhmather/ssort) can help you with it. - Run all tests. - Write or adapt tests as needed. - Add or change the documentation as needed. Please follow the "[Google Python Style Guide](https://google.github.io/styleguide/pyguide.html)". @@ -51,3 +52,131 @@ The following steps will give a short guide on how to contribute to this project - From your fork open a pull request in the correct branch. Target the project's `develop` branch! - Once the pull request is approved and merged you can pull the changes from `upstream` to your local repo and delete your extra branch(es). + +## Example +This is a simple example of a possible implementation of a new function: +```python +def simple_dumbbell( + data: Union[pd.DataFrame, NDArray], + title: str = "Dumbbell plot", + marker_size: int = 16, + marker_line_width: int = 8, + plotly_kwargs: Optional[dict] = None, + size: Optional[Tuple[int, int]] = None, + show_legend: Optional[bool] = None, + show: bool = True, + write_html_path: Optional[str] = None, +) -> BaseFigure: + + """ + Creates a dumbbell plot. These are useful to show the difference between + two sets of data which have the same categories. For instance, it can be + used to compare two binary classifiers by plotting the various classification + metrics. + + Example: + ```python + from blitzly.plots.dumbbell import simple_dumbbell + import numpy as np + import pandas as pd + + data = { + "foo": np.random.randn(10), + "bar": np.random.randn(10), + } + index = [f"category_{i+1}" for i in range(10)] + df = pd.DataFrame(data, index=index) + + simple_dumbbell(df) + ``` + + Args: + data (Union[pd.DataFrame, NDArray]): Data to plot. + title (str): Title of the plot. + marker_size (int): Size of the circular marker of the dumbbells. + marker_line_width (int): Thickness of the line joining the markers. + plotly_kwargs (Optional[dict]): Additional keyword arguments to pass to Plotly `go.Scatter`. + size (Optional[Tuple[int, int]): Size of the plot. + show_legend (Optional[bool]): Whether to show the legend. + show (bool): Whether to show the figure. + write_html_path (Optional[str]): The path to which the histogram should be written as an HTML file. + If None, the histogram will not be saved. + + Returns: + BaseFigure: The dumbbell plot. + """ + + data = check_data(data, min_rows=1, min_columns=2, max_columns=2, as_pandas=True) + + fig = go.Figure() + + for index, row in data.iterrows(): + fig.add_trace( + go.Scatter( + x=[row.iloc[0], row.iloc[1]], + y=[index, index], + mode="lines", + showlegend=False, + line={ + "color": "black", + "width": marker_line_width, + }, + ) + ) + + for column_idx, column_name in enumerate(data.columns): + fig.add_trace( + go.Scatter( + x=data.iloc[:, column_idx], + y=data.index, + mode="markers", + name=column_name, + **plotly_kwargs if plotly_kwargs else {}, + ) + ) + + fig.update_traces( + marker=dict(size=marker_size), + ) + + fig = update_figure_layout(fig, title, size, show_legend) + return save_show_return(fig, write_html_path, show) +``` + +Let's go through the code step by step: +1. To make blitzly ⚡️ simple to use try to provide as many default arguments as possible. Also don't forget to add type hints: + ```python + title: str = "Dumbbell plot" + ``` + **Yea!** 🥳 + + ```python + title + ``` + **Nay!** 😢 + +2. Every function in blitzly ⚡️ requires the following arguments: + ```python + plotly_kwargs: Optional[dict] = None, + show: bool = True, + write_html_path: Optional[str] = None + ``` + More about this in the next steps. + +3. Each function should return `BaseFigure`. This gives the user the possibility to use the returned Plotly figure in every possible way. + +4. The function should have a docstring. The docstring should follow the [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html). The docstring should contain a short description of the function, a short example, a list of all arguments, and a description of the return value. + +5. [`check_data`](https://invia-flights.github.io/blitzly/utils/#blitzly.etc.utils.check_data) is used for validating and preparing the data for the plot. Please don't forget to add it to your implementation. + +6. So no code is repeated we use [`update_figure_layout`](https://invia-flights.github.io/blitzly/utils/#blitzly.etc.utils.update_figure_layout) to update the layout of the figure. + +7. [`save_show_return`](https://invia-flights.github.io/blitzly/utils/#blitzly.etc.utils.save_show_return) is used to save the figure as an HTML file - if needed, shows the figure, and returns the figure. The use of this function is also mandatory. + +8. When you work on the implementation try to make the implementation as generic as possible. In other words, try to wrap a powerful Plotly implementation in your blitzly function and pass as many arguments as possible to the user while giving default arguments. In addition to this please also provide a `plotly_kwargs` argument which allows the user to pass additional keyword arguments to the Plotly function. This way the user can customize the plot as much as possible. + +9. Don't forget to write some meaningful unit tests. The tests should cover all possible use cases of the function and should be located in the `tests/test_cases` folder and should be named `test_.py`. + +10. Documentation: Please add your new blitly ⚡️ plot to the list in the [`README.md`](https://github.com/invia-flights/blitzly#available-plots-so-far-) file. If you think your plot implementation is worth to be documented even more, feel free to add it together with a short description to the end of the [`playground.ipynb`](https://github.com/invia-flights/blitzly/blob/main/examples/playground.ipynb) notebook. + +That's it! 🎉 Happy ploding (plotting + coding)! 📊👩‍💻 If you have any questions feel free to contact us! diff --git a/docs/README.md b/docs/README.md index c3856cd..1a01cd8 100644 --- a/docs/README.md +++ b/docs/README.md @@ -5,6 +5,7 @@ [![DeployPackage](https://github.com/invia-flights/blitzly/actions/workflows/deploy-package.yml/badge.svg)](https://github.com/invia-flights/blitzly/actions/workflows/deploy-package.yml) [![Testing](https://github.com/invia-flights/blitzly/actions/workflows/testing.yml/badge.svg?branch=main)](https://github.com/invia-flights/blitzly/actions/workflows/testing.yml) [![codecov](https://codecov.io/gh/invia-flights/blitzly/branch/develop/graph/badge.svg?token=ROCDJJV8JV)](https://codecov.io/gh/invia-flights/blitzly) +[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/invia-flights/blitzly/blob/main/examples/playground.ipynb) [![pypi](https://img.shields.io/pypi/v/blitzly)](https://pypi.org/project/blitzly/) [![PyPI - Downloads](https://img.shields.io/pypi/dm/blitzly)](https://pypistats.org/packages/blitzly) [![python version](https://img.shields.io/pypi/pyversions/blitzly?logo=python&logoColor=yellow)](https://www.python.org/downloads/) @@ -18,7 +19,7 @@ ## Introduction 🎉 Plotly is great and powerful. But with great power comes great responsibility 🕸. And sometimes you just want to get a plot up and running as fast as possible. That's where blitzly ⚡️ comes in. It provides a set of functions that allow you to create plots with Plotly in a lightning-fast way. It's not meant to replace Plotly, but rather to complement it. -Check out some examples in the [Jupyter notebook](https://github.com/invia-flights/blitzly/blob/main/examples/playground.ipynb):
+Check out some examples in the [Jupyter notebook](https://github.com/invia-flights/blitzly/blob/main/examples/playground.ipynb).
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/invia-flights/blitzly/blob/main/examples/playground.ipynb) ## Install the package 📦 diff --git a/examples/playground.ipynb b/examples/playground.ipynb index c18272a..a33fc62 100644 --- a/examples/playground.ipynb +++ b/examples/playground.ipynb @@ -210,7 +210,7 @@ ], "metadata": { "kernelspec": { - "display_name": "blitzly", + "display_name": "plotly", "language": "python", "name": "python3" }, @@ -228,7 +228,7 @@ }, "vscode": { "interpreter": { - "hash": "f4fa492d61aa4bd4bbaeb19b5818168dde89106ff3309a91e7db70fcb63410b9" + "hash": "797bdba0bac3be9cd36b18a3613c96bf1dbb820419cf6fd1cafb2b83e9b9f245" } } }, diff --git a/poetry.lock b/poetry.lock index ee7b38a..0f66687 100644 --- a/poetry.lock +++ b/poetry.lock @@ -885,23 +885,25 @@ mkdocs = ">=1.1" [[package]] name = "mkdocs-material" -version = "8.5.11" +version = "9.0.2" description = "Documentation that simply works" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "mkdocs_material-8.5.11-py3-none-any.whl", hash = "sha256:c907b4b052240a5778074a30a78f31a1f8ff82d7012356dc26898b97559f082e"}, - {file = "mkdocs_material-8.5.11.tar.gz", hash = "sha256:b0ea0513fd8cab323e8a825d6692ea07fa83e917bb5db042e523afecc7064ab7"}, + {file = "mkdocs_material-9.0.2-py3-none-any.whl", hash = "sha256:e2f0af24be09c2aaea88a70bac9fcca976276074931c06fd0631b1981f5c74ad"}, + {file = "mkdocs_material-9.0.2.tar.gz", hash = "sha256:c24e2127ada1d4d3deff09fa4bbe0a22f6e6bb7eaf7616e193138bf2a40d6580"}, ] [package.dependencies] -jinja2 = ">=3.0.2" +colorama = ">=0.4" +jinja2 = ">=3.0" markdown = ">=3.2" -mkdocs = ">=1.4.0" +mkdocs = ">=1.4.2" mkdocs-material-extensions = ">=1.1" -pygments = ">=2.12" -pymdown-extensions = ">=9.4" +pygments = ">=2.14" +pymdown-extensions = ">=9.9" +regex = ">=2022.4.24" requests = ">=2.26" [[package]] @@ -1690,6 +1692,104 @@ files = [ [package.dependencies] pyyaml = "*" +[[package]] +name = "regex" +version = "2022.10.31" +description = "Alternative regular expression module, to replace re." +category = "dev" +optional = false +python-versions = ">=3.6" +files = [ + {file = "regex-2022.10.31-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:a8ff454ef0bb061e37df03557afda9d785c905dab15584860f982e88be73015f"}, + {file = "regex-2022.10.31-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:1eba476b1b242620c266edf6325b443a2e22b633217a9835a52d8da2b5c051f9"}, + {file = "regex-2022.10.31-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d0e5af9a9effb88535a472e19169e09ce750c3d442fb222254a276d77808620b"}, + {file = "regex-2022.10.31-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d03fe67b2325cb3f09be029fd5da8df9e6974f0cde2c2ac6a79d2634e791dd57"}, + {file = "regex-2022.10.31-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a9d0b68ac1743964755ae2d89772c7e6fb0118acd4d0b7464eaf3921c6b49dd4"}, + {file = "regex-2022.10.31-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8a45b6514861916c429e6059a55cf7db74670eaed2052a648e3e4d04f070e001"}, + {file = "regex-2022.10.31-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8b0886885f7323beea6f552c28bff62cbe0983b9fbb94126531693ea6c5ebb90"}, + {file = "regex-2022.10.31-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:5aefb84a301327ad115e9d346c8e2760009131d9d4b4c6b213648d02e2abe144"}, + {file = "regex-2022.10.31-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:702d8fc6f25bbf412ee706bd73019da5e44a8400861dfff7ff31eb5b4a1276dc"}, + {file = "regex-2022.10.31-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:a3c1ebd4ed8e76e886507c9eddb1a891673686c813adf889b864a17fafcf6d66"}, + {file = "regex-2022.10.31-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:50921c140561d3db2ab9f5b11c5184846cde686bb5a9dc64cae442926e86f3af"}, + {file = "regex-2022.10.31-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:7db345956ecce0c99b97b042b4ca7326feeec6b75facd8390af73b18e2650ffc"}, + {file = "regex-2022.10.31-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:763b64853b0a8f4f9cfb41a76a4a85a9bcda7fdda5cb057016e7706fde928e66"}, + {file = "regex-2022.10.31-cp310-cp310-win32.whl", hash = "sha256:44136355e2f5e06bf6b23d337a75386371ba742ffa771440b85bed367c1318d1"}, + {file = "regex-2022.10.31-cp310-cp310-win_amd64.whl", hash = "sha256:bfff48c7bd23c6e2aec6454aaf6edc44444b229e94743b34bdcdda2e35126cf5"}, + {file = "regex-2022.10.31-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:4b4b1fe58cd102d75ef0552cf17242705ce0759f9695334a56644ad2d83903fe"}, + {file = "regex-2022.10.31-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:542e3e306d1669b25936b64917285cdffcd4f5c6f0247636fec037187bd93542"}, + {file = "regex-2022.10.31-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c27cc1e4b197092e50ddbf0118c788d9977f3f8f35bfbbd3e76c1846a3443df7"}, + {file = "regex-2022.10.31-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b8e38472739028e5f2c3a4aded0ab7eadc447f0d84f310c7a8bb697ec417229e"}, + {file = "regex-2022.10.31-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:76c598ca73ec73a2f568e2a72ba46c3b6c8690ad9a07092b18e48ceb936e9f0c"}, + {file = "regex-2022.10.31-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c28d3309ebd6d6b2cf82969b5179bed5fefe6142c70f354ece94324fa11bf6a1"}, + {file = "regex-2022.10.31-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9af69f6746120998cd9c355e9c3c6aec7dff70d47247188feb4f829502be8ab4"}, + {file = "regex-2022.10.31-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:a5f9505efd574d1e5b4a76ac9dd92a12acb2b309551e9aa874c13c11caefbe4f"}, + {file = "regex-2022.10.31-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:5ff525698de226c0ca743bfa71fc6b378cda2ddcf0d22d7c37b1cc925c9650a5"}, + {file = "regex-2022.10.31-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:4fe7fda2fe7c8890d454f2cbc91d6c01baf206fbc96d89a80241a02985118c0c"}, + {file = "regex-2022.10.31-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:2cdc55ca07b4e70dda898d2ab7150ecf17c990076d3acd7a5f3b25cb23a69f1c"}, + {file = "regex-2022.10.31-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:44a6c2f6374e0033873e9ed577a54a3602b4f609867794c1a3ebba65e4c93ee7"}, + {file = "regex-2022.10.31-cp311-cp311-win32.whl", hash = "sha256:d8716f82502997b3d0895d1c64c3b834181b1eaca28f3f6336a71777e437c2af"}, + {file = "regex-2022.10.31-cp311-cp311-win_amd64.whl", hash = "sha256:61edbca89aa3f5ef7ecac8c23d975fe7261c12665f1d90a6b1af527bba86ce61"}, + {file = "regex-2022.10.31-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:0a069c8483466806ab94ea9068c34b200b8bfc66b6762f45a831c4baaa9e8cdd"}, + {file = "regex-2022.10.31-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d26166acf62f731f50bdd885b04b38828436d74e8e362bfcb8df221d868b5d9b"}, + {file = "regex-2022.10.31-cp36-cp36m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ac741bf78b9bb432e2d314439275235f41656e189856b11fb4e774d9f7246d81"}, + {file = "regex-2022.10.31-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:75f591b2055523fc02a4bbe598aa867df9e953255f0b7f7715d2a36a9c30065c"}, + {file = "regex-2022.10.31-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6b30bddd61d2a3261f025ad0f9ee2586988c6a00c780a2fb0a92cea2aa702c54"}, + {file = "regex-2022.10.31-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ef4163770525257876f10e8ece1cf25b71468316f61451ded1a6f44273eedeb5"}, + {file = "regex-2022.10.31-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:7b280948d00bd3973c1998f92e22aa3ecb76682e3a4255f33e1020bd32adf443"}, + {file = "regex-2022.10.31-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:d0213671691e341f6849bf33cd9fad21f7b1cb88b89e024f33370733fec58742"}, + {file = "regex-2022.10.31-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:22e7ebc231d28393dfdc19b185d97e14a0f178bedd78e85aad660e93b646604e"}, + {file = "regex-2022.10.31-cp36-cp36m-musllinux_1_1_ppc64le.whl", hash = "sha256:8ad241da7fac963d7573cc67a064c57c58766b62a9a20c452ca1f21050868dfa"}, + {file = "regex-2022.10.31-cp36-cp36m-musllinux_1_1_s390x.whl", hash = "sha256:586b36ebda81e6c1a9c5a5d0bfdc236399ba6595e1397842fd4a45648c30f35e"}, + {file = "regex-2022.10.31-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:0653d012b3bf45f194e5e6a41df9258811ac8fc395579fa82958a8b76286bea4"}, + {file = "regex-2022.10.31-cp36-cp36m-win32.whl", hash = "sha256:144486e029793a733e43b2e37df16a16df4ceb62102636ff3db6033994711066"}, + {file = "regex-2022.10.31-cp36-cp36m-win_amd64.whl", hash = "sha256:c14b63c9d7bab795d17392c7c1f9aaabbffd4cf4387725a0ac69109fb3b550c6"}, + {file = "regex-2022.10.31-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:4cac3405d8dda8bc6ed499557625585544dd5cbf32072dcc72b5a176cb1271c8"}, + {file = "regex-2022.10.31-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:23cbb932cc53a86ebde0fb72e7e645f9a5eec1a5af7aa9ce333e46286caef783"}, + {file = "regex-2022.10.31-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:74bcab50a13960f2a610cdcd066e25f1fd59e23b69637c92ad470784a51b1347"}, + {file = "regex-2022.10.31-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:78d680ef3e4d405f36f0d6d1ea54e740366f061645930072d39bca16a10d8c93"}, + {file = "regex-2022.10.31-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ce6910b56b700bea7be82c54ddf2e0ed792a577dfaa4a76b9af07d550af435c6"}, + {file = "regex-2022.10.31-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:659175b2144d199560d99a8d13b2228b85e6019b6e09e556209dfb8c37b78a11"}, + {file = "regex-2022.10.31-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:1ddf14031a3882f684b8642cb74eea3af93a2be68893901b2b387c5fd92a03ec"}, + {file = "regex-2022.10.31-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:b683e5fd7f74fb66e89a1ed16076dbab3f8e9f34c18b1979ded614fe10cdc4d9"}, + {file = "regex-2022.10.31-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:2bde29cc44fa81c0a0c8686992c3080b37c488df167a371500b2a43ce9f026d1"}, + {file = "regex-2022.10.31-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:4919899577ba37f505aaebdf6e7dc812d55e8f097331312db7f1aab18767cce8"}, + {file = "regex-2022.10.31-cp37-cp37m-musllinux_1_1_s390x.whl", hash = "sha256:9c94f7cc91ab16b36ba5ce476f1904c91d6c92441f01cd61a8e2729442d6fcf5"}, + {file = "regex-2022.10.31-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:ae1e96785696b543394a4e3f15f3f225d44f3c55dafe3f206493031419fedf95"}, + {file = "regex-2022.10.31-cp37-cp37m-win32.whl", hash = "sha256:c670f4773f2f6f1957ff8a3962c7dd12e4be54d05839b216cb7fd70b5a1df394"}, + {file = "regex-2022.10.31-cp37-cp37m-win_amd64.whl", hash = "sha256:8e0caeff18b96ea90fc0eb6e3bdb2b10ab5b01a95128dfeccb64a7238decf5f0"}, + {file = "regex-2022.10.31-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:131d4be09bea7ce2577f9623e415cab287a3c8e0624f778c1d955ec7c281bd4d"}, + {file = "regex-2022.10.31-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:e613a98ead2005c4ce037c7b061f2409a1a4e45099edb0ef3200ee26ed2a69a8"}, + {file = "regex-2022.10.31-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:052b670fafbe30966bbe5d025e90b2a491f85dfe5b2583a163b5e60a85a321ad"}, + {file = "regex-2022.10.31-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:aa62a07ac93b7cb6b7d0389d8ef57ffc321d78f60c037b19dfa78d6b17c928ee"}, + {file = "regex-2022.10.31-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5352bea8a8f84b89d45ccc503f390a6be77917932b1c98c4cdc3565137acc714"}, + {file = "regex-2022.10.31-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:20f61c9944f0be2dc2b75689ba409938c14876c19d02f7585af4460b6a21403e"}, + {file = "regex-2022.10.31-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:29c04741b9ae13d1e94cf93fca257730b97ce6ea64cfe1eba11cf9ac4e85afb6"}, + {file = "regex-2022.10.31-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:543883e3496c8b6d58bd036c99486c3c8387c2fc01f7a342b760c1ea3158a318"}, + {file = "regex-2022.10.31-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:b7a8b43ee64ca8f4befa2bea4083f7c52c92864d8518244bfa6e88c751fa8fff"}, + {file = "regex-2022.10.31-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:6a9a19bea8495bb419dc5d38c4519567781cd8d571c72efc6aa959473d10221a"}, + {file = "regex-2022.10.31-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:6ffd55b5aedc6f25fd8d9f905c9376ca44fcf768673ffb9d160dd6f409bfda73"}, + {file = "regex-2022.10.31-cp38-cp38-musllinux_1_1_s390x.whl", hash = "sha256:4bdd56ee719a8f751cf5a593476a441c4e56c9b64dc1f0f30902858c4ef8771d"}, + {file = "regex-2022.10.31-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:8ca88da1bd78990b536c4a7765f719803eb4f8f9971cc22d6ca965c10a7f2c4c"}, + {file = "regex-2022.10.31-cp38-cp38-win32.whl", hash = "sha256:5a260758454580f11dd8743fa98319bb046037dfab4f7828008909d0aa5292bc"}, + {file = "regex-2022.10.31-cp38-cp38-win_amd64.whl", hash = "sha256:5e6a5567078b3eaed93558842346c9d678e116ab0135e22eb72db8325e90b453"}, + {file = "regex-2022.10.31-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:5217c25229b6a85049416a5c1e6451e9060a1edcf988641e309dbe3ab26d3e49"}, + {file = "regex-2022.10.31-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4bf41b8b0a80708f7e0384519795e80dcb44d7199a35d52c15cc674d10b3081b"}, + {file = "regex-2022.10.31-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0cf0da36a212978be2c2e2e2d04bdff46f850108fccc1851332bcae51c8907cc"}, + {file = "regex-2022.10.31-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d403d781b0e06d2922435ce3b8d2376579f0c217ae491e273bab8d092727d244"}, + {file = "regex-2022.10.31-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a37d51fa9a00d265cf73f3de3930fa9c41548177ba4f0faf76e61d512c774690"}, + {file = "regex-2022.10.31-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e4f781ffedd17b0b834c8731b75cce2639d5a8afe961c1e58ee7f1f20b3af185"}, + {file = "regex-2022.10.31-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d243b36fbf3d73c25e48014961e83c19c9cc92530516ce3c43050ea6276a2ab7"}, + {file = "regex-2022.10.31-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:370f6e97d02bf2dd20d7468ce4f38e173a124e769762d00beadec3bc2f4b3bc4"}, + {file = "regex-2022.10.31-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:597f899f4ed42a38df7b0e46714880fb4e19a25c2f66e5c908805466721760f5"}, + {file = "regex-2022.10.31-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:7dbdce0c534bbf52274b94768b3498abdf675a691fec5f751b6057b3030f34c1"}, + {file = "regex-2022.10.31-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:22960019a842777a9fa5134c2364efaed5fbf9610ddc5c904bd3a400973b0eb8"}, + {file = "regex-2022.10.31-cp39-cp39-musllinux_1_1_s390x.whl", hash = "sha256:7f5a3ffc731494f1a57bd91c47dc483a1e10048131ffb52d901bfe2beb6102e8"}, + {file = "regex-2022.10.31-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:7ef6b5942e6bfc5706301a18a62300c60db9af7f6368042227ccb7eeb22d0892"}, + {file = "regex-2022.10.31-cp39-cp39-win32.whl", hash = "sha256:395161bbdbd04a8333b9ff9763a05e9ceb4fe210e3c7690f5e68cedd3d65d8e1"}, + {file = "regex-2022.10.31-cp39-cp39-win_amd64.whl", hash = "sha256:957403a978e10fb3ca42572a23e6f7badff39aa1ce2f4ade68ee452dc6807692"}, + {file = "regex-2022.10.31.tar.gz", hash = "sha256:a3a98921da9a1bf8457aeee6a551948a83601689e5ecdd736894ea9bbec77e83"}, +] + [[package]] name = "requests" version = "2.28.1" @@ -1835,6 +1935,20 @@ files = [ {file = "smmap-5.0.0.tar.gz", hash = "sha256:c840e62059cd3be204b0c9c9f74be2c09d5648eddd4580d9314c3ecde0b30936"}, ] +[[package]] +name = "ssort" +version = "0.11.6" +description = "The python statement sorter" +category = "dev" +optional = false +python-versions = ">=3.8" +files = [ + {file = "ssort-0.11.6.tar.gz", hash = "sha256:21fec493487f32dff50d30efa5b6aad18286e9817600b64bfe686ae062bae7ae"}, +] + +[package.dependencies] +pathspec = ">=0.9.0" + [[package]] name = "stack-data" version = "0.6.2" @@ -2145,4 +2259,4 @@ testing = ["flake8 (<5)", "func-timeout", "jaraco.functools", "jaraco.itertools" [metadata] lock-version = "2.0" python-versions = ">=3.8,<3.12" -content-hash = "b0297a148b497adfd8ffb49a716ce843a0083a21f168b64b3e992a6d2a55a496" +content-hash = "60d60f3032a5e4b1fc21cd89b8bee6ef7ef55d4c22b440120ea2cc37493d5cab" diff --git a/pyproject.toml b/pyproject.toml index 86b1b8b..e5f94a3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,11 +8,14 @@ readme = "docs/README.md" documentation = "https://invia-flights.github.io/blitzly" repository = "https://github.com/invia-flights/blitzly" license = "MIT" +include = ["CHANGELOG.md"] classifiers = [ + "Intended Audience :: Science/Research", + "Natural Language :: English", "Topic :: Scientific/Engineering :: Information Analysis", "Topic :: Scientific/Engineering :: Visualization", - "Intended Audience :: Science/Research", + "Typing :: Typed", ] keywords = [ "python", @@ -22,6 +25,12 @@ keywords = [ "plotting", ] +[tool.poetry.urls] +Changelog = "https://github.com/invia-flights/blitzly/blob/main/CHANGELOG.md" +Issues = "https://github.com/invia-flights/blitzly/issues" +Discussions = "https://github.com/invia-flights/blitzly/discussions" +Contributing = "https://github.com/invia-flights/blitzly/blob/main/docs/CONTRIBUTING.md" + [tool.poetry.dependencies] python = ">=3.8,<3.12" @@ -46,11 +55,12 @@ mypy = "^0.991" pylint = "^2.15.9" pre-commit = "^2.20.0" nbstripout = "^0.6.1" +ssort = "^0.11.6" [tool.poetry.group.docs.dependencies] mkdocs = "1.4.2" mkdocstrings = {extras = ["python"], version = "0.19.1"} -mkdocs-material = "8.5.11" +mkdocs-material = "9.0.2" [tool.poetry.group.dev] optional = true diff --git a/requirements.txt b/requirements.txt index 8e3e053..6dfd064 100644 --- a/requirements.txt +++ b/requirements.txt @@ -86,26 +86,43 @@ jsonschema==4.17.3 ; python_version >= "3.8" and python_version < "3.12" \ jupyter-core==5.1.2 ; python_version >= "3.8" and python_version < "3.12" \ --hash=sha256:0f99cc639c8d00d591acfcc028aeea81473ea6c72fabe86426398220e2d91b1d \ --hash=sha256:62b00d52f030643d29f86aafdfd9b36d42421823599a272eb4c2df1d1cc7f723 -lazy-object-proxy==1.8.0 ; python_version >= "3.8" and python_version < "3.12" \ - --hash=sha256:0c1c7c0433154bb7c54185714c6929acc0ba04ee1b167314a779b9025517eada \ - --hash=sha256:14010b49a2f56ec4943b6cf925f597b534ee2fe1f0738c84b3bce0c1a11ff10d \ - --hash=sha256:4e2d9f764f1befd8bdc97673261b8bb888764dfdbd7a4d8f55e4fbcabb8c3fb7 \ - --hash=sha256:4fd031589121ad46e293629b39604031d354043bb5cdf83da4e93c2d7f3389fe \ - --hash=sha256:5b51d6f3bfeb289dfd4e95de2ecd464cd51982fe6f00e2be1d0bf94864d58acd \ - --hash=sha256:6850e4aeca6d0df35bb06e05c8b934ff7c533734eb51d0ceb2d63696f1e6030c \ - --hash=sha256:6f593f26c470a379cf7f5bc6db6b5f1722353e7bf937b8d0d0b3fba911998858 \ - --hash=sha256:71d9ae8a82203511a6f60ca5a1b9f8ad201cac0fc75038b2dc5fa519589c9288 \ - --hash=sha256:7e1561626c49cb394268edd00501b289053a652ed762c58e1081224c8d881cec \ - --hash=sha256:8f6ce2118a90efa7f62dd38c7dbfffd42f468b180287b748626293bf12ed468f \ - --hash=sha256:ae032743794fba4d171b5b67310d69176287b5bf82a21f588282406a79498891 \ - --hash=sha256:afcaa24e48bb23b3be31e329deb3f1858f1f1df86aea3d70cb5c8578bfe5261c \ - --hash=sha256:b70d6e7a332eb0217e7872a73926ad4fdc14f846e85ad6749ad111084e76df25 \ - --hash=sha256:c219a00245af0f6fa4e95901ed28044544f50152840c5b6a3e7b2568db34d156 \ - --hash=sha256:ce58b2b3734c73e68f0e30e4e725264d4d6be95818ec0a0be4bb6bf9a7e79aa8 \ - --hash=sha256:d176f392dbbdaacccf15919c77f526edf11a34aece58b55ab58539807b85436f \ - --hash=sha256:e20bfa6db17a39c706d24f82df8352488d2943a3b7ce7d4c22579cb89ca8896e \ - --hash=sha256:eac3a9a5ef13b332c059772fd40b4b1c3d45a3a2b05e33a361dee48e54a4dad0 \ - --hash=sha256:eb329f8d8145379bf5dbe722182410fe8863d186e51bf034d2075eb8d85ee25b +lazy-object-proxy==1.9.0 ; python_version >= "3.8" and python_version < "3.12" \ + --hash=sha256:09763491ce220c0299688940f8dc2c5d05fd1f45af1e42e636b2e8b2303e4382 \ + --hash=sha256:0a891e4e41b54fd5b8313b96399f8b0e173bbbfc03c7631f01efbe29bb0bcf82 \ + --hash=sha256:189bbd5d41ae7a498397287c408617fe5c48633e7755287b21d741f7db2706a9 \ + --hash=sha256:18b78ec83edbbeb69efdc0e9c1cb41a3b1b1ed11ddd8ded602464c3fc6020494 \ + --hash=sha256:1aa3de4088c89a1b69f8ec0dcc169aa725b0ff017899ac568fe44ddc1396df46 \ + --hash=sha256:212774e4dfa851e74d393a2370871e174d7ff0ebc980907723bb67d25c8a7c30 \ + --hash=sha256:2d0daa332786cf3bb49e10dc6a17a52f6a8f9601b4cf5c295a4f85854d61de63 \ + --hash=sha256:5f83ac4d83ef0ab017683d715ed356e30dd48a93746309c8f3517e1287523ef4 \ + --hash=sha256:659fb5809fa4629b8a1ac5106f669cfc7bef26fbb389dda53b3e010d1ac4ebae \ + --hash=sha256:660c94ea760b3ce47d1855a30984c78327500493d396eac4dfd8bd82041b22be \ + --hash=sha256:66a3de4a3ec06cd8af3f61b8e1ec67614fbb7c995d02fa224813cb7afefee701 \ + --hash=sha256:721532711daa7db0d8b779b0bb0318fa87af1c10d7fe5e52ef30f8eff254d0cd \ + --hash=sha256:7322c3d6f1766d4ef1e51a465f47955f1e8123caee67dd641e67d539a534d006 \ + --hash=sha256:79a31b086e7e68b24b99b23d57723ef7e2c6d81ed21007b6281ebcd1688acb0a \ + --hash=sha256:81fc4d08b062b535d95c9ea70dbe8a335c45c04029878e62d744bdced5141586 \ + --hash=sha256:8fa02eaab317b1e9e03f69aab1f91e120e7899b392c4fc19807a8278a07a97e8 \ + --hash=sha256:9090d8e53235aa280fc9239a86ae3ea8ac58eff66a705fa6aa2ec4968b95c821 \ + --hash=sha256:946d27deaff6cf8452ed0dba83ba38839a87f4f7a9732e8f9fd4107b21e6ff07 \ + --hash=sha256:9990d8e71b9f6488e91ad25f322898c136b008d87bf852ff65391b004da5e17b \ + --hash=sha256:9cd077f3d04a58e83d04b20e334f678c2b0ff9879b9375ed107d5d07ff160171 \ + --hash=sha256:9e7551208b2aded9c1447453ee366f1c4070602b3d932ace044715d89666899b \ + --hash=sha256:9f5fa4a61ce2438267163891961cfd5e32ec97a2c444e5b842d574251ade27d2 \ + --hash=sha256:b40387277b0ed2d0602b8293b94d7257e17d1479e257b4de114ea11a8cb7f2d7 \ + --hash=sha256:bfb38f9ffb53b942f2b5954e0f610f1e721ccebe9cce9025a38c8ccf4a5183a4 \ + --hash=sha256:cbf9b082426036e19c6924a9ce90c740a9861e2bdc27a4834fd0a910742ac1e8 \ + --hash=sha256:d9e25ef10a39e8afe59a5c348a4dbf29b4868ab76269f81ce1674494e2565a6e \ + --hash=sha256:db1c1722726f47e10e0b5fdbf15ac3b8adb58c091d12b3ab713965795036985f \ + --hash=sha256:e7c21c95cae3c05c14aafffe2865bbd5e377cfc1348c4f7751d9dc9a48ca4bda \ + --hash=sha256:e8c6cfb338b133fbdbc5cfaa10fe3c6aeea827db80c978dbd13bc9dd8526b7d4 \ + --hash=sha256:ea806fd4c37bf7e7ad82537b0757999264d5f70c45468447bb2b91afdbe73a6e \ + --hash=sha256:edd20c5a55acb67c7ed471fa2b5fb66cb17f61430b7a6b9c3b4a1e40293b1671 \ + --hash=sha256:f0117049dd1d5635bbff65444496c90e0baa48ea405125c088e93d9cf4525b11 \ + --hash=sha256:f0705c376533ed2a9e5e97aacdbfe04cecd71e0aa84c7c0595d02ef93b6e4455 \ + --hash=sha256:f12ad7126ae0c98d601a7ee504c1122bcef553d1d5e0c3bfa77b16b3968d2734 \ + --hash=sha256:f2457189d8257dd41ae9b434ba33298aec198e30adf2dcdaaa3a28b9994f6adb \ + --hash=sha256:f699ac1c768270c9e384e4cbd268d6e67aebcfae6cd623b4d7c3bfde5a35db59 matplotlib-inline==0.1.6 ; python_version >= "3.8" and python_version < "3.12" \ --hash=sha256:f1f41aab5328aa5aaea9b16d083b128102f8712542f819fe7e6a420ff581b311 \ --hash=sha256:f887e5f10ba98e8d2b150ddcf4702c1e5f8b3a20005eb0f74bfdbd360ee6f304 @@ -397,6 +414,8 @@ six==1.16.0 ; python_version >= "3.8" and python_version < "3.12" \ smmap==5.0.0 ; python_version >= "3.8" and python_version < "3.12" \ --hash=sha256:2aba19d6a040e78d8b09de5c57e96207b09ed71d8e55ce0959eeee6c8e190d94 \ --hash=sha256:c840e62059cd3be204b0c9c9f74be2c09d5648eddd4580d9314c3ecde0b30936 +ssort==0.11.6 ; python_version >= "3.8" and python_version < "3.12" \ + --hash=sha256:21fec493487f32dff50d30efa5b6aad18286e9817600b64bfe686ae062bae7ae stack-data==0.6.2 ; python_version >= "3.8" and python_version < "3.12" \ --hash=sha256:32d2dd0376772d01b6cb9fc996f3c8b57a357089dec328ed4b6553d037eaf815 \ --hash=sha256:cbb2a53eb64e5785878201a97ed7c7b94883f48b87bfb0bbe8b623c74679e4a8 diff --git a/src/blitzly/plots/bar.py b/src/blitzly/plots/bar.py index 7f18e16..48c6efe 100644 --- a/src/blitzly/plots/bar.py +++ b/src/blitzly/plots/bar.py @@ -11,6 +11,57 @@ from blitzly.etc.utils import check_data, save_show_return, update_figure_layout +def _check_data_ready_for_bar( + data: Union[pd.DataFrame, pd.Series, NDArray], + group_labels: List[str], + x_labels: List[str], + hover_texts: Optional[List[str]] = None, + errors: Optional[Union[pd.DataFrame, pd.Series, NDArray]] = None, +) -> None: + """ + Checks whether the data is ready for plotting. + + Args: + data (Union[pd.DataFrame, pd.Series, NDArray]): The data to plot. + group_labels (List[str]): The labels for the groups. + x_labels (List[str]): The labels for the x-axis. + hover_texts (Optional[List[str]]): The hover texts for the data. + errors (Optional[Union[pd.DataFrame, pd.Series, NDArray]]): The errors for the data. + + Raises: + ValueError: If the `data` is not at least two-dimensional. + ValueError: If the number of `group_labels` does not match the number of rows in the `data`. + ValueError: If the number of `x_labels` does not match the number of columns in the `data`. + ValueError: If the shape of the `errors` does not match the shape of the `data`. + ValueError: If the number of `hover_texts` does not match the number of columns in the `data`. + """ + + if data.ndim < 2: + raise ValueError( + f"The `data` must be at least two-dimensional! Got {data.ndim} dimension." + ) + + if data.shape[0] != len(group_labels): + raise ValueError( + f"The number of `group_labels` ({len(group_labels)}) does not match the number of rows in the `data` ({data.shape[0]})!" + ) + + if data.shape[1] != len(x_labels): + raise ValueError( + f"The number of `x_labels` ({len(x_labels)}) does not match the number of columns in the `data` ({data.shape[1]})!" + ) + + if isinstance(errors, np.ndarray) and data.shape != errors.shape: + raise ValueError( + f"The shape of the `errors` ({errors.shape}) does not match the shape of the `data` ({data.shape})!" + ) + + if hover_texts and len(hover_texts) != data.shape[1]: + raise ValueError( + f"The number of `hover_texts` ({len(hover_texts)}) does not match the number of columns in the `data` ({data.shape[1]})!" + ) + + def multi_bar( data: Union[pd.DataFrame, pd.Series, NDArray], group_labels: List[str], @@ -114,54 +165,3 @@ def multi_bar( fig, title, size, (show_legend and mark_x_labels is None) ) return save_show_return(fig, write_html_path, show) - - -def _check_data_ready_for_bar( - data: Union[pd.DataFrame, pd.Series, NDArray], - group_labels: List[str], - x_labels: List[str], - hover_texts: Optional[List[str]] = None, - errors: Optional[Union[pd.DataFrame, pd.Series, NDArray]] = None, -) -> None: - """ - Checks whether the data is ready for plotting. - - Args: - data (Union[pd.DataFrame, pd.Series, NDArray]): The data to plot. - group_labels (List[str]): The labels for the groups. - x_labels (List[str]): The labels for the x-axis. - hover_texts (Optional[List[str]]): The hover texts for the data. - errors (Optional[Union[pd.DataFrame, pd.Series, NDArray]]): The errors for the data. - - Raises: - ValueError: If the `data` is not at least two-dimensional. - ValueError: If the number of `group_labels` does not match the number of rows in the `data`. - ValueError: If the number of `x_labels` does not match the number of columns in the `data`. - ValueError: If the shape of the `errors` does not match the shape of the `data`. - ValueError: If the number of `hover_texts` does not match the number of columns in the `data`. - """ - - if data.ndim < 2: - raise ValueError( - f"The `data` must be at least two-dimensional! Got {data.ndim} dimension." - ) - - if data.shape[0] != len(group_labels): - raise ValueError( - f"The number of `group_labels` ({len(group_labels)}) does not match the number of rows in the `data` ({data.shape[0]})!" - ) - - if data.shape[1] != len(x_labels): - raise ValueError( - f"The number of `x_labels` ({len(x_labels)}) does not match the number of columns in the `data` ({data.shape[1]})!" - ) - - if isinstance(errors, np.ndarray) and data.shape != errors.shape: - raise ValueError( - f"The shape of the `errors` ({errors.shape}) does not match the shape of the `data` ({data.shape})!" - ) - - if hover_texts and len(hover_texts) != data.shape[1]: - raise ValueError( - f"The number of `hover_texts` ({len(hover_texts)}) does not match the number of columns in the `data` ({data.shape[1]})!" - ) diff --git a/src/blitzly/subplots.py b/src/blitzly/subplots.py index 47c5201..b3a3a9f 100644 --- a/src/blitzly/subplots.py +++ b/src/blitzly/subplots.py @@ -7,6 +7,26 @@ from blitzly.etc.utils import save_show_return, update_figure_layout +def _check_shape_for_subplots( + subfig_list: List[BaseFigure], shape: Tuple[int, int] +) -> None: + """ + Checks whether the `shape` is compatible for making subplots. + + Args: + subfig_list (List[BaseFigure]): A list of figure objects. + shape (Tuple[int, int]): The grid shape of the subplots. + + Raises: + ValueError: If the provided `shape` is too small for the list of subfigures. + """ + + if len(subfig_list) > np.prod(shape): + raise ValueError( + f"The number of subfigures ({len(subfig_list)}) is too large for the provided `shape` {shape}." + ) + + def make_subplots( subfig_list: List[BaseFigure], shape: Tuple[int, int], @@ -107,23 +127,3 @@ def make_subplots( fig.update_layout(showlegend=False) fig = update_figure_layout(fig, title, size) return save_show_return(fig, write_html_path, show) - - -def _check_shape_for_subplots( - subfig_list: List[BaseFigure], shape: Tuple[int, int] -) -> None: - """ - Checks whether the `shape` is compatible for making subplots. - - Args: - subfig_list (List[BaseFigure]): A list of figure objects. - shape (Tuple[int, int]): The grid shape of the subplots. - - Raises: - ValueError: If the provided `shape` is too small for the list of subfigures. - """ - - if len(subfig_list) > np.prod(shape): - raise ValueError( - f"The number of subfigures ({len(subfig_list)}) is too large for the provided `shape` {shape}." - )