Catalog PyPI
PACKAGE EXPLORERView in registry

3phi-framework

PyPI

Framework for 3phi project

Versions collected1
Direct dependencies1From release 0.4.0
Last observed20 Oct, 15:35 UTC

README

Version 0.4.0 documentation

3phi Framework

Utility classes for DB access, S3 interactions, and data processing via Controller Classes.
Distributed on PyPi.

Install name: 3phi-framework
Import package: threephi_framework
Used by: 3-Phase-Insight Data Platform


Installation

Install from PyPi

pip install 3phi-framework

Installing a Development Build (from CI)

Development builds are generated for each pull request and attached as workflow artifacts.

Download the artifact

  1. Open the pull request on GitHub
  2. Go to the Checks tab
  3. Open the CI and Release workflow run
  4. Download the artifact named dist-pr
  5. Extract the archive locally

It will contain files like:

dist/ 3phi_framework-.whl 3phi_framework-.tar.gz

From the extracted directory:

pip install dist/3phi_framework-*.whl

Alternatively, install the source distribution:

pip install dist/3phi_framework-*.tar.gz

Notes: Wheels are preferred and install faster. Make sure you are using Python ≥ 3.12 (project requirement). Dev builds are temporary and may be deleted after 7 days.

Quickstart

The framework is set up for local development as well as for being used in a deployment. To set up your environment for local development, follow these steps:

Set up virtual environment

execute_data_app.sh expects a virtual environment to be set up under [.venv]. See the python docs on how to set it up.

Seed data (optional)

The database schema is provisioned automatically from the canonical sqitch migrations, so you do not need to supply it. Seed data is optional:

  • Database: place a data-only dump at docker/db/seed/seed.sql (gitignored). See docker/db/seed/README.md for how to generate it; it is loaded by make up-seeded.
  • Object storage: copy a bucket from a working object storage to 3phi; it is mounted as a MinIO bucket.

Spin up DB and Object Storage

Navigate to docker and run

make up          # schema only (empty tables)
make up-seeded   # schema + load docker/db/seed/seed.sql if present

This brings up a local Postgres (schema deployed from the canonical sqitch migrations) and a MinIO Object Storage. See docker/README.md for details.

Run a data app locally

Use the utility script execute_data_app.sh and pass the data app name as an argument, e.g.:

./execute_data_app.sh sm_classifier

In case the script is not executable, make it executable:

chmod +x execute_data_app.sh

The script will install the dependencies in requirements.txt in your virtual environment, set up environment variables as they are listed in .env and execute the data app as a python module.

Object Storage Connectors

The framework abstracts object storage behind BaseConnector so data apps are decoupled from the underlying storage backend. Two implementations are provided out of the box.

Choosing the backend

Every data app works against a single connector, resolved in this order:

  1. Dependency injection — pass any BaseConnector instance to the data app:
    from threephi_framework import AzureBlobConnector, SMClassifier
    
    connector = AzureBlobConnector(data_dir_path="phase_measurements/raw")
    with SMClassifier(config, connector=connector) as app:
        app.run()
    
  2. Config key — set object_storage_backend: "s3" | "azure" in the data app config (e.g. in a DAG's YAML); the connector is built by create_connector().
  3. Environment variable — OBJECT_STORAGE_BACKEND (same values), useful to switch a whole deployment.
  4. Default — "s3".

The connector is rooted at config["data_dir_path"] (default phase_measurements/raw) and shared by the data app's DataExtractor and TimeSeriesController. Functions that run on Dask workers reconstruct the connector from the backend name carried in their config, so backends swap consistently across the cluster.

S3Connector

For AWS S3 or any S3-compatible storage (the default local dev setup uses MinIO).

from threephi_framework import S3Connector

connector = S3Connector(data_dir_path="timeseries/ready")
Environment variableRequiredDescription
S3_ENDPOINT_URLYesFull URL of the S3 endpoint, e.g. http://localhost:19000 for MinIO
S3_ACCESS_KEYYesAccess key / username
S3_SECRET_KEYYesSecret key / password

The bucket name is fixed to 3phi. All paths are rooted at s3://3phi/<data_dir_path>.

AzureBlobConnector

For Azure Blob Storage. Requires the adlfs package (pip install adlfs).

from threephi_framework import AzureBlobConnector

connector = AzureBlobConnector(data_dir_path="timeseries/ready")
Environment variableRequiredDescription
AZURE_STORAGE_ACCOUNT_NAMEYesAzure Storage Account name
AZURE_STORAGE_CONTAINER_NAMEYesBlob container name (equivalent to the S3 bucket)
AZURE_STORAGE_ACCOUNT_KEYNoAccount key for key-based auth. If omitted, DefaultAzureCredential is used automatically

All paths are rooted at az://<container>/<data_dir_path>.

Authentication — when AZURE_STORAGE_ACCOUNT_KEY is not set, the connector falls back to DefaultAzureCredential, which transparently supports managed identity, service principal (via environment variables), and az login for local development. No code changes are needed between environments.

Writing a custom connector

Subclass BaseConnector and implement all abstract methods. The connector is injected into TimeSeriesController at construction time, so any conforming implementation works as a drop-in replacement:

from threephi_framework.object_storage.base_connector import BaseConnector

class MyConnector(BaseConnector):
    ...

controller = TimeSeriesController(connector=MyConnector(data_dir_path="..."))

Data Model

The currently assumed datamodel is illustrated in the diagram below:

Data Model

Downloads & popularity

1downloads
1-day window · source-reported counts19 Oct 2026
56280
2026-07-22: 8 · observed 2026-10-20T16:04:00.3613865Z · period 2026-07-22–2026-07-222026-07-23: 5 · observed 2026-10-20T16:04:00.3613865Z · period 2026-07-23–2026-07-232026-07-24: 4 · observed 2026-10-20T16:04:00.3613865Z · period 2026-07-24–2026-07-242026-07-25: 2 · observed 2026-10-20T16:04:00.3613865Z · period 2026-07-25–2026-07-252026-07-27: 5 · observed 2026-10-20T16:04:00.3613865Z · period 2026-07-27–2026-07-272026-07-29: 14 · observed 2026-10-20T16:04:00.3613865Z · period 2026-07-29–2026-07-292026-07-30: 2 · observed 2026-10-20T16:04:00.3613865Z · period 2026-07-30–2026-07-302026-08-01: 1 · observed 2026-10-20T16:04:00.3613865Z · period 2026-08-01–2026-08-012026-08-02: 1 · observed 2026-10-20T16:04:00.3613865Z · period 2026-08-02–2026-08-022026-08-03: 16 · observed 2026-10-20T16:04:00.3613865Z · period 2026-08-03–2026-08-032026-08-04: 9 · observed 2026-10-20T16:04:00.3613865Z · period 2026-08-04–2026-08-042026-08-06: 1 · observed 2026-10-20T16:04:00.3613865Z · period 2026-08-06–2026-08-062026-08-09: 6 · observed 2026-10-20T16:04:00.3613865Z · period 2026-08-09–2026-08-092026-08-13: 5 · observed 2026-10-20T16:04:00.3613865Z · period 2026-08-13–2026-08-132026-08-14: 4 · observed 2026-10-20T16:04:00.3613865Z · period 2026-08-14–2026-08-142026-08-15: 1 · observed 2026-10-20T16:04:00.3613865Z · period 2026-08-15–2026-08-152026-08-16: 1 · observed 2026-10-20T16:04:00.3613865Z · period 2026-08-16–2026-08-162026-08-17: 8 · observed 2026-10-20T16:04:00.3613865Z · period 2026-08-17–2026-08-172026-08-18: 56 · observed 2026-10-20T16:04:00.3613865Z · period 2026-08-18–2026-08-182026-08-19: 2 · observed 2026-10-20T16:04:00.3613865Z · period 2026-08-19–2026-08-192026-08-20: 2 · observed 2026-10-20T16:04:00.3613865Z · period 2026-08-20–2026-08-202026-08-21: 1 · observed 2026-10-20T16:04:00.3613865Z · period 2026-08-21–2026-08-212026-08-22: 2 · observed 2026-10-20T16:04:00.3613865Z · period 2026-08-22–2026-08-222026-08-23: 7 · observed 2026-10-20T16:04:00.3613865Z · period 2026-08-23–2026-08-232026-08-24: 15 · observed 2026-10-20T16:04:00.3613865Z · period 2026-08-24–2026-08-242026-08-27: 1 · observed 2026-10-20T16:04:00.3613865Z · period 2026-08-27–2026-08-272026-08-28: 7 · observed 2026-10-20T16:04:00.3613865Z · period 2026-08-28–2026-08-282026-08-29: 4 · observed 2026-10-20T16:04:00.3613865Z · period 2026-08-29–2026-08-292026-08-31: 7 · observed 2026-10-20T16:04:00.3613865Z · period 2026-08-31–2026-08-312026-09-01: 2 · observed 2026-10-20T16:04:00.3613865Z · period 2026-09-01–2026-09-012026-09-03: 4 · observed 2026-10-20T16:04:00.3613865Z · period 2026-09-03–2026-09-032026-09-04: 1 · observed 2026-10-20T16:04:00.3613865Z · period 2026-09-04–2026-09-042026-09-05: 3 · observed 2026-10-20T16:04:00.3613865Z · period 2026-09-05–2026-09-052026-09-06: 8 · observed 2026-10-20T16:04:00.3613865Z · period 2026-09-06–2026-09-062026-09-07: 4 · observed 2026-10-20T16:04:00.3613865Z · period 2026-09-07–2026-09-072026-09-09: 2 · observed 2026-10-20T16:04:00.3613865Z · period 2026-09-09–2026-09-092026-09-10: 1 · observed 2026-10-20T16:04:00.3613865Z · period 2026-09-10–2026-09-102026-09-12: 7 · observed 2026-10-20T16:04:00.3613865Z · period 2026-09-12–2026-09-122026-09-16: 2 · observed 2026-10-20T16:04:00.3613865Z · period 2026-09-16–2026-09-162026-09-18: 16 · observed 2026-10-20T16:04:00.3613865Z · period 2026-09-18–2026-09-182026-09-21: 2 · observed 2026-10-20T16:04:00.3613865Z · period 2026-09-21–2026-09-212026-09-22: 2 · observed 2026-10-20T16:04:00.3613865Z · period 2026-09-22–2026-09-222026-09-23: 1 · observed 2026-10-20T16:04:00.3613865Z · period 2026-09-23–2026-09-232026-09-24: 6 · observed 2026-10-20T16:04:00.3613865Z · period 2026-09-24–2026-09-242026-09-25: 3 · observed 2026-10-20T16:04:00.3613865Z · period 2026-09-25–2026-09-252026-09-26: 2 · observed 2026-10-20T16:04:00.3613865Z · period 2026-09-26–2026-09-262026-09-27: 3 · observed 2026-10-20T16:04:00.3613865Z · period 2026-09-27–2026-09-272026-09-28: 8 · observed 2026-10-20T16:04:00.3613865Z · period 2026-09-28–2026-09-282026-09-29: 4 · observed 2026-10-20T16:04:00.3613865Z · period 2026-09-29–2026-09-292026-09-30: 9 · observed 2026-10-20T16:04:00.3613865Z · period 2026-09-30–2026-09-302026-10-01: 1 · observed 2026-10-20T16:04:00.3613865Z · period 2026-10-01–2026-10-012026-10-04: 1 · observed 2026-10-20T16:04:00.3613865Z · period 2026-10-04–2026-10-042026-10-05: 1 · observed 2026-10-20T16:04:00.3613865Z · period 2026-10-05–2026-10-052026-10-06: 1 · observed 2026-10-20T16:04:00.3613865Z · period 2026-10-06–2026-10-062026-10-07: 5 · observed 2026-10-20T16:04:00.3613865Z · period 2026-10-07–2026-10-072026-10-08: 9 · observed 2026-10-20T16:04:00.3613865Z · period 2026-10-08–2026-10-082026-10-09: 3 · observed 2026-10-20T16:04:00.3613865Z · period 2026-10-09–2026-10-092026-10-10: 9 · observed 2026-10-20T16:04:00.3613865Z · period 2026-10-10–2026-10-102026-10-11: 2 · observed 2026-10-20T16:04:00.3613865Z · period 2026-10-11–2026-10-112026-10-12: 1 · observed 2026-10-20T16:04:00.3613865Z · period 2026-10-12–2026-10-122026-10-13: 1 · observed 2026-10-20T16:04:00.3613865Z · period 2026-10-13–2026-10-132026-10-15: 2 · observed 2026-10-20T16:04:00.3613865Z · period 2026-10-15–2026-10-152026-10-17: 1 · observed 2026-10-20T16:04:00.3613865Z · period 2026-10-17–2026-10-172026-10-18: 2 · observed 2026-10-20T16:04:00.3613865Z · period 2026-10-18–2026-10-182026-10-19: 1 · observed 2026-10-20T16:04:00.3613865Z · period 2026-10-19–2026-10-19
22 Jul19 Oct

pypistats · 65 observations shown. Missing days are unknown. Source category: overall: without mirrors.

View observed values
Date / source periodValueObserved at
2026-10-19 – 2026-10-1912026-10-20T16:04:00.3613865Z
2026-10-18 – 2026-10-1822026-10-20T16:04:00.3613865Z
2026-10-17 – 2026-10-1712026-10-20T16:04:00.3613865Z
2026-10-15 – 2026-10-1522026-10-20T16:04:00.3613865Z
2026-10-13 – 2026-10-1312026-10-20T16:04:00.3613865Z
2026-10-12 – 2026-10-1212026-10-20T16:04:00.3613865Z
2026-10-11 – 2026-10-1122026-10-20T16:04:00.3613865Z
2026-10-10 – 2026-10-1092026-10-20T16:04:00.3613865Z
2026-10-09 – 2026-10-0932026-10-20T16:04:00.3613865Z
2026-10-08 – 2026-10-0892026-10-20T16:04:00.3613865Z
2026-10-07 – 2026-10-0752026-10-20T16:04:00.3613865Z
2026-10-06 – 2026-10-0612026-10-20T16:04:00.3613865Z
2026-10-05 – 2026-10-0512026-10-20T16:04:00.3613865Z
2026-10-04 – 2026-10-0412026-10-20T16:04:00.3613865Z
2026-10-01 – 2026-10-0112026-10-20T16:04:00.3613865Z
2026-09-30 – 2026-09-3092026-10-20T16:04:00.3613865Z
2026-09-29 – 2026-09-2942026-10-20T16:04:00.3613865Z
2026-09-28 – 2026-09-2882026-10-20T16:04:00.3613865Z
2026-09-27 – 2026-09-2732026-10-20T16:04:00.3613865Z
2026-09-26 – 2026-09-2622026-10-20T16:04:00.3613865Z
2026-09-25 – 2026-09-2532026-10-20T16:04:00.3613865Z
2026-09-24 – 2026-09-2462026-10-20T16:04:00.3613865Z
2026-09-23 – 2026-09-2312026-10-20T16:04:00.3613865Z
2026-09-22 – 2026-09-2222026-10-20T16:04:00.3613865Z
2026-09-21 – 2026-09-2122026-10-20T16:04:00.3613865Z
2026-09-18 – 2026-09-18162026-10-20T16:04:00.3613865Z
2026-09-16 – 2026-09-1622026-10-20T16:04:00.3613865Z
2026-09-12 – 2026-09-1272026-10-20T16:04:00.3613865Z
2026-09-10 – 2026-09-1012026-10-20T16:04:00.3613865Z
2026-09-09 – 2026-09-0922026-10-20T16:04:00.3613865Z
2026-09-07 – 2026-09-0742026-10-20T16:04:00.3613865Z
2026-09-06 – 2026-09-0682026-10-20T16:04:00.3613865Z
2026-09-05 – 2026-09-0532026-10-20T16:04:00.3613865Z
2026-09-04 – 2026-09-0412026-10-20T16:04:00.3613865Z
2026-09-03 – 2026-09-0342026-10-20T16:04:00.3613865Z
2026-09-01 – 2026-09-0122026-10-20T16:04:00.3613865Z
2026-08-31 – 2026-08-3172026-10-20T16:04:00.3613865Z
2026-08-29 – 2026-08-2942026-10-20T16:04:00.3613865Z
2026-08-28 – 2026-08-2872026-10-20T16:04:00.3613865Z
2026-08-27 – 2026-08-2712026-10-20T16:04:00.3613865Z
2026-08-24 – 2026-08-24152026-10-20T16:04:00.3613865Z
2026-08-23 – 2026-08-2372026-10-20T16:04:00.3613865Z
2026-08-22 – 2026-08-2222026-10-20T16:04:00.3613865Z
2026-08-21 – 2026-08-2112026-10-20T16:04:00.3613865Z
2026-08-20 – 2026-08-2022026-10-20T16:04:00.3613865Z
2026-08-19 – 2026-08-1922026-10-20T16:04:00.3613865Z
2026-08-18 – 2026-08-18562026-10-20T16:04:00.3613865Z
2026-08-17 – 2026-08-1782026-10-20T16:04:00.3613865Z
2026-08-16 – 2026-08-1612026-10-20T16:04:00.3613865Z
2026-08-15 – 2026-08-1512026-10-20T16:04:00.3613865Z
2026-08-14 – 2026-08-1442026-10-20T16:04:00.3613865Z
2026-08-13 – 2026-08-1352026-10-20T16:04:00.3613865Z
2026-08-09 – 2026-08-0962026-10-20T16:04:00.3613865Z
2026-08-06 – 2026-08-0612026-10-20T16:04:00.3613865Z
2026-08-04 – 2026-08-0492026-10-20T16:04:00.3613865Z
2026-08-03 – 2026-08-03162026-10-20T16:04:00.3613865Z
2026-08-02 – 2026-08-0212026-10-20T16:04:00.3613865Z
2026-08-01 – 2026-08-0112026-10-20T16:04:00.3613865Z
2026-07-30 – 2026-07-3022026-10-20T16:04:00.3613865Z
2026-07-29 – 2026-07-29142026-10-20T16:04:00.3613865Z
2026-07-27 – 2026-07-2752026-10-20T16:04:00.3613865Z
2026-07-25 – 2026-07-2522026-10-20T16:04:00.3613865Z
2026-07-24 – 2026-07-2442026-10-20T16:04:00.3613865Z
2026-07-23 – 2026-07-2352026-10-20T16:04:00.3613865Z
2026-07-22 – 2026-07-2282026-10-20T16:04:00.3613865Z

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.4.011 Jun 20261

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 15:35 UTC

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

Record identity

package:1066926604ee97b6b97497bdb25cbb9849f6011e8e28033724311f16ebcea025