CLI for authenticating with the GreatSky Metaflow platform
Project description
greatsky-internal-metaflow
CLI for authenticating with the GreatSky Metaflow platform.
Install
pip install greatsky-internal-metaflow
Quick Start
# Authenticate (opens GitHub in your browser)
gsm login
# Verify everything is working
gsm validate
# Run Metaflow flows — no further config needed
python my_flow.py run
Commands
Authentication
| Command | Description |
|---|---|
gsm login [--scope global|project|venv] |
Authenticate via GitHub Device Flow |
gsm use-key <key> |
Configure using a service key (no browser needed) |
gsm logout |
Remove local credentials and config |
gsm status |
Show current authentication state |
gsm validate |
Check auth and platform connectivity |
gsm refresh |
Force re-fetch platform config from the auth API |
gsm revoke |
Immediately revoke your current API key |
gsm cleanup |
Remove legacy config files from before per-env scoping |
Service Keys
| Command | Description |
|---|---|
gsm service-key create <label> [--ttl 30d] |
Create a service key for programmatic access |
gsm service-key list |
List your active service keys |
gsm service-key revoke <label> |
Revoke a service key |
Admin (org members only)
| Command | Description |
|---|---|
gsm admin invite <user> [--expires 90d] |
Invite a GitHub user as guest |
gsm admin revoke <user> |
Remove a guest's access |
gsm admin revoke-keys <user> |
Revoke all API keys for a user |
gsm admin guests |
List all invited guests |
gsm admin list-service-keys |
List all service keys across all users |
gsm admin revoke-service-key --user <user> --label <label> |
Revoke a specific user's service key |
Hugging Face Integration
The package includes first-class Hugging Face Hub support. When running on the
platform, HF_TOKEN and HF_ORG are injected automatically -- no manual setup.
All dataset/model names without a / are auto-prefixed with the org (Great-Sky/).
Datasets
from greatsky_internal_metaflow.hf import load_dataset, save_dataset, list_datasets
# Load a dataset with version tracking (org prefix auto-resolved)
ds, version = load_dataset("my-dataset", split="train")
self.dataset_version = version # store as Metaflow artifact for lineage
# Save a dataset (accepts Dataset, DataFrame, dict, or directory path)
version = save_dataset(my_dataframe, "my-processed-dataset")
version = save_dataset({"text": texts, "label": labels}, "my-dataset")
version = save_dataset(hf_dataset, "my-dataset", commit_message="v2 cleaned")
# List all org datasets
for ds_info in list_datasets():
print(ds_info["id"], ds_info["downloads"])
The DatasetVersion object captures the exact HF commit SHA, split, timestamp,
and Metaflow run context. Query it later via the Metaflow Client API:
from metaflow import Flow
run = Flow("HFTrainingFlow").latest_run
print(run.data.dataset_version)
# DatasetVersion(Great-Sky/imdb@a3b5c8d2, split=train, run=HFTrainingFlow/42)
Models
from greatsky_internal_metaflow.hf import push_model_to_hub, pull_from_hub, sync_s3_to_hf
# Pull a model (org prefix auto-resolved)
local_path = pull_from_hub("my-model")
# Push a trained model to Great-Sky/my-model-finetuned
url = push_model_to_hub("/tmp/output", "my-model-finetuned")
# S3 <-> HF bridge
sync_s3_to_hf("s3://bucket/models/my-model", "my-model")
With metaflow-checkpoint decorators
Install with pip install greatsky-internal-metaflow[metaflow] to get
@huggingface_hub, @model, and @checkpoint decorators:
from metaflow import FlowSpec, step
from metaflow_extensions.obcheckpoint.plugins.hf_hub_decorator import huggingface_hub
class MyFlow(FlowSpec):
@huggingface_hub(models=["distilbert-base-uncased"])
@step
def train(self):
...
Locally
If running outside the platform, set HF_TOKEN and HF_ORG as environment
variables, or authenticate with huggingface-cli login.
How It Works
gsm loginstarts a GitHub Device Flow — you get a code to enter at github.com/login/device- Once authorized, the CLI exchanges the GitHub token with the GreatSky auth API for a platform API key
- The API key and Metaflow config are written to a
.greatsky_gsm/directory (project, venv, or global scope) - The Metaflow extension reads that config automatically — no wrappers or env vars needed
API keys are valid for 14 days and are automatically revoked if you leave the GitHub org.
Config Resolution
The CLI resolves config from three locations, in priority order:
- Project —
.greatsky_gsm/in the nearest directory containingpyproject.tomlorsetup.py - Virtualenv —
.greatsky_gsm/inside$VIRTUAL_ENV - Global —
~/.greatsky_gsm/
Use --scope with gsm login to control where credentials are stored.
Development
git clone https://github.com/greatsky-ai/greatsky-internal-metaflow.git
cd greatsky-internal-metaflow
uv venv && uv pip install -e ".[dev]"
uv run pytest
uv run ruff check src/ tests/
Versioning
Versions are derived automatically from git tags via hatch-vcs. To release:
git tag v0.2.0
git push origin v0.2.0
The publish workflow runs lint, tests, and smoke tests before pushing to PyPI.
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 greatsky_internal_metaflow-0.1.5.tar.gz.
File metadata
- Download URL: greatsky_internal_metaflow-0.1.5.tar.gz
- Upload date:
- Size: 182.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96752ff4f63322440815cb9509c03b7c84fed82a0c62040a96226badd1af017a
|
|
| MD5 |
c2726a28150531ca62863b5332e3d799
|
|
| BLAKE2b-256 |
9da7697037f23b1ae9ee95063cd336f800249f2760a5471ad5370a8a3ac0a36e
|
Provenance
The following attestation bundles were made for greatsky_internal_metaflow-0.1.5.tar.gz:
Publisher:
publish.yml on greatsky-ai/greatsky-internal-metaflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
greatsky_internal_metaflow-0.1.5.tar.gz -
Subject digest:
96752ff4f63322440815cb9509c03b7c84fed82a0c62040a96226badd1af017a - Sigstore transparency entry: 986256301
- Sigstore integration time:
-
Permalink:
greatsky-ai/greatsky-internal-metaflow@aff52774af1605eb7fa08ea65ea17aa2113be208 -
Branch / Tag:
refs/tags/v0.1.5 - Owner: https://github.com/greatsky-ai
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@aff52774af1605eb7fa08ea65ea17aa2113be208 -
Trigger Event:
push
-
Statement type:
File details
Details for the file greatsky_internal_metaflow-0.1.5-py3-none-any.whl.
File metadata
- Download URL: greatsky_internal_metaflow-0.1.5-py3-none-any.whl
- Upload date:
- Size: 23.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2891d118e64c0e7e7a9371718fdcfd2517ecee9309d33b1a7906921218fa9b3f
|
|
| MD5 |
3f1aa7b3bef7797d894793570a9cfb75
|
|
| BLAKE2b-256 |
0df684bd4f2fb3c80ed113191a48313223dd3e9e683969638a5b72efaae648ce
|
Provenance
The following attestation bundles were made for greatsky_internal_metaflow-0.1.5-py3-none-any.whl:
Publisher:
publish.yml on greatsky-ai/greatsky-internal-metaflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
greatsky_internal_metaflow-0.1.5-py3-none-any.whl -
Subject digest:
2891d118e64c0e7e7a9371718fdcfd2517ecee9309d33b1a7906921218fa9b3f - Sigstore transparency entry: 986256360
- Sigstore integration time:
-
Permalink:
greatsky-ai/greatsky-internal-metaflow@aff52774af1605eb7fa08ea65ea17aa2113be208 -
Branch / Tag:
refs/tags/v0.1.5 - Owner: https://github.com/greatsky-ai
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@aff52774af1605eb7fa08ea65ea17aa2113be208 -
Trigger Event:
push
-
Statement type: