# corebridge
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
This package provides functions and classes to run wodan style
processing functions in the Stactics AICore environment.
## Installation
Use
``` sh
pip install corebridge
```
to install corebrdige.
## How to use
### Introduction
Wodan is a proprietary backend service that applies high performance,
custom analytical processing to timeseries data in the Whysor data and
dashboarding environment.
Each wodan module defines one function that operates as the entry point.
The parameter annotations in this function definition are used to format
data and retrieve parameters from the originating call to the wodan api.
This function is called with data retrieved according to a specification
and with additional parameters as annotated.
A simple function might look like:
``` {python}
import numpy as np
def multiply(data:np.ndarray, multiplier:float=1.0):
return data * multiplier
```
Wodan binds this function to a service endpoint and takes care of
fetching data and parameters and converting the result for the caller.
### AICore modules
For AICore users define a class, always named `CustomModule` with a
constructor `__init__` and a method `infer`.
This package defines a baseclass to quickly construct a `CustomModule`
class that is able to use a wodan processor function inside the AICore
system:
``` {python}
import numpy as np
import corebridge
def multiply(data:np.ndarray, multiplier:float=1.0):
return data * multiplier
class CustomModule(corebridge.aicorebridge.AICoreModule):
def __init__(self, save_dir, assets_dir, *args, **kwargs):
super().__init__(multiply, save_dir, assets_dir, *args, **kwargs)
```
That’s it. Well, you can add parameters to `__init__` that can be used
as hyperparameters in the web-interface and you could override `infer`
for the same reason. The baseclass takes care of converting call
parameters and data to the function specification and, calls the
function and converts the result for the caller, similar to the original
Wodan service.
## Development
### NBDev
This library is developed with [NBDev](https://nbdev.fast.ai/) - a
literate programming toolkit that supports developing code using jupyter
notebooks and mix code with documentation.
Literate programming is a methodology - introduced in 1984 by Donald
Knuth - that combines a programming language with a documentation
language. In this approach, a program is explained in a human language
(such as English) alongside code snippets. The literate source file is
then processed by a preprocessor to produce both source code and
formatted documentation.
This paradigm enhances program robustness, portability, and
maintainability, making it a valuable tool in scientific computing and
data science[^1]
### Quarto
Documentation is prepared from the notebook with
[Quarto](https://quarto.org/). Quarto too combines code with
documentation but it does not extract source code into modules like
nbdev.
### Installation
#### Quarto
Quarto uses Pandoc and, for pdf format, LaTeX. These must be available
on your system.
Install [Quarto](https://quarto.org/docs/get-started/) as you see fit,
there is a [VSCode
extension](https://marketplace.visualstudio.com/items?itemName=quarto.quarto)
which handles this.
#### NBDev
NBDev is available as PyPi package and is installed with
pip install nbdev
or if you are using conda
conda install -c fastai -y nbdev
If so desired you can let NBDev install Quarto with
nbdev_install_quarto
But this ask for the system admin password.
### Local editing & testing
Setup a virtual environment, activate it and install the development
package and dependencies with, on linux
pip install -e ‘.[dev]’
or on Windows
pip install -e .[dev]
#### Jupyter
The above pip install should also install jupyter but to use it the
kernel needs to be installed with:
python -m ipykernel install --user --name=corebridge.venv
### nbdev cycle
- edit
- nbdev_prepare
The latter performs - nbdev_export - nbdev_test - nbdev_clean -
nbdev_readme
Then commit and to upload to Pypi with `nbdev_pypi`
[^1]: [Wikipedia on ‘Literate
Programming’](https://en.wikipedia.org/wiki/Literate_programming)
Raw data
{
"_id": null,
"home_page": "https://github.com/fenke/corebridge",
"name": "corebridge",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "python aicore stactics whysor",
"author": "Fenke Meijer",
"author_email": "fenkemeijer@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/68/1f/fb6e5cbcf4ec87943c7fc24924e03fc547bb9efe7bc09412ad15b5699892/corebridge-0.4.0.tar.gz",
"platform": null,
"description": "# corebridge\n\n\n<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->\n\nThis package provides functions and classes to run wodan style\nprocessing functions in the Stactics AICore environment.\n\n## Installation\n\nUse\n\n``` sh\npip install corebridge\n```\n\nto install corebrdige.\n\n## How to use\n\n### Introduction\n\nWodan is a proprietary backend service that applies high performance,\ncustom analytical processing to timeseries data in the Whysor data and\ndashboarding environment.\n\nEach wodan module defines one function that operates as the entry point.\nThe parameter annotations in this function definition are used to format\ndata and retrieve parameters from the originating call to the wodan api.\nThis function is called with data retrieved according to a specification\nand with additional parameters as annotated.\n\nA simple function might look like:\n\n``` {python}\nimport numpy as np\n\ndef multiply(data:np.ndarray, multiplier:float=1.0):\n return data * multiplier\n \n```\n\nWodan binds this function to a service endpoint and takes care of\nfetching data and parameters and converting the result for the caller.\n\n### AICore modules\n\nFor AICore users define a class, always named `CustomModule` with a\nconstructor `__init__` and a method `infer`.\n\nThis package defines a baseclass to quickly construct a `CustomModule`\nclass that is able to use a wodan processor function inside the AICore\nsystem:\n\n``` {python}\nimport numpy as np\nimport corebridge\n\ndef multiply(data:np.ndarray, multiplier:float=1.0):\n return data * multiplier\n\nclass CustomModule(corebridge.aicorebridge.AICoreModule):\n def __init__(self, save_dir, assets_dir, *args, **kwargs):\n super().__init__(multiply, save_dir, assets_dir, *args, **kwargs)\n \n```\n\nThat\u2019s it. Well, you can add parameters to `__init__` that can be used\nas hyperparameters in the web-interface and you could override `infer`\nfor the same reason. The baseclass takes care of converting call\nparameters and data to the function specification and, calls the\nfunction and converts the result for the caller, similar to the original\nWodan service.\n\n## Development\n\n### NBDev\n\nThis library is developed with [NBDev](https://nbdev.fast.ai/) - a\nliterate programming toolkit that supports developing code using jupyter\nnotebooks and mix code with documentation.\n\nLiterate programming is a methodology - introduced in 1984 by Donald\nKnuth - that combines a programming language with a documentation\nlanguage. In this approach, a program is explained in a human language\n(such as English) alongside code snippets. The literate source file is\nthen processed by a preprocessor to produce both source code and\nformatted documentation.\n\nThis paradigm enhances program robustness, portability, and\nmaintainability, making it a valuable tool in scientific computing and\ndata science[^1]\n\n### Quarto\n\nDocumentation is prepared from the notebook with\n[Quarto](https://quarto.org/). Quarto too combines code with\ndocumentation but it does not extract source code into modules like\nnbdev.\n\n### Installation\n\n#### Quarto\n\nQuarto uses Pandoc and, for pdf format, LaTeX. These must be available\non your system.\n\nInstall [Quarto](https://quarto.org/docs/get-started/) as you see fit,\nthere is a [VSCode\nextension](https://marketplace.visualstudio.com/items?itemName=quarto.quarto)\nwhich handles this.\n\n#### NBDev\n\nNBDev is available as PyPi package and is installed with\n\n pip install nbdev\n\nor if you are using conda\n\n conda install -c fastai -y nbdev\n\nIf so desired you can let NBDev install Quarto with\n\n nbdev_install_quarto\n\nBut this ask for the system admin password.\n\n### Local editing & testing\n\nSetup a virtual environment, activate it and install the development\npackage and dependencies with, on linux\n\n pip install -e \u2018.[dev]\u2019\n\nor on Windows\n\n pip install -e .[dev]\n\n#### Jupyter\n\nThe above pip install should also install jupyter but to use it the\nkernel needs to be installed with:\n\n python -m ipykernel install --user --name=corebridge.venv\n\n### nbdev cycle\n\n- edit\n- nbdev_prepare\n\nThe latter performs - nbdev_export - nbdev_test - nbdev_clean -\nnbdev_readme\n\nThen commit and to upload to Pypi with `nbdev_pypi`\n\n[^1]: [Wikipedia on \u2018Literate\n Programming\u2019](https://en.wikipedia.org/wiki/Literate_programming)\n",
"bugtrack_url": null,
"license": "Apache Software License 2.0",
"summary": "Bridge for Stactics AICore",
"version": "0.4.0",
"project_urls": {
"Homepage": "https://github.com/fenke/corebridge"
},
"split_keywords": [
"python",
"aicore",
"stactics",
"whysor"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "388790b9394bd753018b4391f4bb8ab7df7804443dbe93c5f1ec753e0a860ee2",
"md5": "b63827bfadee6e02d8dbb5aac93cc55e",
"sha256": "db535b0b655bdaf3117ec391b769e184b682977fa18e21cc285f70c9bc6d5d44"
},
"downloads": -1,
"filename": "corebridge-0.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b63827bfadee6e02d8dbb5aac93cc55e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 22404,
"upload_time": "2025-01-27T09:13:43",
"upload_time_iso_8601": "2025-01-27T09:13:43.000138Z",
"url": "https://files.pythonhosted.org/packages/38/87/90b9394bd753018b4391f4bb8ab7df7804443dbe93c5f1ec753e0a860ee2/corebridge-0.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "681ffb6e5cbcf4ec87943c7fc24924e03fc547bb9efe7bc09412ad15b5699892",
"md5": "6557e4c8b2dbc6d50971777d668b5ada",
"sha256": "1845e09226003a16fcb9a2c8e36fad38d9dd61b3b8252593798ace2164d66ae5"
},
"downloads": -1,
"filename": "corebridge-0.4.0.tar.gz",
"has_sig": false,
"md5_digest": "6557e4c8b2dbc6d50971777d668b5ada",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 23508,
"upload_time": "2025-01-27T09:13:44",
"upload_time_iso_8601": "2025-01-27T09:13:44.944688Z",
"url": "https://files.pythonhosted.org/packages/68/1f/fb6e5cbcf4ec87943c7fc24924e03fc547bb9efe7bc09412ad15b5699892/corebridge-0.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-27 09:13:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "fenke",
"github_project": "corebridge",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "corebridge"
}