A lightweight composable data governance layer
Project description
ikidgov - Iki Data Goverance
ikidgov is a lightweight, composable data governance toolkit for scanning data sources, classifying columns, and evaluating role-based access policies — without requiring a large platform migration.
What it does
ikidgov helps you:
- Discover — scan CSV, JSON, and SQL (SQLite) sources to register schema metadata
- Classify — tag columns with built-in or plugin-based PII/sensitivity detectors
- Enforce — evaluate access policies with a fail-closed decision model
- Provision — compile role-based grants into ready-to-run SQL for MySQL, PostgreSQL, MSSQL, or generic SQL dialects
- Configure once — keep roles, permissions, scopes, and connector defaults in a single
YAML file, with environment-specific overrides (
dev/staging/prod)
Installation
From PyPI
pip install ikidgov
This installs the ikidgov console command along with the importable ikidgov Python
package.
From source (development install)
git clone <this repository>
cd ikidgov
python -m pip install -e ".[dev]"
Docker-based example environment
cp .env.example .env # adjust values if needed; see "Secrets & credentials" below
docker compose up -d --wait
Requirements
- Python 3.10 or newer
- Docker (optional — only needed for the example multi-database stack)
- PyYAML, SQLAlchemy, and the driver for whichever SQL backend(s) you target
(
psycopg2-binaryfor Postgres,pymysqlfor MySQL,pyodbcfor MSSQL)
Quick start
# 1. Scan a file and register its schema
ikidgov scan --type csv --path customers.csv --owner jdoe
# 2. Scan a SQL table with the shared governance YAML and a PostgreSQL backend
ikidgov scan --type sql --path ./data/sqlite/registry.db --table employees --owner jdoe --backend postgres --config config/governance.yaml
# 3. Scan the same table with MySQL or MSSQL
ikidgov scan --type sql --path ./data/sqlite/registry.db --table employees --owner jdoe --backend mysql --config config/governance.yaml
ikidgov scan --type sql --path ./data/sqlite/registry.db --table employees --owner jdoe --backend mssql --config config/governance.yaml
# 2. Classify the columns
ikidgov classify --dataset-id 1
# 3. Check whether a role can access a column
ikidgov policy-check --actor-role analyst --action-type select --dataset-id 1 --column email
# 4. Compile policy output for a SQL dialect
ikidgov policy-compile --policy restrict_pii --table employees --dialect mysql --format text
Every subcommand accepts --format json (default) or --format text for output rendering.
Configuration
The main configuration file is config/governance.yaml. It keeps governance settings in one place:
- roles and their permissions
- role-scoped account credentials
- connector defaults (per source type:
csv,json,sql) - policy-related metadata
Example:
roles:
analyst:
description: Consumes data within policy limits
account:
username: analyst
password: "<set a strong password — do not commit real passwords>"
permissions:
- select
scope: policy_restricted
connectors:
csv:
default_type: string
Config resolution order
ikidgov looks for a config file in this order (first match wins):
- An explicit path passed to
load_config(path)/ the tool's--configoption, where applicable $IKIDGOV_CONFIG, if setgovernance.<environment>.yamlin the current working directory, if$IKIDGOV_ENVor$APP_ENVis set and the file existsgovernance.yamlin the current working directoryconfig/governance.<environment>.yamlunder the current working directory- The bundled
config/governance.yamlshipped with the package
Environment-specific example files are included in config:
Try them with either the environment variable or the CLI flag:
IKIDGOV_ENV=dev ikidgov show-config
ikidgov --env staging show-config
ikidgov --env prod show-config
Secrets & credentials
- Never commit real passwords. The
governance.*.yamlfiles underconfig/are examples — replace everypasswordfield with a real secret sourced from your environment or secrets manager before using a profile outside local development. - If a role's
account.passwordis left unset,policy-compilewill refuse to generateCREATE USER/CREATE LOGINSQL for that role rather than falling back to a default — you must set a password explicitly for any role that needs a provisioned database account. .envis for local, disposable Docker Compose credentials only. Copy.env.exampleto.envand keep the real.envout of version control (see.gitignore).
Docker and SQL backends
The repository includes a Docker Compose stack for SQLite, PostgreSQL, MySQL, and MSSQL examples, used by the scripts in examples.
cp .env.example .env
docker compose up -d --wait
python examples/enterprise_setup.py --dialect all
If you only want a single backend, replace all with sqlite, postgres, mysql, or
mssql. Add --dry-run to preview the commands without executing them, and --teardown to
wipe the example data.
Note: the bundled
scanCLI command currently discovers schema from SQLite files for thesqlsource type (--type sql --path <file> --table <name>). The Docker Compose stack spins up PostgreSQL/MySQL/MSSQL soexamples/enterprise_setup.pycan exercise the multi-dialect policy-compile / provisioning path against all four backends — it is not (yet) a multi-dialectscantarget.
Core modules
| Module | Responsibility |
|---|---|
metadata_registry |
Stores datasets, columns, owners, tags, and sensitivity labels |
connectors |
CSV, JSON, and SQL (SQLite) schema-discovery helpers |
classification_engine |
Applies built-in or plugin detectors to tag column sensitivity |
policy_engine |
Evaluates access decisions and compiles role grants into dialect SQL |
access_control |
Role-based CRUD for roles, permissions, and access entries |
Modules are registered as 4p.modules entry points (see pyproject.toml) and detectors as
4p.detectors entry points, so both are discoverable and swappable without changing core code.
Example workflow
The scripts in examples demonstrate a full governance walkthrough: provisioning sample data, printing a role/account overview, running access-control CRUD and policy demos, and compiling+applying role grants across all four SQL dialects.
python examples/enterprise_setup.py --dialect all --dry-run --skip-demo # preview only
python examples/enterprise_setup.py --dialect all # apply
python examples/enterprise_setup.py --dialect all --teardown # reset
See examples/GUIDE.md for the full walkthrough and config-file format.
Testing
Install the dev extras and run the test suite locally:
python -m pip install -e ".[dev]"
pytest
The suite covers CLI smoke tests, config resolution/overrides, access-control CRUD, policy evaluation, module isolation, and the example provisioning scripts.
Project layout
src/ikidgov/
cli/ argparse-based CLI and subcommands
config_loader.py governance YAML resolution
connectors/ CSV / JSON / SQL schema discovery
core/ shared base classes (Module, Connector, Detector, Decision, CRUD base)
detectors/ built-in and plugin PII detectors
modules/ access_control, classification_engine, metadata_registry, policy_engine
policies/ policy definitions (YAML), e.g. restrict_pii.yaml
config/ governance.yaml + per-environment overrides
examples/ enterprise_setup.py and seed SQL for the Docker Compose stack
init/ one-shot DB seed scripts used by docker-compose.yml
tests/ pytest suite
License
This project is licensed under the MIT License. See LICENSE.
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 ikidgov-0.1.0.tar.gz.
File metadata
- Download URL: ikidgov-0.1.0.tar.gz
- Upload date:
- Size: 39.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e9d8bc347a9b272ecce07352d4c6653809bf9147f5c15953845a830fdf14b5b
|
|
| MD5 |
0a61e5d45a09f9d1e58332b2c0e9a003
|
|
| BLAKE2b-256 |
23b7f825a7510769b979c05fa6a5d047a56ba3c4311359ab8b687fcb56fb8da2
|
File details
Details for the file ikidgov-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ikidgov-0.1.0-py3-none-any.whl
- Upload date:
- Size: 38.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85f24189d0ff4803a64500de846d32eb201abb9d4cda297a5a71d18a7a156bb6
|
|
| MD5 |
4fe06d2cbb42a0643ade99b6d6791e5a
|
|
| BLAKE2b-256 |
f9492bdc50abc99c9bebe1730c3b31ed0061b3ba3f7bf76bfce9891c861a2ee9
|