Skip to main content

A library for maintaining metadata for artifacts.

Project description

ML Metadata

Python PyPI

ML Metadata (MLMD) is a library for recording and retrieving metadata associated with ML developer and data scientist workflows.

NOTE: ML Metadata may be backwards incompatible before version 1.0.

Getting Started

For more background on MLMD and instructions on using it, see the getting started guide

Installing from PyPI

The recommended way to install ML Metadata is to use the PyPI package:

pip install ml-metadata

Then import the relevant packages:

from ml_metadata import metadata_store
from ml_metadata.proto import metadata_store_pb2

Nightly Packages

ML Metadata (MLMD) also hosts nightly packages at https://pypi-nightly.tensorflow.org on Google Cloud. To install the latest nightly package, please use the following command:

pip install --extra-index-url https://pypi-nightly.tensorflow.org/simple ml-metadata

Installing with Docker

This is the recommended way to build ML Metadata under Linux, and is continuously tested at Google.

Please first install docker and docker-compose by following the directions: docker; docker-compose.

Then, run the following at the project root:

DOCKER_SERVICE=manylinux-python${PY_VERSION}
sudo docker compose build ${DOCKER_SERVICE}
sudo docker compose run ${DOCKER_SERVICE}

where PY_VERSION is one of {39, 310, 311}.

A wheel will be produced under dist/, and installed as follows:

pip install dist/*.whl

Installing from source

1. Prerequisites

To compile and use ML Metadata, you need to set up some prerequisites.

Install Bazel

If Bazel is not installed on your system, install it now by following these directions.

Install cmake

If cmake is not installed on your system, install it now by following these directions.

2. Clone ML Metadata repository

git clone https://github.com/google/ml-metadata
cd ml-metadata

Note that these instructions will install the latest master branch of ML Metadata. If you want to install a specific branch (such as a release branch), pass -b <branchname> to the git clone command.

3. Build the pip package

ML Metadata uses Bazel to build the pip package from source:

python setup.py bdist_wheel

You can find the generated .whl file in the dist subdirectory.

4. Install the pip package

pip install dist/*.whl

5.(Optional) Build the grpc server

ML Metadata uses Bazel to build the c++ binary from source:

bazel build -c opt --define grpc_no_ares=true  //ml_metadata/metadata_store:metadata_store_server

Supported platforms

MLMD is built and tested on the following 64-bit operating systems:

  • macOS 10.14.6 (Mojave) or later.
  • Ubuntu 20.04 or later.
  • [DEPRECATED] Windows 10 or later. For a Windows-compatible library, please refer to MLMD 1.14.0 or earlier versions.

Releasing Wheels to PyPI

Setup (Required for both release methods)

Before releasing, you need to set up the PyPI environment and token once:

Step 1: Create PyPI environment

Create a new environment named pypi in the GitHub repository:

Step 2: Add PYPI_TOKEN secret

Add your PyPI token to the pypi environment:

  • In the pypi environment settings, scroll to "Environment secrets"
  • Click "Add secret"
  • Name: PYPI_TOKEN (use this exact name)
  • Value: Your PyPI API token
  • Click "Add secret"

Step 3: Commit and push your release branch

Ensure your release branch has the correct version set in ml_metadata/version.py, then:

git add ml_metadata/version.py
git commit -m "Prepare release vX.Y.Z"
git push origin your-release-branch

Part 1: Releasing via workflow_dispatch

This method allows you to manually trigger a release from any branch without creating a GitHub release.

Steps (after completing setup above):

  1. Navigate to the GitHub Actions page: https://github.com/google/ml-metadata/actions
  2. Find and select the Build ml-metadata with Conda workflow: https://github.com/google/ml-metadata/actions/workflows/conda-build.yml
  3. Click the "Run workflow" dropdown button.
  4. Select your release branch from the dropdown menu.
  5. Click "Run workflow".

The workflow will build wheels for all supported Python versions and automatically upload them to PyPI if the token is configured correctly.

Part 2: Releasing via GitHub Release

This method creates a formal GitHub release with a tag, which automatically triggers the build and upload workflow.

Steps (after completing setup above):

  1. Go to the Releases tab: https://github.com/google/ml-metadata/releases
  2. Click the Draft new release button (you'll be redirected to https://github.com/google/ml-metadata/releases/new)
  3. Click the Select tag button and create a new tag for your release (e.g., v1.18.0)
  4. Click the Target dropdown and select your release branch
  5. Fill in the Release title and Release notes sections
  6. Choose the release type:
    • Check Set as a pre-release if this is a beta/test release
    • Leave unchecked for Set as the latest release for stable releases
  7. Click the Publish release button
  8. Verify the workflow is running by going to the Actions tab: https://github.com/google/ml-metadata/actions/workflows/conda-build.yml

The Build ml-metadata with Conda workflow will automatically trigger and build/upload wheels to PyPI if the token is configured correctly.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ml_metadata_czgdp1807-1.18.0-cp312-cp312-manylinux_2_39_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

ml_metadata_czgdp1807-1.18.0-cp312-cp312-macosx_11_0_arm64.whl (3.0 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

ml_metadata_czgdp1807-1.18.0-cp311-cp311-manylinux_2_39_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.39+ x86-64

ml_metadata_czgdp1807-1.18.0-cp311-cp311-macosx_11_0_arm64.whl (3.0 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

ml_metadata_czgdp1807-1.18.0-cp310-cp310-manylinux_2_39_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.39+ x86-64

ml_metadata_czgdp1807-1.18.0-cp310-cp310-macosx_11_0_arm64.whl (3.0 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

ml_metadata_czgdp1807-1.18.0-cp39-cp39-manylinux_2_39_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.39+ x86-64

ml_metadata_czgdp1807-1.18.0-cp39-cp39-macosx_11_0_arm64.whl (3.0 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file ml_metadata_czgdp1807-1.18.0-cp312-cp312-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for ml_metadata_czgdp1807-1.18.0-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 7b7ee57e43ca3aafe21f87052ff7c7fd3e74136ff0ae6d83b09a309031cdf8f9
MD5 053308a5d495fa2cfa6469daab0071ab
BLAKE2b-256 9458c1a0e0f66883b6e741c3300db2e7ec58f6a9e0af0e22fb4d4f821c84f9cd

See more details on using hashes here.

File details

Details for the file ml_metadata_czgdp1807-1.18.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ml_metadata_czgdp1807-1.18.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9747e42319242b83cf19a69f30186d836050dea728778266b74945b8082f70ed
MD5 f3759b476a1d4184879178f3fe5bd139
BLAKE2b-256 6dc2f1cee964358b6c29f4bd5145cdf26513a8ce6115e26cfdcb5e57d388f299

See more details on using hashes here.

File details

Details for the file ml_metadata_czgdp1807-1.18.0-cp311-cp311-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for ml_metadata_czgdp1807-1.18.0-cp311-cp311-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 e8582c7b018c9390d6ce7fc7b78ca22a12d12b97026d913515bc5090e1de5a17
MD5 711af0a56baedb9472d41febbb8696ee
BLAKE2b-256 9214ae6a1a4a4bc1c6e07e5060cc4bdc91b9dadd5cfc921cbfd0f32a56646b28

See more details on using hashes here.

File details

Details for the file ml_metadata_czgdp1807-1.18.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ml_metadata_czgdp1807-1.18.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d59c4388b8f36a8c6cfeb11110162d04f8b9c7cea1445211e7893e565b8c5de1
MD5 c06530f81695ff0d3abf3b2ee6170bc6
BLAKE2b-256 f14415dfa9aba9a608faa94c2c63b09de0dda1204b97342a89c7c9d4f73038f3

See more details on using hashes here.

File details

Details for the file ml_metadata_czgdp1807-1.18.0-cp310-cp310-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for ml_metadata_czgdp1807-1.18.0-cp310-cp310-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 e2e9a62800da92d7e1154837703ac0217c9e52b1e3b0e1a8787262562b25e549
MD5 538405750722e235cd7b9bf71a1df416
BLAKE2b-256 d8bf1468f632b98fe2f3833b91fa03a4e1ca1d745fceb0e025eba9fdcdba6418

See more details on using hashes here.

File details

Details for the file ml_metadata_czgdp1807-1.18.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ml_metadata_czgdp1807-1.18.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8737cc3033abb586cb17ca9220335147a8be1a4f0fe9cb9f855b61d7c626d767
MD5 a26e7d987a2b9b15e8150ad109179c61
BLAKE2b-256 0b7fc090c59c505e4cb9b2669da80b3021b38796231e11a730a2edc118de576b

See more details on using hashes here.

File details

Details for the file ml_metadata_czgdp1807-1.18.0-cp39-cp39-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for ml_metadata_czgdp1807-1.18.0-cp39-cp39-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 166dcf370c51b037a1107ef5a522a868314a6438fd4246071e137dcec84eafad
MD5 bb80d96a4e11118466d07fe499a6400e
BLAKE2b-256 3c6201dff72c1a70cfcfa18aaab04e6da0b572c240553e0ab5eb33c92988517f

See more details on using hashes here.

File details

Details for the file ml_metadata_czgdp1807-1.18.0-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ml_metadata_czgdp1807-1.18.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5e39211c3e67439c73d98dcae547e96032fb69d4ac7dc104c543d437331d2b1b
MD5 60cac04ac9034f829117c87cfedf9e2e
BLAKE2b-256 043d41276f190332e60d9f15cfac2ab5715bae13fbd79d574183afc40375b8e7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page