Skip to main content

Nucleus

https://dashboard.scale.com/nucleus

Aggregate metrics in ML are not good enough. To improve production ML, you need to understand their qualitative failure modes, fix them by gathering more data, and curate diverse scenarios.

Scale Nucleus helps you:

  • Visualize your data
  • Curate interesting slices within your dataset
  • Review and manage annotations
  • Measure and debug your model performance

Nucleus is a new way—the right way—to develop ML models, helping us move away from the concept of one dataset and towards a paradigm of collections of scenarios.

Installation

$ pip install scale-nucleus

CLI installation

We recommend installing the CLI via pipx (https://pypa.github.io/pipx/installation/). This makes sure that the CLI does not interfere with you system packages and is accessible from your favorite terminal.

For MacOS:

brew install pipx
pipx ensurepath
pipx install scale-nucleus
# Optional installation of shell completion (for bash, zsh or fish)
nu install-completions

Otherwise, install via pip (requires pip 19.0 or later):

python3 -m pip install --user pipx
python3 -m pipx ensurepath
python3 -m pipx install scale-nucleus
# Optional installation of shell completion (for bash, zsh or fish)
nu install-completions

Common issues/FAQ

Outdated Client

Nucleus is iterating rapidly and as a result we do not always perfectly preserve backwards compatibility with older versions of the client. If you run into any unexpected error, it's a good idea to upgrade your version of the client by running

pip install --upgrade scale-nucleus

Usage

For the most up to date documentation, reference: https://dashboard.scale.com/nucleus/docs/api?language=python.

For Developers

Clone from github and install as editable

git clone git@github.com:scaleapi/nucleus-python-client.git
cd nucleus-python-client
pip3 install poetry
poetry install

Please install the pre-commit hooks by running the following command:

poetry run pre-commit install

When releasing a new version please add release notes to the changelog in CHANGELOG.md.

Best practices for testing: (1). Please run pytest from the root directory of the repo, i.e.

poetry run pytest tests/test_dataset.py

(2) To skip slow integration tests that have to wait for an async job to start.

poetry run pytest -n auto -m "not integration"

Note: "-n auto" is used for pytest-xdist parallelization

Pydantic Models

Prefer using Pydantic models rather than creating raw dictionaries or dataclasses to send or receive over the wire as JSONs. Pydantic is created with data validation in mind and provides very clear error messages when it encounters a problem with the payload.

The Pydantic model(s) should mirror the payload to send. To represent a JSON payload that looks like this:

{
  "example_json_with_info": {
    "metadata": {
      "frame": 0
    },
    "reference_id": "frame0",
    "url": "s3://example/scale_nucleus/2021/lidar/0038711321865000.json",
    "type": "pointcloud"
  },
  "example_image_with_info": {
    "metadata": {
      "author": "Picasso"
    },
    "reference_id": "frame0",
    "url": "s3://bucket/0038711321865000.jpg",
    "type": "image"
  }
}

Could be represented as the following structure. Note that the field names map to the JSON keys and the usage of field validators (@validator).

import os.path
from pydantic import BaseModel, validator
from typing import Literal


class JsonWithInfo(BaseModel):
    metadata: dict  # any dict is valid
    reference_id: str
    url: str
    type: Literal["pointcloud", "recipe"]

    @validator("url")
    def has_json_extension(cls, v):
        if not v.endswith(".json"):
            raise ValueError(f"Expected '.json' extension got {v}")
        return v


class ImageWithInfo(BaseModel):
    metadata: dict  # any dict is valid
    reference_id: str
    url: str
    type: Literal["image", "mask"]

    @validator("url")
    def has_valid_extension(cls, v):
        valid_extensions = {".jpg", ".jpeg", ".png", ".tiff"}
        _, extension = os.path.splitext(v)
        if extension not in valid_extensions:
            raise ValueError(f"Expected extension in {valid_extensions} got {v}")
        return v


class ExampleNestedModel(BaseModel):
    example_json_with_info: JsonWithInfo
    example_image_with_info: ImageWithInfo

# Usage:
import requests
payload = requests.get("/example")
parsed_model = ExampleNestedModel.parse_obj(payload.json())
requests.post("example/post_to", json=parsed_model.dict())

Migrating to Pydantic

  • When migrating an interface from a dictionary use nucleus.pydantic_base.DictCompatibleModel. That allows you to get the benefits of Pydantic but maintaints backwards compatibility with a Python dictionary by delegating __getitem__ to fields.
  • When migrating a frozen dataclass use nucleus.pydantic_base.ImmutableModel. That is a base class set up to be immutable after initialization.

Updating documentation: We use Sphinx to autogenerate our API Reference from docstrings.

To test your local docstring changes, run the following commands from the repository's root directory:

poetry shell
cd docs
sphinx-autobuild . ./_build/html --watch ../nucleus

sphinx-autobuild will spin up a server on localhost (port 8000 by default) that will watch for and automatically rebuild a version of the API reference based on your local docstring changes.

Custom Metrics using Shapely in scale-validate

Certain metrics use Shapely and rasterio which is added as optional dependencies.

pip install scale-nucleus[metrics]

Note that you might need to install a local GEOS package since Shapely doesn't provide binaries bundled with GEOS for every platform.

#Mac OS
brew install geos
# Ubuntu/Debian flavors
apt-get install libgeos-dev

To develop it locally use

poetry install --extras metrics

Metadata

Release files for scale-nucleus 0.23.0

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

Source distribution (sdist)

Source distribution for scale-nucleus 0.23.0
File Size Uploaded Provenance Actions
scale_nucleus-0.23.0.tar.gz 183.5 kB Without provenance Details for scale_nucleus-0.23.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for scale-nucleus 0.23.0
File Actions
scale_nucleus-0.23.0-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details for scale_nucleus-0.23.0-cp314-cp314-win_amd64.whl
scale_nucleus-0.23.0-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ x86-64, Linux glibc 2.5+ x86-64 Details for scale_nucleus-0.23.0-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
scale_nucleus-0.23.0-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details for scale_nucleus-0.23.0-cp314-cp314-macosx_11_0_arm64.whl
scale_nucleus-0.23.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for scale_nucleus-0.23.0-cp313-cp313-win_amd64.whl
scale_nucleus-0.23.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.5+ x86-64, Linux glibc 2.28+ x86-64 Details for scale_nucleus-0.23.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
scale_nucleus-0.23.0-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details for scale_nucleus-0.23.0-cp313-cp313-macosx_11_0_arm64.whl
scale_nucleus-0.23.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for scale_nucleus-0.23.0-cp312-cp312-win_amd64.whl
scale_nucleus-0.23.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.5+ x86-64, Linux glibc 2.28+ x86-64 Details for scale_nucleus-0.23.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
scale_nucleus-0.23.0-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for scale_nucleus-0.23.0-cp312-cp312-macosx_11_0_arm64.whl
scale_nucleus-0.23.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for scale_nucleus-0.23.0-cp311-cp311-win_amd64.whl
scale_nucleus-0.23.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.5+ x86-64, Linux glibc 2.28+ x86-64 Details for scale_nucleus-0.23.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
scale_nucleus-0.23.0-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for scale_nucleus-0.23.0-cp311-cp311-macosx_11_0_arm64.whl

Total release size: 3.0 MB

Release files / scale_nucleus-0.23.0.tar.gz

Download URL scale_nucleus-0.23.0.tar.gz
Size 183.5 kB
Tags Source
SHA-256 checksum
How to use checksums
20dc336b22702fbde9148201e8204072c5eefebff82d5d40e98efdb6bbc58c48
BLAKE2b-256 checksum
How to use checksums
94f05537e8ce808284fb2cb84690ec8c331a4d7efbf6544e1448e71cf31d0ead
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.18 Linux/7.0.0-1016-aws

Release files / scale_nucleus-0.23.0-cp314-cp314-win_amd64.whl

Download URL scale_nucleus-0.23.0-cp314-cp314-win_amd64.whl
Size 230.7 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
53bccf5b8be9b5fa60eb82b112cda797c907d75c60637b7ed3ee61597b1238d7
BLAKE2b-256 checksum
How to use checksums
14e90236d8a5317d2508321029b98850bfbb9f72fa77da0a83e6df363174c90d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.18 Linux/7.0.0-1016-aws

Release files / scale_nucleus-0.23.0-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl

Download URL scale_nucleus-0.23.0-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Size 245.7 kB
Tags CPython 3.14 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
828831751704891918c3f4f812a15c811785e7d8c69dc9955bc01cdfa3f23e2a
BLAKE2b-256 checksum
How to use checksums
a796c7f2ab9570a2d21d70c314068a6db4160ce49c23227b0431f6bd95249dd5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.18 Linux/7.0.0-1016-aws

Release files / scale_nucleus-0.23.0-cp314-cp314-macosx_11_0_arm64.whl

Download URL scale_nucleus-0.23.0-cp314-cp314-macosx_11_0_arm64.whl
Size 229.3 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ec03e81a787a461c4ff5563e23f990a2f83bb2afbcd8c378f38241e1c1b38681
BLAKE2b-256 checksum
How to use checksums
db684de79779bd82c5eb69aceff7b9472f533c6470b5c8db8b9af1b326e9619b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.18 Linux/7.0.0-1016-aws

Release files / scale_nucleus-0.23.0-cp313-cp313-win_amd64.whl

Download URL scale_nucleus-0.23.0-cp313-cp313-win_amd64.whl
Size 230.8 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
46ed126afa3912f4c70e2c38888e104aed25cf88520304cc5a5085b03dd5b1e0
BLAKE2b-256 checksum
How to use checksums
6f4ec0e0f0112177ac2a8ab23f8fe013920f1b221791bcce47829a68ffeb849b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.18 Linux/7.0.0-1016-aws

Release files / scale_nucleus-0.23.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl

Download URL scale_nucleus-0.23.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Size 245.7 kB
Tags CPython 3.13 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
1c1a2bd6b8bcd07f305cbfe985db39afe5cd254a7aa677a3a8b106af3e550f1b
BLAKE2b-256 checksum
How to use checksums
8757bf651460483da7ce35191beeaa06def8c8a41b53bc96b16715854d85a77f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.18 Linux/7.0.0-1016-aws

Release files / scale_nucleus-0.23.0-cp313-cp313-macosx_11_0_arm64.whl

Download URL scale_nucleus-0.23.0-cp313-cp313-macosx_11_0_arm64.whl
Size 229.3 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
fab3ddaaac8a38e6ed04c0f1bb15846c71cc3f1d1c3597539639f65000a7640d
BLAKE2b-256 checksum
How to use checksums
2c76a1476072d0a292115785a8fa8ce2e0693539bc6e1554ee2929a0f29d7139
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.18 Linux/7.0.0-1016-aws

Release files / scale_nucleus-0.23.0-cp312-cp312-win_amd64.whl

Download URL scale_nucleus-0.23.0-cp312-cp312-win_amd64.whl
Size 230.8 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
585083570def4b29c330f02060a7abb5224b5a2b4c94a1750fc7c96745d88fa2
BLAKE2b-256 checksum
How to use checksums
3035c44c25e9e7b4e96f21c70cf4fbcaf700ca97cd75dda0d2f65dd822643f4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.18 Linux/7.0.0-1016-aws

Release files / scale_nucleus-0.23.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl

Download URL scale_nucleus-0.23.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Size 245.6 kB
Tags CPython 3.12 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
9e2522d607baa2c26ffd918b5b279bbe0eb2f73292f20d6e2a6dea798e72032d
BLAKE2b-256 checksum
How to use checksums
475beb0339eea30af18e7aafef4a1602fce0582fb9f4c60ab90c37fca173a6dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.18 Linux/7.0.0-1016-aws

Release files / scale_nucleus-0.23.0-cp312-cp312-macosx_11_0_arm64.whl

Download URL scale_nucleus-0.23.0-cp312-cp312-macosx_11_0_arm64.whl
Size 229.3 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
11262547a0680954eff45bb0ea9bca74b7de974c8605f90e2c908ef3fa47abda
BLAKE2b-256 checksum
How to use checksums
48f18b53bb3faae6b574c889a5e60c4dbb1591db3a6a37af42427d1ba05f626f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.18 Linux/7.0.0-1016-aws

Release files / scale_nucleus-0.23.0-cp311-cp311-win_amd64.whl

Download URL scale_nucleus-0.23.0-cp311-cp311-win_amd64.whl
Size 230.8 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
3f87e5328efd7b48c87ec4a4d1e6f9923850cb22315e2cf755a04d8b0b0aa1c6
BLAKE2b-256 checksum
How to use checksums
2bc66b32b8dcb74afc466bcfd4a98f2140a07e734acee1f1ca70d09decfdc152
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.18 Linux/7.0.0-1016-aws

Release files / scale_nucleus-0.23.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl

Download URL scale_nucleus-0.23.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Size 245.3 kB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
ba13b5b1f7190a408d62a3154d3572745985faec296dc48af23559df3727bbef
BLAKE2b-256 checksum
How to use checksums
7e673946090d10d9827b21d7f81390f64f1f417cb4c80848b9b46f05deba5c3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.18 Linux/7.0.0-1016-aws

Release files / scale_nucleus-0.23.0-cp311-cp311-macosx_11_0_arm64.whl

Download URL scale_nucleus-0.23.0-cp311-cp311-macosx_11_0_arm64.whl
Size 229.3 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b44927e0ae92532556b9e2766ac09e7c50c2e416591e7373ccfaad9d08ec8d98
BLAKE2b-256 checksum
How to use checksums
352adbd3244166200e5dccf248d96f22db4e12b86877ecf348b89056a591186a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.18 Linux/7.0.0-1016-aws

Security for scale-nucleus 0.23.0

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.23.0 This release

13 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