Catalog PyPI
Back to packageRELEASE DETAILS

0.1.2

PyPI

ai-library-swch

AI helper utilities and models

Published27 Aug 2026
Direct dependencies31
Transitive dependenciesNot calculated

README

Version 0.1.2 documentation

ai_library

ai_library is a Python package that exposes model training, inference, metrics recording, cron scheduling, and package-based configuration management.

Package Overview

Available Top-Level APIs

  • ai_library.validate_config(config_path=None)

    • Loads and validates the package default ai_library/config.yaml if no path is provided.
    • Returns the parsed configuration dictionary.
  • ai_library.update_config(config_path=None, updates=...)

    • Updates the package config file by default.
    • Supports a dictionary, a [key, value] pair, or a list of [key, value] pairs.
  • ai_library.show_config(config_path=None)

    • Prints the current configuration to stdout.
  • ai_library.train()

    • Loads configuration from the package config.
    • Reads data, builds the selected pipeline, and trains the model.
  • ai_library.infer()

    • Loads package configuration.
    • Loads a saved model and performs inference.
    • returns predictions, first_predicted, last_predicted, data_frequency, conformal_q
    • conformal_q is the safety margin in order to be 1-alpha accurate for the predicted time window
  • ai_library.record

    • Use ai_library.record.main() or run the module directly to start metric collection.
  • ai_library.add_to_cron() / ai_library.remove_from_cron()

    • Manage cron scheduling for recurring training runs.
    • Adds or removes a cron job that runs python3 -m ai_library.codebase.setup.train.

How to Use

Install

pip install ai-library-swch==0.1.1 

a safe python version is 3.12.3

Configuration

this is an example of how config can be printed and updated.

from ai_library import validate_config, update_config, show_config

update_config(None, updates=["parquet_train_size", 100000])
show_config()
validate_config()

Metric Recorder Function

Make sure that .env is reachable in the folder where this is executed, and that the specified port is reachable. Sample .env configuration:

MON_CLIENT_STOMP_HOST=127.0.0.1
MON_CLIENT_STOMP_PORT=61622

Execution command:

nohup python3 -c "from ai_library import record; record.main()" > record.log 2>&1 &

nohup is not necessary, but make sure to run the recorder in the background.

Train and Infer

import the functions:

from ai_library import train, infer

Manually use train (no cron)

the standard way is to use the cron functions to train in intervals. This might still be useful, for example when switching models.

train()

Cron Scheduling

add_to_cron creates a cron job that runs the train function in intervals.

import ai_library.codebase.setup.cron_manager as cron_manager

cron_manager.add_to_cron()
cron_manager.remove_from_cron()

Inference

after a trained model is accessible via the path, that is given in the config file, inference can be applied:

predictions, first_predicted, last_predicted, data_frequency, conformal_q = infer()

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 31

Native requirements
31 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
annotated-types
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
annotated-types==0.7.0runtime
anyio
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
anyio==4.13.0runtime
cloudpathlib
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
cloudpathlib==0.24.0runtime
cloudpickle
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
cloudpickle==3.1.2runtime
confection
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
confection==1.3.3runtime
durationpy
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
durationpy==0.10runtime
fastai
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
fastai==2.8.7runtime
fastcore
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
fastcore==1.13.2runtime
fastprogress
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
fastprogress==1.1.6runtime
httpcore
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
httpcore==1.0.9runtime
matplotlib
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
matplotlib==3.11.0runtime
mpmath
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
mpmath==1.3.0runtime
numpy
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
numpy==2.4.6runtime
pandas
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
pandas==3.0.3runtime
preshed
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
preshed==3.0.13runtime
pyarrow
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
pyarrow==24.0.0runtime
pydantic_core
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
pydantic_core==2.46.4runtime
PyYAML
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
PyYAML==6.0.3runtime
requests
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
requests==2.34.2runtime
requests-oauthlib
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
requests-oauthlib==2.0.0runtime
scikit-learn
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
scikit-learn==1.7.2runtime
setuptools
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
setuptools==81.0.0runtime
swchmonclient
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
swchmonclient==0.2.0runtime
threadpoolctl
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
threadpoolctl==3.6.0runtime
torch
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
torch==2.12.0runtime
torchaudio
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
torchaudio==2.11.0runtime
torchvision
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
torchvision==0.27.0runtime
tsai
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
tsai==1.0.1runtime
typing-inspection
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
typing-inspection==0.4.2runtime
typing_extensions
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
typing_extensions==4.15.0runtime
xgboost
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "==3.12.3",
  "evaluation": "NOT_EVALUATED"
}
xgboost==3.2.0runtime

Distribution files

2 collected
ai_library_swch-0.1.2-py3-none-any.whl

bdist_wheel · 28.41 KB · Python py3

Source file
ai_library_swch-0.1.2.tar.gz

sdist · 22.99 KB · Python source

Source file

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 11:09 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:27d5a4e8de7cc8aa8163996e2ede477ae263225faadf94c0703a7af245dfc6bf

Other collected versions

View all collected versions →