This package provides type hinting and IDE support for plugins to the Polars package, enhancing the development experience.
pip install polar-patch
Polars is a fast DataFrame library for Python, but it lacks a way to provide type hints with type checker and IDE support for custom plugins. The polars maintainers have no plans to fill this gap from within polars itself. So Summit Sailors is stepping in to help.
With this package, developers can:
- Write more robust and maintainable polars plugins.
- Utilize IDE Type Checker features such as autocompletion and inline documentation.
- Extend the polars ecosystem with more incentive to create new plugins
- PP parses your ezpz_pluginz.toml
- scans files and folders you listed in ur toml
- uses libCST to extract the needed info about your plugins.
- generates a lockfile for all the plugin data it extracted
- creates a backup of the files to be modified
- uses a copy of the backup fresh each run
- applies the libCST transformer to add the attribute with type hint onto the corresponding Polars class
- adds the corresponding import for your plugin into polars in a type checking block
- It is important to note that while this is minimally invasive, it is monkey patching the executing interpreters polars package.
- libCST uses concrete syntax trees, thus the polars file is well preserved.
callable form ofpl.api
install plugins from site-packagesbasic logging- inital functional hypothesis testing setup
- basic exception handling
unpin 3.12.4 to ^3.12
- some maturity
- The blessing of the polars team for the approach on issue
- automatic "hot reloading" since the type hint points directly to the implementation
- loads plugins from site-packages and generates a lockfile
To specify paths to be scanned for plugins, create a ezpz_pluginz.toml file in your project root. (VSC IDE Support in Development)
[ezpz_pluginz]
include = ["path/to/your/plugin1.py", "path/to/your/polars/plugin/folder"]
To use the CLI tool provided by this package, run the following command:
pp mount
If you need to undo the changes made by this package, simply:
pp unmount