Skip to main content

lib-x-assetlake

A lightweight Python library for managing data assets and compute jobs across local filesystems, AWS, and Alibaba Cloud.

Think of it as a unified way to describe "what data lives where" and "what jobs run where" — without writing different code for each platform.


Install

pip install lib-x-assetlake           # core (local filesystem + DuckDB)
pip install "lib-x-assetlake[aws]"    # + AWS (S3, Glue, Step Functions)
pip install "lib-x-assetlake[aliyun]" # + Alibaba Cloud (OSS)

Concepts

Three building blocks:

Concept What it is
Access Credentials for a platform (local, AWS, Aliyun)
Asset A dataset described by a glob path (e.g. s3://bucket/data/**/*.parquet)
Compute A job or script that can be triggered or monitored (Glue, Step Functions, local Python)

Access — credentials

An Access object holds the credentials needed to talk to a platform. Create one and pass it to assets or compute jobs.

from assetlake import LocalAccess, AWSAccess, AliyunAccess

# Local — no credentials needed
local = LocalAccess(name="my-local")

# AWS — uses boto3 credential chain by default (env vars, ~/.aws, IAM role)
aws = AWSAccess(name="prod-aws", region="us-east-1")

# AWS — explicit keys
aws = AWSAccess(
    name="prod-aws",
    access_key_id="AKIA...",
    access_key_secret="...",
    region="us-east-1",
)

# Alibaba Cloud
aliyun = AliyunAccess(
    name="prod-oss",
    access_key_id="LTAI...",
    access_key_secret="...",
)

# Load from a dict (useful when config comes from a file or env)
from assetlake import AccessFactory

aws = AccessFactory.load({"platform": "aws", "name": "prod", "region": "us-east-1"})

# Inspect without exposing secrets
print(aws.describe())  # keys are masked: "AKID******"

Asset — datasets

An Asset describes a collection of files using a glob pattern. You can list what files exist, filter by time, and run quality checks.

Local files

from assetlake import LocalAsset

asset = LocalAsset(
    glob="/data/exports/**/*.parquet",
    name="daily-exports",
    owner="xing",
)

# List all matching files, newest first
objects = asset.inspect()
for obj in objects:
    print(obj.uri, obj.size, obj.modified_at)

# Filter by time
from datetime import datetime, timezone

objects = asset.inspect(
    since=datetime(2024, 1, 1, tzinfo=timezone.utc),
    limit=10,
)

# Data quality check (parquet only) — returns row counts, null rates, etc.
stats = asset.quality()

S3 (AWS)

from assetlake import S3Asset, AWSAccess

asset = S3Asset(
    glob="s3://my-bucket/warehouse/orders/**/*.parquet",
    name="orders",
    region="us-east-1",
)
access = AWSAccess(name="prod")

objects = asset.inspect(access=access)
stats = asset.quality(access=access)

OSS (Alibaba Cloud)

from assetlake import OSSAsset, AliyunAccess

asset = OSSAsset(
    glob="oss://my-bucket/data/**/*.parquet",
    region="cn-hangzhou",
    name="raw-events",
)
access = AliyunAccess(name="prod", access_key_id="...", access_key_secret="...")

objects = asset.inspect(access=access)

Factory — load an asset from a dict

Useful when asset definitions come from a config file or database.

from assetlake import AssetFactory

asset = AssetFactory.load(
    {
        "filesystem": "s3",
        "glob": "s3://my-bucket/data/**/*.parquet",
        "region": "us-east-1",
    }
)

Partitioned assets

If your paths encode partition keys (e.g. year=2024/month=01), they are automatically extracted.

asset = S3Asset(glob="s3://bucket/events/year=*/month=*/*.parquet")

objects = asset.inspect(access=access)
for obj in objects:
    print(obj.partitions)  # {"year": "2024", "month": "01"}

Compute — jobs

A Compute object represents a job that can be triggered or monitored.

Local Python function

Run a Python function in-process or in a background subprocess.

from assetlake.control.compute.py_entrypoint import PyEntrypointCompute

job = PyEntrypointCompute(
    name="my-etl",
    entrypoint="mypackage.jobs.etl.run",  # dotted import path to a callable
)

# Run synchronously and get the result
result = job.execute(params={"date": "2024-01-01"})

# Run in a background subprocess and get a handle
handle = job.submit(params={"date": "2024-01-01"})
result = handle.result(timeout=60)  # blocks until done

AWS Glue

from assetlake.control.compute.glue import GlueJobCompute
from assetlake import AWSAccess

job = GlueJobCompute(name="my-glue-job", region="us-east-1")
access = AWSAccess(name="prod")

# Trigger the job
job.execute(params={"--date": "2024-01-01"}, access=access)

# List recent runs
runs = job.inspect(access=access, limit=10)
for run in runs:
    print(run["run_id"], run["state"], run["started_on"])

AWS Step Functions

from assetlake.control.compute.stepfunction import StepFunctionCompute
from assetlake import AWSAccess

sfn = StepFunctionCompute(
    name="my-pipeline",
    arn="arn:aws:states:us-east-1:123456789:stateMachine:my-pipeline",
)
access = AWSAccess(name="prod")

# Start an execution
sfn.execute(params={"date": "2024-01-01"}, access=access)

# List recent executions
runs = sfn.inspect(access=access, limit=5)

Development

make install   # install dependencies
make test      # run tests
make lint      # format + lint with ruff
make build     # build wheel for distribution
make upload    # upload to PyPI

Metadata

Release files for lib-x-assetlake 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lib-x-assetlake 0.0.1
File Size Uploaded Provenance Actions
lib_x_assetlake-0.0.1.tar.gz 68.1 kB Without provenance Details for lib_x_assetlake-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lib-x-assetlake 0.0.1
File Interpreter ABI Platform Actions
lib_x_assetlake-0.0.1-py3-none-any.whl Python 3 none any Details for lib_x_assetlake-0.0.1-py3-none-any.whl

Total release size: 163.5 kB

Release files / lib_x_assetlake-0.0.1.tar.gz

Download URL lib_x_assetlake-0.0.1.tar.gz
Size 68.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8651c17d2897b0966a1c2542462b4ead6c57a3bf9871d1c86e1bad6aaebcc065
BLAKE2b-256 checksum
How to use checksums
43a2d7976f5cc044a6086ae34d98af73a4ab5527456df31668fd311590462ab4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Release files / lib_x_assetlake-0.0.1-py3-none-any.whl

Download URL lib_x_assetlake-0.0.1-py3-none-any.whl
Size 95.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
484200f1c2758d8ced306b96f0bfa4c102460937d4791b017280136f97bd3e45
BLAKE2b-256 checksum
How to use checksums
5073c754572319d35ad33186106315903b21adb5ba35dfaef7018552d9b88f4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Security for lib-x-assetlake 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page