Shared Python utilities for SQL, Excel, and date helpers.
Project description
analytics_toolkit
analytics_toolkit is a small utility package for:
- AB-test related helpers
- SQL I/O and table-loading helpers for Trino, Greenplum, and ClickHouse
- date helpers for common period calculations
- Excel helpers for writing pivoted tables from long-format data
Install
From PyPI:
pip install analytics-toolkit
From GitHub:
pip install git+https://github.com/Karapsin/analytics_toolkit.git
Release
PyPI publishing uses GitHub Actions trusted publishing. Before each release,
run the full local tox matrix from AGENTS.md, update the changelog, and verify
the package build:
python -m pip install --upgrade build twine
python -m build
python -m twine check dist/*
Run the publish workflow manually to publish the current version to TestPyPI.
After the TestPyPI install check passes, create and publish a GitHub release
tagged as v<pyproject.toml version>; the release event publishes to PyPI.
The PyPI trusted publisher uses repository Karapsin/analytics_toolkit,
workflow .github/workflows/publish.yml, and environment pypi. The TestPyPI
trusted publisher uses the same repository and workflow with environment
testpypi.
Quick Start
from analytics_toolkit.ab_utils import compute_test_metrics
from analytics_toolkit import sql
from analytics_toolkit.dates.dates import first_day
from analytics_toolkit.excel import break_table, pivot_and_break_table
Supported SQL imports are from analytics_toolkit import sql or
import analytics_toolkit.sql as sql. Deep imports under
analytics_toolkit.sql.* are internal implementation details and may change;
call SQL helpers through the sql facade, for example sql.create_sql_table(...)
or sql.transfer(...). Do not restore removed root implementation paths.
Configuration
SQL connection settings are read from .connections. The package searches
from the current working directory upward through parent directories. Each key is
the public connection alias used by analytics_toolkit.sql; each value must
include type as one of gp, trino, or ch.
{
"gp": {
"type": "gp",
"host": "gp.example",
"port": 5432,
"user": "user",
"password": "password",
"database": "db"
},
"gp_sandbox": {
"type": "gp",
"host": "gp-sandbox.example",
"user": "user",
"password": "password",
"database": "sandbox"
}
}
Legacy variables such as GP_HOST, TRINO_HOST, CH_HOST, SQL_CONNECTIONS,
and TRINO_INSERT_CHUNK_SIZE are not read. Move connection settings into
.connections; Trino insert chunk sizing is the Trino connection field
insert_chunk_size.
If a Trino connection sets use_keychain_certs=true, the generated CA bundle is
written to:
<connections_file_directory>/certs/trino-<connection-key>-keychain-ca.pem
You can override the state/output directory with MAGNIT_UTILS_HOME.
Manuals
Package Layout
analytics_toolkit/ab_utils: AB-test metric comparison helpers, includingcompute_test_metricsanalytics_toolkit/dates: date and period helpersanalytics_toolkit/excel: Excel formatting helpersanalytics_toolkit/sql: SQL execution, loading, and transfer helpers
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file analytics_toolkit-1.3.6.12.tar.gz.
File metadata
- Download URL: analytics_toolkit-1.3.6.12.tar.gz
- Upload date:
- Size: 222.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed0b5905d614c83140786b30621a57d74758651060fdfc221f3f03558542e116
|
|
| MD5 |
10593d7373e6721829ba5a9954a13f48
|
|
| BLAKE2b-256 |
9f8f21af27610ac0088ddd7431ecd040410d3d66f8ee34a84e8c86a1d256c169
|
Provenance
The following attestation bundles were made for analytics_toolkit-1.3.6.12.tar.gz:
Publisher:
publish.yml on Karapsin/analytics_toolkit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
analytics_toolkit-1.3.6.12.tar.gz -
Subject digest:
ed0b5905d614c83140786b30621a57d74758651060fdfc221f3f03558542e116 - Sigstore transparency entry: 1723784335
- Sigstore integration time:
-
Permalink:
Karapsin/analytics_toolkit@88aeafa083737e5aa279bc324c06c83268181003 -
Branch / Tag:
refs/tags/v1.3.6.12 - Owner: https://github.com/Karapsin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@88aeafa083737e5aa279bc324c06c83268181003 -
Trigger Event:
release
-
Statement type:
File details
Details for the file analytics_toolkit-1.3.6.12-py3-none-any.whl.
File metadata
- Download URL: analytics_toolkit-1.3.6.12-py3-none-any.whl
- Upload date:
- Size: 192.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
096f13f587f1920ac7a16aa341c003476b6c99d270325ecb42a14fbcd9878168
|
|
| MD5 |
331605fc19c619d056233ac489916c2e
|
|
| BLAKE2b-256 |
3d150fc1bf967acdcaff87c27f28de5e6e98db90a61723ee1346d6e72cd02b0f
|
Provenance
The following attestation bundles were made for analytics_toolkit-1.3.6.12-py3-none-any.whl:
Publisher:
publish.yml on Karapsin/analytics_toolkit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
analytics_toolkit-1.3.6.12-py3-none-any.whl -
Subject digest:
096f13f587f1920ac7a16aa341c003476b6c99d270325ecb42a14fbcd9878168 - Sigstore transparency entry: 1723784432
- Sigstore integration time:
-
Permalink:
Karapsin/analytics_toolkit@88aeafa083737e5aa279bc324c06c83268181003 -
Branch / Tag:
refs/tags/v1.3.6.12 - Owner: https://github.com/Karapsin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@88aeafa083737e5aa279bc324c06c83268181003 -
Trigger Event:
release
-
Statement type: